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
This commit is contained in:
Bartlomiej Poniecki-Klotz 2021-10-18 14:04:02 +02:00 committed by Aurelien Lourot
parent 13fef16326
commit d92cf5756e
3 changed files with 4 additions and 2 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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):