Browse Source

add --server-flavor to query command

Change-Id: I58f3638263b4965a185852a949813b0414a1b5cf
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Doug Hellmann 2 years ago
parent
commit
3467befaf1
1 changed files with 13 additions and 0 deletions
  1. 13
    0
      downpour/query.py

+ 13
- 0
downpour/query.py View File

@@ -59,8 +59,15 @@ def register_command(subparsers):
59 59
     do_query.add_argument(
60 60
         '--server-name',
61 61
         action='append',
62
+        default=[],
62 63
         help='pattern to match against server names',
63 64
     )
65
+    do_query.add_argument(
66
+        '--server-flavor',
67
+        action='append',
68
+        default=[],
69
+        help='server flavor(s) to capture',
70
+    )
64 71
     do_query.set_defaults(func=query_data)
65 72
 
66 73
 
@@ -72,4 +79,10 @@ def query_data(cloud, config, args):
72 79
         for server_info in cloud.search_servers(name_or_id=pattern):
73 80
             editor.add_server(server_info)
74 81
 
82
+    for flavor in args.server_flavor:
83
+        LOG.info('searching for servers using flavor %r', flavor)
84
+        for server_info in cloud.search_servers(
85
+                filters={'flavor': {'id': flavor}}):
86
+            editor.add_server(server_info)
87
+
75 88
     editor.save()

Loading…
Cancel
Save