From 8a1bc46bf04d15e19c2062c7def947b95ddeb455 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 11 Jun 2018 01:35:50 -0400 Subject: [PATCH] Move some things around and rename vars --- pvc.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pvc.py b/pvc.py index 5e30cdf0..c8b3fc73 100755 --- a/pvc.py +++ b/pvc.py @@ -20,13 +20,11 @@ # ############################################################################### -import kazoo.client, socket, time, click, lxml.objectify, pvcf, ansiiprint +import kazoo.client, os, socket, time, click, lxml.objectify, pvcf, ansiiprint, configparser -this_host = socket.gethostname() +myhostname = socket.gethostname() zk_host = '' -CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'], max_content_width=120) - ######################## ######################## ## ## @@ -35,6 +33,8 @@ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'], max_content_width=12 ######################## ######################## +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'], max_content_width=120) + ############################################################################### # pvc node ############################################################################### @@ -51,7 +51,7 @@ def node(): ############################################################################### @click.command(name='flush', short_help='Take a node out of service') @click.option( - '-n', '--name', 'node_name', default=this_host, show_default=True, + '-n', '--name', 'node_name', default=myhostname, show_default=True, help='The PVC node to operate on.' ) def flush_host(node_name): @@ -80,7 +80,7 @@ def flush_host(node_name): ############################################################################### @click.command(name='ready', short_help='Restore node to service') @click.option( - '-n', '--name', 'node_name', default=this_host, show_default=True, + '-n', '--name', 'node_name', default=myhostname, show_default=True, help='The PVC node to operate on.' ) def ready_host(node_name): @@ -124,7 +124,7 @@ def vm(): help='The XML config file to define the domain from.' ) @click.option( - '-v', '--hypervisor', 'target_hypervisor', default=this_host, show_default=True, + '-v', '--hypervisor', 'target_hypervisor', default=myhostname, show_default=True, help='The home hypervisor for this domain.' ) def define_vm(xml_config_file, target_hypervisor): @@ -747,7 +747,7 @@ def init_cluster(): ############################################################################### @click.group(context_settings=CONTEXT_SETTINGS) @click.option( - '-z', '--zookeeper', '_zk_host', envvar='PVC_ZOOKEEPER', default='{}:2181'.format(this_host), show_default=True, + '-z', '--zookeeper', '_zk_host', envvar='PVC_ZOOKEEPER', default='{}:2181'.format(myhostname), show_default=True, help='Zookeeper connection string.' ) def cli(_zk_host):