From 7a113e3b9036046e24c43ccf35f48c8ff24f6ceb Mon Sep 17 00:00:00 2001 From: Till Maas Date: Mon, 21 Oct 2019 17:44:31 +0200 Subject: [PATCH 1/4] resolve_blockdev: Fix format string and logic Found with lgtm.com: https://lgtm.com/projects/g/linux-system-roles/storage/snapshot/2e3192d69a577d27d07709bd93bd10d62dbce630/files/library/resolve_blockdev.py?sort=name&dir=ASC&mode=heatmap#x1c5f11ca99e7cde:1 --- library/resolve_blockdev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/resolve_blockdev.py b/library/resolve_blockdev.py index 904f726e..007bb28e 100644 --- a/library/resolve_blockdev.py +++ b/library/resolve_blockdev.py @@ -82,7 +82,7 @@ def _get_dm_name_from_kernel_dev(kdev): def _get_md_name_from_kernel_dev(kdev): minor = os.minor(os.stat(kdev).st_rdev) return next(name for name in os.listdir(DEV_MD) - if os.minor(os.stat("%/%s" % (DEV_MD, name).st_rdev) == minor)) + if os.minor(os.stat("%s/%s" % (DEV_MD, name)).st_rdev) == minor) def canonical_device(device): From b9036c95707360ecd338815e7fb497000140bb7a Mon Sep 17 00:00:00 2001 From: Till Maas Date: Mon, 21 Oct 2019 17:47:16 +0200 Subject: [PATCH 2/4] lvm_gensym: Remove duplicate RETURN constant Found with lgtm.com: https://lgtm.com/projects/g/linux-system-roles/storage/snapshot/2e3192d69a577d27d07709bd93bd10d62dbce630/files/library/lvm_gensym.py?sort=name&dir=ASC&mode=heatmap#xa756533c9238ada4:1 --- library/lvm_gensym.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/library/lvm_gensym.py b/library/lvm_gensym.py index fc08c732..49d1822b 100644 --- a/library/lvm_gensym.py +++ b/library/lvm_gensym.py @@ -43,16 +43,10 @@ RETURN = ''' vg_name: description: The default generated name for an unspecified volume group - type: str -''' - -RETURN = ''' -vg_name: - description: The default generated name for an unspecified volume group - type: str + type: str lv_name: - description: The default generated name for an unspecified logical volume + description: The default generated name for an unspecified logical volume type: str ''' From fd080085224d00c4c69540ede703af24af83c7a3 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Thu, 31 Oct 2019 11:35:19 +0100 Subject: [PATCH 3/4] Specify Python 2 for LGTM LGTM defaults to Python 3 for the storage role because it was created recently. Since it needs to support Python 2 as well, configure it explicitly. --- .lgtm.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .lgtm.yml diff --git a/.lgtm.yml b/.lgtm.yml new file mode 100644 index 00000000..da28dfc1 --- /dev/null +++ b/.lgtm.yml @@ -0,0 +1,5 @@ +--- +extraction: + python: + python_setup: + version: 2 From d15d14fab011daeb87270a92fd88ea980121efbf Mon Sep 17 00:00:00 2001 From: Till Maas Date: Thu, 31 Oct 2019 12:41:28 +0100 Subject: [PATCH 4/4] blivet: Inherit from object if appropriate The @property decorator requires a new-style class in Python 2, see https://lgtm.com/rules/10030086/ --- library/blivet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/blivet.py b/library/blivet.py index 5a408801..ff069163 100644 --- a/library/blivet.py +++ b/library/blivet.py @@ -122,7 +122,7 @@ class BlivetAnsibleError(Exception): pass -class BlivetVolume: +class BlivetVolume(object): def __init__(self, blivet_obj, volume, bpool=None): self._blivet = blivet_obj self._volume = volume @@ -346,7 +346,7 @@ def _get_blivet_volume(blivet_obj, volume, bpool=None): return _BLIVET_VOLUME_TYPES[volume_type](blivet_obj, volume, bpool=bpool) -class BlivetPool: +class BlivetPool(object): def __init__(self, blivet_obj, pool): self._blivet = blivet_obj self._pool = pool