|
|
|
@ -313,7 +313,14 @@ class decort_osimage(DecortController):
|
|
|
|
|
amodule.fail_json(**self.result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if amodule.params['image_id'] != 0 and amodule.params['image_name']:
|
|
|
|
|
if amodule.params['virt_id'] != 0 and amodule.params['virt_name']:
|
|
|
|
|
self.validated_virt_image_id, image_facts =\
|
|
|
|
|
self.decort_virt_image_find(amodule)
|
|
|
|
|
if (self.validated_virt_image_id and
|
|
|
|
|
amodule.params['virt_name'] != image_facts['name']):
|
|
|
|
|
self.decort_virt_image_rename(amodule)
|
|
|
|
|
self.result['msg'] = 'Virtual image renamed successfully'
|
|
|
|
|
elif amodule.params['image_id'] != 0 and amodule.params['image_name']:
|
|
|
|
|
self.validated_image_id, image_facts = self.decort_image_find(amodule)
|
|
|
|
|
if (self.validated_image_id and
|
|
|
|
|
amodule.params['image_name'] != image_facts['name']):
|
|
|
|
@ -390,6 +397,12 @@ class decort_osimage(DecortController):
|
|
|
|
|
image_id, image_facts = decort_osimage.decort_image_find(self, amodule)
|
|
|
|
|
return image_id, image_facts
|
|
|
|
|
|
|
|
|
|
def decort_virt_image_rename(self, amodule):
|
|
|
|
|
image_facts = self.image_rename(imageId=self.validated_virt_image_id,
|
|
|
|
|
name=amodule.params['virt_name'])
|
|
|
|
|
self.result['msg'] = ("Virtual image renamed successfully")
|
|
|
|
|
image_id, image_facts = self.decort_virt_image_find(amodule)
|
|
|
|
|
return image_id, image_facts
|
|
|
|
|
|
|
|
|
|
def decort_osimage_package_facts(arg_osimage_facts, arg_check_mode=False):
|
|
|
|
|
"""Package a dictionary of OS image according to the decort_osimage module specification. This
|
|
|
|
|