From cb3795a39882bb97c15ae5c9562faf577334399b Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Mon, 5 Jun 2017 21:51:51 +0800 Subject: Beautify the argument names - keep the argument consisten with OPNFV convention - installer-ip is not used because in fact we use host address instead - remove optional argurment from prompt Change-Id: I3db3cf53b62cc86e143bc59a7dd8bb83d0f74b7d Signed-off-by: Yujun Zhang --- qtip/cli/commands/cmd_project.py | 37 +++++++++++++++++++++---------------- qtip/cli/utils.py | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'qtip') diff --git a/qtip/cli/commands/cmd_project.py b/qtip/cli/commands/cmd_project.py index f7ac3a83..b32e71cd 100644 --- a/qtip/cli/commands/cmd_project.py +++ b/qtip/cli/commands/cmd_project.py @@ -39,31 +39,36 @@ def cli(): @cli.command(help="Create new testing project") -@click.option('--template', - prompt='Choose project template', +@click.argument('project_name') +@click.option('--project-template', type=click.Choice(['compute', 'doctor']), default='compute', help='Choose project template') -@click.option('--pod', default='unknown', prompt='Pod Name', +@click.option('--pod-name', + prompt='Pod Name', + default='opnfv-pod', help='Name of pod under test') -@click.option('--installer', prompt='OPNFV Installer', - help='OPNFV installer', default='manual') -@click.option('--master-host', prompt='Installer Hostname', - help='Installer hostname', default='dummy-host') -@click.option('--scenario', prompt='OPNFV Scenario', default='unknown', +@click.option('--installer-type', + type=click.Choice(['apex', 'fuel', 'manual']), + prompt='OPNFV Installer Type', + default='manual', + help='OPNFV installer') +@click.option('--installer-host', + prompt='Installer SSH Host Address', + help='Host configured for ssh client or IP addresses and domain name') +@click.option('--scenario', help='OPNFV scenario') -@click.argument('name') -def create(pod, installer, master_host, scenario, name, template): +def create(project_name, project_template, pod_name, installer_type, installer_host, scenario): qtip_generator_role = os.path.join(utils.QTIP_ANSIBLE_ROLES, 'qtip-generator') extra_vars = { 'qtip_package': utils.QTIP_PACKAGE, 'cwd': os.getcwd(), - 'pod_name': pod, - 'installer': installer, - 'scenario': scenario, - 'installer_master_host': master_host, - 'project_name': name, - 'project_template': template + 'project_name': project_name, + 'project_template': project_template, + 'pod_name': pod_name, + 'installer_type': installer_type, + 'installer_host': installer_host, + 'scenario': scenario } os.system("ANSIBLE_ROLES_PATH={roles_path} ansible-playbook" " -i {hosts}" diff --git a/qtip/cli/utils.py b/qtip/cli/utils.py index 0f0e7e95..331d2000 100644 --- a/qtip/cli/utils.py +++ b/qtip/cli/utils.py @@ -19,7 +19,7 @@ QTIP_ANSIBLE_ROLES = path.join(QTIP_PACKAGE, 'resources', 'ansible_roles') def join_vars(**kwargs): - return " ".join(["{}={}".format(variable, value) for variable, value in kwargs.items()]) + return " ".join(["{}={}".format(variable, value) for variable, value in kwargs.items() if value is not None]) def table(name, components): -- cgit 1.2.3-korg