diff --git a/plugins/modules/one_image.py b/plugins/modules/one_image.py index 4e21dcb5ba9..0820118eca1 100644 --- a/plugins/modules/one_image.py +++ b/plugins/modules/one_image.py @@ -346,9 +346,9 @@ def run(self, one, module, result): if not image and desired_state != 'absent': # Using 'if id:' doesn't work properly when id=0 if id is not None: - module.fail_json(msg=f"There is no image with id={id}") + module.fail_json(msg="There is no image with id=" + str(id)) elif name is not None: - module.fail_json(msg=f"There is no image with name={name}") + module.fail_json(msg="There is no image with name=" + name) if desired_state == 'absent': self.result = self.delete_image(image) @@ -473,7 +473,7 @@ def wait_for_ready(self, image_id, wait_timeout=60): state = image.STATE if state in [IMAGE_STATES.index('ERROR')]: - self.module.fail_json(msg=f"Got an ERROR state: {image.TEMPLATE['ERROR']}") + self.module.fail_json(msg="Got an ERROR state: " + image.TEMPLATE['ERROR']) if state in [IMAGE_STATES.index('READY')]: return True @@ -511,9 +511,9 @@ def enable_image(self, image, enable): if state not in [IMAGE_STATES.index('READY'), IMAGE_STATES.index('DISABLED'), IMAGE_STATES.index('ERROR')]: if enable: - self.module.fail_json(msg=f"Cannot enable {IMAGE_STATES[state]} image!") + self.module.fail_json(msg="Cannot enable " + IMAGE_STATES[state] + " image!") else: - self.module.fail_json(msg=f"Cannot disable {IMAGE_STATES[state]} image!") + self.module.fail_json(msg="Cannot disable " + IMAGE_STATES[state] + " image!") if ((enable and state != IMAGE_STATES.index('READY')) or (not enable and state != IMAGE_STATES.index('DISABLED'))): @@ -535,9 +535,9 @@ def change_persistence(self, image, enable): if state not in [IMAGE_STATES.index('READY'), IMAGE_STATES.index('DISABLED'), IMAGE_STATES.index('ERROR')]: if enable: - self.module.fail_json(msg=f"Cannot enable persistence for {IMAGE_STATES[state]} image!") + self.module.fail_json(msg="Cannot enable persistence for " + IMAGE_STATES[state] + " image!") else: - self.module.fail_json(msg=f"Cannot disable persistence {IMAGE_STATES[state]} image!") + self.module.fail_json(msg="Cannot disable persistence for " + IMAGE_STATES[state] + " image!") if ((enable and state != IMAGE_STATES.index('READY')) or (not enable and state != IMAGE_STATES.index('DISABLED'))): @@ -553,7 +553,7 @@ def change_persistence(self, image, enable): def clone_image(self, image, new_name): if new_name is None: - new_name = f"Copy of {image.NAME}" + new_name = "Copy of " + image.NAME tmp_image = self.get_image_by_name(new_name) if tmp_image: @@ -585,7 +585,7 @@ def rename_image(self, image, new_name): tmp_image = self.get_image_by_name(new_name) if tmp_image: - self.module.fail_json(msg=f"Name '{new_name}' is already taken by IMAGE with id={tmp_image.ID}") + self.module.fail_json(msg="Name '" + new_name + "' is already taken by IMAGE with id=" + str(tmp_image.ID)) if not self.module.check_mode: self.one.image.rename(image.ID, new_name) @@ -599,7 +599,7 @@ def delete_image(self, image): return {'changed': False} if image.RUNNING_VMS > 0: - self.module.fail_json(msg=f"Cannot delete image. There are {image.RUNNING_VMS} VMs using it.") + self.module.fail_json(msg="Cannot delete image. There are " + str(image.RUNNING_VMS) + " VMs using it.") if not self.module.check_mode: self.one.image.delete(image.ID)