Fix subcloud manage/unmanage commands
The subcloud_update interface was changed to support files and data parameters. The manage/unmanage CLI that uses the subcloud update interface was not updated. As a result, the command failed. This update fixes this issue. Tests: Manage/unmanage subclouds few times. Closes-Bug: 1885141 Change-Id: I729895d76bbc76eac87420215bff04836d7eb678 Signed-off-by: Tao Liu <tao.liu@windriver.com>
This commit is contained in:
parent
dd05eccb08
commit
e3736b5227
|
@ -99,8 +99,9 @@ class subcloud_manager(base.ResourceManager):
|
|||
|
||||
def subcloud_update(self, url, body, data):
|
||||
fields = dict()
|
||||
for k, v in body.items():
|
||||
fields.update({k: (v, open(v, 'rb'),)})
|
||||
if body is not None:
|
||||
for k, v in body.items():
|
||||
fields.update({k: (v, open(v, 'rb'),)})
|
||||
fields.update(data)
|
||||
enc = MultipartEncoder(fields=fields)
|
||||
headers = {'Content-Type': enc.content_type}
|
||||
|
|
|
@ -341,7 +341,7 @@ class UnmanageSubcloud(base.DCManagerShowOne):
|
|||
kwargs['management-state'] = 'unmanaged'
|
||||
try:
|
||||
return dcmanager_client.subcloud_manager.update_subcloud(
|
||||
subcloud_ref, **kwargs)
|
||||
subcloud_ref, files=None, data=kwargs)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
error_msg = "Unable to unmanage subcloud %s" % (subcloud_ref)
|
||||
|
@ -370,7 +370,7 @@ class ManageSubcloud(base.DCManagerShowOne):
|
|||
kwargs['management-state'] = 'managed'
|
||||
try:
|
||||
return dcmanager_client.subcloud_manager.update_subcloud(
|
||||
subcloud_ref, **kwargs)
|
||||
subcloud_ref, files=None, data=kwargs)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
error_msg = "Unable to manage subcloud %s" % (subcloud_ref)
|
||||
|
|
Loading…
Reference in New Issue