Add Fuel admin node IP to the list of environments

Usage:

    dos.py list --ips

Option '--ips' adds IP address of each Fuel admin node to
the list of environments.

Change-Id: I8298c7d295abc0657a74c4a155bd180ff7329701
This commit is contained in:
Dennis Dmitriev 2014-10-28 19:18:04 +02:00
parent 0bf81a95d9
commit d93c44dbbc
1 changed files with 15 additions and 1 deletions

View File

@ -32,7 +32,15 @@ class Shell(object):
def do_list(self):
env_list = self.manager.environment_list().values('name')
for env in env_list:
print(env['name'])
if self.params.list_ips:
cur_env = self.manager.environment_get(env['name'])
admin_ip = ''
if 'admin' in [node.name for node in cur_env.nodes]:
admin_ip = (cur_env.node_by_name('admin').
get_ip_address_by_network_name('admin'))
print('{0}\t{1}'.format(env['name'], admin_ip))
else:
print(env['name'])
return env_list
@ -161,6 +169,11 @@ class Shell(object):
action='store_const', const=True,
help='revert without timesync',
default=False)
list_ips_parser = argparse.ArgumentParser(add_help=False)
list_ips_parser.add_argument('--ips', dest='list_ips',
action='store_const', const=True,
help='show admin node ip addresses',
default=False)
parser = argparse.ArgumentParser(
description="Manage virtual environments. "
"For addional help use command with -h/--help")
@ -168,6 +181,7 @@ class Shell(object):
help='available commands',
dest='command')
subparsers.add_parser('list',
parents=[list_ips_parser],
help="Show virtual environments",
description="Show virtual environments on host")
subparsers.add_parser('show', parents=[name_parser],