From 12494941f1c3b6a2745843c5c600f83335e1662b Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Wed, 8 Apr 2020 13:41:50 +0300 Subject: [PATCH] [ci] Revert a part of osresources changes This should be done to unblock other projects that have rally job in their stable branches. Change-Id: Ib4f9c3d952140ed7086bfedee2bfd362ac808086 --- .zuul.d/zuul.yaml | 78 ------------------- tests/ci/osresources.py | 50 ++++++------ .../roles/check-os-resources/tasks/main.yaml | 2 +- .../tasks/main.yaml | 2 +- 4 files changed, 25 insertions(+), 107 deletions(-) diff --git a/.zuul.d/zuul.yaml b/.zuul.d/zuul.yaml index 82d48483..7d06526d 100644 --- a/.zuul.d/zuul.yaml +++ b/.zuul.d/zuul.yaml @@ -1,85 +1,7 @@ - project: check: jobs: - - rally-tox-cover - rally-tox-pep8 - - rally-tox-py36 - - rally-tox-py37 - - rally-tox-py38 - - rally-dsvm-tox-functional - - rally-docker-check - - rally-task-basic-with-existing-users: - # use_existing_users key did not trigger proper ansible tasks - voting: false - - rally-task-simple-job - - rally-task-barbican: - files: - - rally-jobs/barbican.yaml - - rally_openstack/common/osclients.py - - rally_openstack/common/services/key_manager - - rally_openstack/task/cleanup/resources.py - - rally_openstack/task/scenarios/barbican - - rally-task-cinder - # NOTE(andreykurilin): this requires more thing to configure before - # launching. - #- rally-task-designate - - rally-task-heat: - voting: false - - rally-task-ironic - - rally-task-keystone-glance-swift - - rally-task-magnum: - voting: false - files: - - rally-jobs/magnum.yaml - - rally_openstack/cleanup/resources.py - - rally_openstack/contexts/magnum - - rally_openstack/scenarios/magnum - - rally_openstack/osclients.py - - rally-task-manila-no-ss: - voting: false - - rally-task-manila-ss: - voting: false - - rally-task-mistral - # it did not work for a long time. try to re-configure it - #- rally-task-monasca - - rally-task-murano: - voting: false - - rally-task-neutron - - rally-task-neutron-trunk: - files: - - rally-jobs/neutron-trunk.yaml - - rally_openstack/scenarios/neutron/trunk.py - - rally_openstack/scenarios/neutron/network.py - - rally-task-neutron-with-extensions: - voting: false - - rally-task-nova: - voting: false - # it did not work for a long time - #- rally-task-senlin - #- rally-task-octavia: - # voting: false - - rally-task-telemetry - - rally-task-watcher: - # watcher-api did not start last time - voting: false - - rally-task-zaqar - - rally-verify-tempest gate: jobs: - - rally-tox-cover - rally-tox-pep8 - - rally-tox-py36 - - rally-tox-py37 - - rally-tox-py38 - - rally-dsvm-tox-functional - - rally-docker-check - - rally-task-simple-job - - rally-task-cinder - #- rally-task-heat - - rally-task-ironic - - rally-task-keystone-glance-swift - - rally-task-mistral - - rally-task-neutron - - rally-task-telemetry - - rally-task-zaqar - - rally-verify-tempest diff --git a/tests/ci/osresources.py b/tests/ci/osresources.py index 9c12be51..8ad36898 100755 --- a/tests/ci/osresources.py +++ b/tests/ci/osresources.py @@ -24,8 +24,13 @@ from rally.cli import cliutils from rally.common.plugin import discover from rally import plugins -from rally_openstack.common import consts -from rally_openstack.common import credential +try: + from rally_openstack.common import consts + from rally_openstack.common import credential +except ImportError: + # backward compatibility for stable branches + from rally_openstack import consts + from rally_openstack import credential def skip_if_service(service): @@ -518,7 +523,7 @@ class CloudResources(object): def dump_resources(resources_mgr, args): resources_list = resources_mgr.list() - with open(args.out, "w") as f: + with open(args.dump_list, "w") as f: f.write(json.dumps(resources_list)) @@ -538,7 +543,7 @@ def _print_tabular_resources(resources, table_label): def check_resource(resources_mgs, args): - with open(args.dump) as f: + with open(args.compare_with_list) as f: compare_to = f.read() compare_to = json.loads(compare_to) changes = resources_mgs.compare(with_list=compare_to) @@ -603,28 +608,16 @@ def main(): "list", help="List and save available cloud resources." ) p.set_defaults(func=dump_resources) - p.add_argument( - "--out", - type=str, - metavar="", - required=True, - help="A path to save dump to." - ) - - p = subparsers.add_parser( - "compare", - help="Compare current with given resources." - ) - p.set_defaults(func=check_resource) - p.add_argument( - "--with", - type=str, - dest="dump", - metavar="", - required=True, - help="A path to dump file with a JSON to compare resource with." - ) - + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument("--dump-list", + type=str, + metavar="", + help="dump resources to given file in JSON format") + group.add_argument("--compare-with-list", + type=str, + metavar="", + help=("compare current resources with a list from " + "given JSON file")) args = parser.parse_args() out = subprocess.check_output( @@ -637,7 +630,10 @@ def main(): resources = CloudResources(**config) - return args.func(resources, args) + if args.dump_list: + return dump_resources(resources, args) + else: + return check_resource(resources, args) if __name__ == "__main__": diff --git a/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml b/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml index 249928d6..25b1cb51 100644 --- a/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml +++ b/tests/ci/playbooks/roles/check-os-resources/tasks/main.yaml @@ -3,7 +3,7 @@ become_user: stack shell: cmd: | - python3 ./tests/ci/osresources.py compare --with {{ rally_resources_at_start }} + python3 ./tests/ci/osresources.py --compare-with-list {{ rally_resources_at_start }} chdir: "{{ zuul.projects['opendev.org/openstack/rally-openstack'].src_dir }}" ignore_errors: yes register: command_result diff --git a/tests/ci/playbooks/roles/snapshot-available-os-resources/tasks/main.yaml b/tests/ci/playbooks/roles/snapshot-available-os-resources/tasks/main.yaml index 415dbba3..61df2235 100644 --- a/tests/ci/playbooks/roles/snapshot-available-os-resources/tasks/main.yaml +++ b/tests/ci/playbooks/roles/snapshot-available-os-resources/tasks/main.yaml @@ -3,6 +3,6 @@ become_user: stack shell: cmd: | - python3 ./tests/ci/osresources.py list --out {{ rally_resources_at_start }} + python3 ./tests/ci/osresources.py --dump-list {{ rally_resources_at_start }} args: chdir: "{{ zuul.projects['opendev.org/openstack/rally-openstack'].src_dir }}"