Skip to content

Commit 9f98c3b

Browse files
author
Aravind Selvan
committed
[api][s3g] OPSAPS-39155 Python client changes for
Prune command This change adds a new 'command by name' endpoint to external accounts that would be used to invoke S3PruneCommand Testing done: -make clean; python setup.py install; make test; make dist; -Using a Python script, tested that S3GuardPrune works on a cdep cluster.
1 parent 1e3d56b commit 9f98c3b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

python/src/cm_api/endpoints/external_accounts.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,14 @@ def update_config(self, config):
192192
@return: Dictionary with updated configuration.
193193
"""
194194
return self._update_config("config", config)
195+
196+
def external_account_cmd_by_name(self, command_name):
197+
"""
198+
Executes a command on the external account specified
199+
by name.
200+
201+
@param command_name: The name of the command.
202+
@return: Reference to the submitted command.
203+
@since: API v16
204+
"""
205+
return self._cmd(command_name, data=self.name, api_version=16)

python/src/cm_api_tests/test_external_accounts.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,12 @@ def test_update_acct_config(self):
188188
self.assertTrue(entry[1] == 'foo')
189189
else:
190190
self.assertFailure()
191+
192+
def test_s3_guard_prune_cmd(self):
193+
command_name = 'S3GuardPrune'
194+
data = '"test1"'
195+
self.resource.expect("POST",
196+
"/externalAccounts/account/%s/commands/%s" % ('test1', command_name),
197+
data=data, retdata={'name' : 'S3GuardPrune'})
198+
resp = self.account.external_account_cmd_by_name(command_name)
199+
self.assertEquals('S3GuardPrune', resp.name)

0 commit comments

Comments
 (0)