add --server-flavor to query command
Change-Id: I58f3638263b4965a185852a949813b0414a1b5cf Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
19303a0504
commit
3467befaf1
|
@ -59,8 +59,15 @@ def register_command(subparsers):
|
|||
do_query.add_argument(
|
||||
'--server-name',
|
||||
action='append',
|
||||
default=[],
|
||||
help='pattern to match against server names',
|
||||
)
|
||||
do_query.add_argument(
|
||||
'--server-flavor',
|
||||
action='append',
|
||||
default=[],
|
||||
help='server flavor(s) to capture',
|
||||
)
|
||||
do_query.set_defaults(func=query_data)
|
||||
|
||||
|
||||
|
@ -72,4 +79,10 @@ def query_data(cloud, config, args):
|
|||
for server_info in cloud.search_servers(name_or_id=pattern):
|
||||
editor.add_server(server_info)
|
||||
|
||||
for flavor in args.server_flavor:
|
||||
LOG.info('searching for servers using flavor %r', flavor)
|
||||
for server_info in cloud.search_servers(
|
||||
filters={'flavor': {'id': flavor}}):
|
||||
editor.add_server(server_info)
|
||||
|
||||
editor.save()
|
||||
|
|
Loading…
Reference in New Issue