diff options
Diffstat (limited to 'qtip/cli/commands/cmd_project.py')
-rw-r--r-- | qtip/cli/commands/cmd_project.py | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/qtip/cli/commands/cmd_project.py b/qtip/cli/commands/cmd_project.py index 740fb1c4..f7ac3a83 100644 --- a/qtip/cli/commands/cmd_project.py +++ b/qtip/cli/commands/cmd_project.py @@ -39,12 +39,22 @@ def cli(): @cli.command(help="Create new testing project") -@click.option('--pod', default='unknown', help='Name of pod under test') -@click.option('--installer', help='OPNFV installer', default='manual') -@click.option('--master-host', help='Installer hostname', default='dummy-host') -@click.option('--scenario', default='unknown', help='OPNFV scenario') +@click.option('--template', + prompt='Choose project template', + type=click.Choice(['compute', 'doctor']), + default='compute', + help='Choose project template') +@click.option('--pod', default='unknown', prompt='Pod Name', + 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', + help='OPNFV scenario') @click.argument('name') -def create(pod, installer, master_host, scenario, name): +def create(pod, installer, master_host, scenario, name, template): + qtip_generator_role = os.path.join(utils.QTIP_ANSIBLE_ROLES, 'qtip-generator') extra_vars = { 'qtip_package': utils.QTIP_PACKAGE, 'cwd': os.getcwd(), @@ -52,14 +62,16 @@ def create(pod, installer, master_host, scenario, name): 'installer': installer, 'scenario': scenario, 'installer_master_host': master_host, - 'workspace': name + 'project_name': name, + 'project_template': template } - os.system("ANSIBLE_ROLES_PATH={qtip_package}/{roles_path} ansible-playbook" - " -i {qtip_package}/{roles_path}/qtip-workspace/hosts" - " {qtip_package}/{roles_path}/qtip-workspace/create.yml" + os.system("ANSIBLE_ROLES_PATH={roles_path} ansible-playbook" + " -i {hosts}" + " {playbook}" " --extra-vars '{extra_vars}'" - "".format(qtip_package=utils.QTIP_PACKAGE, - roles_path=utils.ROLES_PATH, + "".format(roles_path=utils.QTIP_ANSIBLE_ROLES, + hosts=os.path.join(qtip_generator_role, 'hosts'), + playbook=os.path.join(qtip_generator_role, 'main.yml'), extra_vars=utils.join_vars(**extra_vars))) |