From 2c992d884fd318f5a3dbf3f1c02f90a1240dc7ab Mon Sep 17 00:00:00 2001 From: linux_geek Date: Thu, 17 Nov 2016 08:44:27 +0500 Subject: Ansible related commands in its own module. JIRA: QTIP-154 JIRA: QTIP-150 Change-Id: I1bdd8d74d8978fd86ea659dae914f12874b6687d Signed-off-by: Taseer Ahmed --- qtip/cli/commands/cmd_ansible.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/qtip/cli/commands/cmd_ansible.py b/qtip/cli/commands/cmd_ansible.py index 001185a3..857e68e2 100644 --- a/qtip/cli/commands/cmd_ansible.py +++ b/qtip/cli/commands/cmd_ansible.py @@ -30,3 +30,32 @@ class Ansible: def status(self): click.echo("check connectivity") pass + + +@click.group() +def cli(): + pass + +_ansible = Ansible() + + +@cli.group() +@click.pass_context +def ansible(ctx): + pass + + +@ansible.command('prepare', help="Prepares the ansible environment. " + "This step is needed run benchmarks.") +def ansible_prepare(): + _ansible.prepare() + + +@ansible.command('show', help="Shows the current ansible configuration.") +def ansible_show(): + _ansible.show() + + +@ansible.command('status', help="Checks if ansible still connects to hosts.") +def ansible_status(): + _ansible.status() -- cgit 1.2.3-korg From a28cc39929bef8027300c158d6c4804c0f55db75 Mon Sep 17 00:00:00 2001 From: linux_geek Date: Thu, 17 Nov 2016 08:33:03 +0500 Subject: Bugfix: Correct the path in setup and entry points JIRA: QTIP-154 Change-Id: I00320818e2d2e633c901b126775cbeb5a721f6fd Signed-off-by: Taseer Ahmed --- qtip/cli/entry.py | 36 ++++++------------------------------ setup.py | 4 ++-- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/qtip/cli/entry.py b/qtip/cli/entry.py index f9dc440c..66e45ddc 100644 --- a/qtip/cli/entry.py +++ b/qtip/cli/entry.py @@ -8,37 +8,13 @@ ############################################################################## import click - -from cli.commands.ansible import Ansible +from qtip.cli.commands import cmd_perftest +from qtip.cli.commands import cmd_suite +from qtip.cli.commands import cmd_ansible CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) +cli = click.CommandCollection(sources=[cmd_perftest.cli, cmd_suite.cli, cmd_ansible.cli]) -@click.group(context_settings=CONTEXT_SETTINGS) -@click.version_option(version='0.1.dev0') -def cli(): - pass - -_ansible = Ansible() - - -@cli.group() -@click.pass_context -def ansible(ctx): - pass - - -@ansible.command('prepare', help="Prepares the ansible environment. " - "This step is needed run benchmarks.") -def ansible_prepare(): - _ansible.prepare() - - -@ansible.command('show', help="Shows the current ansible configuration.") -def ansible_show(): - _ansible.show() - - -@ansible.command('status', help="Checks if ansible still connects to hosts.") -def ansible_status(): - _ansible.status() +if __name__ == '__main__': + cli() diff --git a/setup.py b/setup.py index e00e97ba..15900362 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,9 @@ setup( author='OPNFV', author_email='zhang.yujunz@zte.com.cn', install_requires=['click', 'pyyaml', 'prettytable'], - packages=['cli'], + packages=['qtip.cli'], entry_points={ - 'console_scripts': ['qtip=cli.entry:cli'] + 'console_scripts': ['qtip=qtip.cli.entry:cli'] }, license='Apache-2.0', keywords="performance benchmark opnfv", -- cgit 1.2.3-korg