From cfa4f33940576efc36ce91326c85900823c5e274 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Sat, 16 Apr 2022 01:02:52 +1000 Subject: [PATCH] .github/linters: Enable flake8 W293 blank line contains whitespace (#6268) https://www.flake8rules.com/rules/W293.html --- .github/linters/.flake8 | 2 +- .../storpool/MigrateVolumeToStorPool.py | 2 +- .../plugins/storpool/TestStorPoolVolumes.py | 16 +++++++-------- .../plugins/storpool/TestTagsOnStorPool.py | 2 +- test/integration/plugins/storpool/sp_util.py | 20 +++++++++---------- .../integration/smoke/test_vm_snapshot_kvm.py | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/linters/.flake8 b/.github/linters/.flake8 index c9314922bf5..d18ad030cc7 100644 --- a/.github/linters/.flake8 +++ b/.github/linters/.flake8 @@ -16,4 +16,4 @@ # under the License. [flake8] -select = W291 +select = W291,W293 diff --git a/test/integration/plugins/storpool/MigrateVolumeToStorPool.py b/test/integration/plugins/storpool/MigrateVolumeToStorPool.py index e6b9fbbbe2d..1849718f3de 100644 --- a/test/integration/plugins/storpool/MigrateVolumeToStorPool.py +++ b/test/integration/plugins/storpool/MigrateVolumeToStorPool.py @@ -247,7 +247,7 @@ class TestMigrateVolumeToAnotherPool(cloudstackTestCase): cls.storage_pool = StoragePool.update(cls.apiclient, id=cls.storage_pool.id, tags = ["ssd, nfs"]) - + if template == FAILED: assert False, "get_template() failed to return template\ diff --git a/test/integration/plugins/storpool/TestStorPoolVolumes.py b/test/integration/plugins/storpool/TestStorPoolVolumes.py index 4560038d268..f5152887071 100644 --- a/test/integration/plugins/storpool/TestStorPoolVolumes.py +++ b/test/integration/plugins/storpool/TestStorPoolVolumes.py @@ -229,7 +229,7 @@ class TestStoragePool(cloudstackTestCase): cls.apiclient, name="Large" ) - + cls.disk_offerings = disk_offerings[0] cls.disk_offering_20 = disk_offering_20[0] @@ -824,7 +824,7 @@ class TestStoragePool(cloudstackTestCase): flag = True except spapi.ApiError as err: flag = False - + if flag is True: raise Exception("Snapshot was not deleted") except Exception as err: @@ -913,12 +913,12 @@ class TestStoragePool(cloudstackTestCase): flag = True except spapi.ApiError as err: flag = False - + if flag is True: raise Exception("Snapshot was not deleted") except Exception as err: self.debug('Snapshot was deleted %s' % err) - + Template.delete(template, self.apiclient, zoneid = self.zone.id) @@ -1744,7 +1744,7 @@ class TestStoragePool(cloudstackTestCase): ) self.assertIsNotNone(self.volume, "Detach: Is none") - + snapshot = Snapshot.create( self.apiclient, self.volume.id, @@ -2052,10 +2052,10 @@ class TestStoragePool(cloudstackTestCase): if snapshotid: cmd.snapshotid = snapshotid - + if account: cmd.account=account - + if domainid: cmd.domainid=domainid return Volume(apiclient.createVolume(cmd).__dict__) @@ -2150,4 +2150,4 @@ class TestStoragePool(cloudstackTestCase): auth = cfg['SP_AUTH_TOKEN'] return host, int(port), auth - + diff --git a/test/integration/plugins/storpool/TestTagsOnStorPool.py b/test/integration/plugins/storpool/TestTagsOnStorPool.py index f37e4cfd532..554e905d2f3 100644 --- a/test/integration/plugins/storpool/TestTagsOnStorPool.py +++ b/test/integration/plugins/storpool/TestTagsOnStorPool.py @@ -480,7 +480,7 @@ class TestStoragePool(cloudstackTestCase): self.debug('list_snapshot_response -------------------- %s' % list_snapshot_response) self.assertIsNone(list_snapshot_response, "snapshot is already deleted") - + @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true") def test_06_remove_vcpolicy_tag_when_disk_detached(self): diff --git a/test/integration/plugins/storpool/sp_util.py b/test/integration/plugins/storpool/sp_util.py index 10160507231..054ace4a6e3 100644 --- a/test/integration/plugins/storpool/sp_util.py +++ b/test/integration/plugins/storpool/sp_util.py @@ -410,16 +410,16 @@ class StorPoolHelper(): """ Get destination pool which has scope same as migrateto and which is not in avoid set """ - + destinationPool = None - + # Get Storage Pool Id to migrate to for storagePool in pools: if storagePool.scope == migrateto: if storagePool.name not in poolsToavoid: destinationPool = storagePool break - + return destinationPool @classmethod @@ -449,7 +449,7 @@ class StorPoolHelper(): cmd.securitygroupid = id cmd.account = account cmd.domainid = domainid - + apiclient.authorizeSecurityGroupIngress(cmd) cmd.protocol = 'ICMP' @@ -466,7 +466,7 @@ class StorPoolHelper(): """ This method is to migrate a VM using migrate virtual machine API """ - + vm.migrate( apiclient, hostid=destinationHost.id, @@ -493,7 +493,7 @@ class StorPoolHelper(): 4. pools -> list of destination pools """ vol_pool_map = {vol.id: pool.id for vol in volumes} - + cmd = migrateVirtualMachineWithVolume.migrateVirtualMachineWithVolumeCmd() cmd.hostid = destinationHost.id cmd.migrateto = [] @@ -514,7 +514,7 @@ class StorPoolHelper(): assert isinstance(migrated_vm_response, list), "Check list virtual machines response for valid list" assert migrated_vm_response[0].hostid == destinationHost.id, "VM did not migrate to a specified host" - + for vol in volumes: migrated_volume_response = list_volumes( apiclient, @@ -523,9 +523,9 @@ class StorPoolHelper(): listall=True) assert isinstance(migrated_volume_response, list), "Check list virtual machines response for valid list" assert migrated_volume_response[0].storageid == pool.id, "Volume did not migrate to a specified pool" - + assert str(migrated_volume_response[0].state).lower().eq('ready'), "Check migrated volume is in Ready state" - + return migrated_vm_response[0] @classmethod @@ -683,7 +683,7 @@ class StorPoolHelper(): cmd.diskofferingid = disk_offering.id if size: cmd.size = size - + if maxiops: cmd.maxiops = maxiops if miniops: diff --git a/test/integration/smoke/test_vm_snapshot_kvm.py b/test/integration/smoke/test_vm_snapshot_kvm.py index 1186f8e32ce..5c133f6e762 100644 --- a/test/integration/smoke/test_vm_snapshot_kvm.py +++ b/test/integration/smoke/test_vm_snapshot_kvm.py @@ -322,5 +322,5 @@ class TestVmSnapshot(cloudstackTestCase): virtualmachineid=self.virtual_machine.id, listall=False) self.debug('list_snapshot_response -------------------- %s' % list_snapshot_response) - + self.assertIsNone(list_snapshot_response, "snapshot is already deleted")