From d92cf5756ed7ee7364e7b12061b69d51aa5bc684 Mon Sep 17 00:00:00 2001 From: Bartlomiej Poniecki-Klotz Date: Mon, 18 Oct 2021 14:04:02 +0200 Subject: [PATCH] Fixed removing multiple devices Added a confirmation flag for swift-ring-builder command when multiple devices are found to be removed. func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/656 Closes-Bug: #1937289 Change-Id: Ieeb326e7d9af21a77954e95e909d6fcf20a3092c --- lib/swift_utils.py | 2 +- tests/tests.yaml | 1 + unit_tests/test_swift_utils.py | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/swift_utils.py b/lib/swift_utils.py index b0a4106..e8cc56b 100644 --- a/lib/swift_utils.py +++ b/lib/swift_utils.py @@ -641,7 +641,7 @@ def remove_from_ring(ring_path, search_value): :type search_value: str :raises: SwiftProxyCharmException """ - cmd = ['swift-ring-builder', ring_path, 'remove', search_value] + cmd = ['swift-ring-builder', ring_path, 'remove', search_value, '-y'] try: subprocess.check_call(cmd) except subprocess.CalledProcessError as e: diff --git a/tests/tests.yaml b/tests/tests.yaml index 2444b84..73d593e 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -40,6 +40,7 @@ tests: - zaza.openstack.charm_tests.swift.tests.S3APITest - swift_gr_region1: - zaza.openstack.charm_tests.swift.tests.SwiftGlobalReplicationTests + - zaza.openstack.charm_tests.swift.tests.SwiftProxyMultiZoneTests tests_options: force_deploy: diff --git a/unit_tests/test_swift_utils.py b/unit_tests/test_swift_utils.py index 7f7854b..a9223d4 100644 --- a/unit_tests/test_swift_utils.py +++ b/unit_tests/test_swift_utils.py @@ -562,7 +562,8 @@ class SwiftUtilsTestCase(unittest.TestCase): check_call.assert_called_once_with(['swift-ring-builder', '/etc/swift/account.builder', 'remove', - 'd1']) + 'd1', + '-y']) @mock.patch.object(subprocess, 'check_call') def test_set_weight_in_ring(self, check_call):