ci: fix pylint error

fixed string format pylint error
show in the CI.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 697ba8b515)
This commit is contained in:
Madhu Rajanna 2022-05-30 10:42:23 +05:30 committed by mergify[bot]
parent 9be88e5af5
commit 67793ecff6

View File

@ -185,7 +185,7 @@ def check_pv_name_in_rados(arg, image_id, pvc_name, pool_name, is_rbd):
""" """
validate pvc information in rados validate pvc information in rados
""" """
omapkey = 'csi.volume.%s' % pvc_name omapkey = f'csi.volume.{pvc_name}'
cmd = ['rados', 'getomapval', 'csi.volumes.default', cmd = ['rados', 'getomapval', 'csi.volumes.default',
omapkey, "--pool", pool_name] omapkey, "--pool", pool_name]
if not arg.userkey: if not arg.userkey:
@ -212,8 +212,8 @@ def check_pv_name_in_rados(arg, image_id, pvc_name, pool_name, is_rbd):
name += part[-1] name += part[-1]
if name.decode() != image_id: if name.decode() != image_id:
if arg.debug: if arg.debug:
print("expected image Id %s found Id in rados %s" % decoded_name = name.decode()
(image_id, name.decode())) print(f"expected image Id {image_id} found Id in rados {decoded_name}")
return False return False
return True return True
@ -246,7 +246,7 @@ def check_image_uuid_in_rados(arg, image_id, pvc_name, pool_name, is_rbd):
""" """
validate image uuid in rados validate image uuid in rados
""" """
omapkey = 'csi.volume.%s' % image_id omapkey = f'csi.volume.{image_id}'
cmd = ['rados', 'getomapval', omapkey, "csi.volname", "--pool", pool_name] cmd = ['rados', 'getomapval', omapkey, "csi.volname", "--pool", pool_name]
if not arg.userkey: if not arg.userkey:
cmd += ["--id", arg.userid, "--key", arg.userkey] cmd += ["--id", arg.userid, "--key", arg.userkey]
@ -276,8 +276,8 @@ def check_image_uuid_in_rados(arg, image_id, pvc_name, pool_name, is_rbd):
name += part[-1] name += part[-1]
if name.decode() != pvc_name: if name.decode() != pvc_name:
if arg.debug: if arg.debug:
print("expected image Id %s found Id in rados %s" % decoded_name = name.decode()
(pvc_name, name.decode())) print(f"expected image Id {pvc_name} found Id in rados {decoded_name}")
return False return False
return True return True
@ -565,7 +565,7 @@ def get_fsname_from_pvdata(arg, pvdata):
if __name__ == "__main__": if __name__ == "__main__":
ARGS = PARSER.parse_args() ARGS = PARSER.parse_args()
if ARGS.command not in ["kubectl", "oc"]: if ARGS.command not in ["kubectl", "oc"]:
print("%s command not supported" % ARGS.command) print(f"{ARGS.command} command not supported")
sys.exit(1) sys.exit(1)
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
print("python version less than 3 is not supported.") print("python version less than 3 is not supported.")