]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix expression-not-assigned pylint issues
authorRajesh Tailor <rajesh.tailor@nttdata.com>
Wed, 27 May 2015 09:43:02 +0000 (02:43 -0700)
committerRajesh Tailor <rajesh.tailor@nttdata.com>
Thu, 28 May 2015 09:52:59 +0000 (02:52 -0700)
Fixed expression-not-assigned (warning code W0106: Expression "%s" is
assigned to nothing) pylint issues in cinder project.

Closes-Bug: 1459538
Change-Id: Ibb16bde9ff0e3ebc3f1b595ea402d27938b5cf32

cinder/cmd/volume_usage_audit.py
cinder/tests/unit/api/contrib/test_cgsnapshots.py
cinder/tests/unit/image/test_glance.py
cinder/tests/unit/test_volume.py
cinder/volume/drivers/netapp/dataontap/block_base.py
cinder/volume/drivers/netapp/eseries/client.py
cinder/volume/drivers/rbd.py

index cfee528897d5ee4232456a83b07a8fef8a679632..7caebfd3e0a6decd44ee17b0b70b33b9a182ea74 100644 (file)
@@ -106,7 +106,7 @@ def main():
     volumes = db.volume_get_active_by_window(admin_context,
                                              begin,
                                              end)
-    LOG.debug("Found %d volumes"), len(volumes)
+    LOG.debug("Found %d volumes", len(volumes))
     for volume_ref in volumes:
         try:
             LOG.debug("Send exists notification for <volume_id: "
@@ -178,7 +178,7 @@ def main():
     snapshots = db.snapshot_get_active_by_window(admin_context,
                                                  begin,
                                                  end)
-    LOG.debug("Found %d snapshots"), len(snapshots)
+    LOG.debug("Found %d snapshots", len(snapshots))
     for snapshot_ref in snapshots:
         try:
             LOG.debug("Send notification for <snapshot_id: %(snapshot_id)s> "
index b1d97083382ba8d4f6597da82e915805748ba1dc..6a3113e835794cd6400bf2161d8af025856d9357 100644 (file)
@@ -351,7 +351,7 @@ class CgsnapshotsAPITestCase(test.TestCase):
         consistencygroup_id = utils.create_consistencygroup(self.context)['id']
         utils.create_volume(
             self.context,
-            consistencygroup_id=consistencygroup_id)['id']
+            consistencygroup_id=consistencygroup_id)
 
         body = {"cgsnapshot": {"name": "cg1",
                                "description":
@@ -394,7 +394,7 @@ class CgsnapshotsAPITestCase(test.TestCase):
         consistencygroup_id = utils.create_consistencygroup(self.context)['id']
         utils.create_volume(
             self.context,
-            consistencygroup_id=consistencygroup_id)['id']
+            consistencygroup_id=consistencygroup_id)
 
         body = {"cgsnapshot": {"name": "cg1",
                                "description":
@@ -419,7 +419,7 @@ class CgsnapshotsAPITestCase(test.TestCase):
         consistencygroup_id = utils.create_consistencygroup(self.context)['id']
         utils.create_volume(
             self.context,
-            consistencygroup_id=consistencygroup_id)['id']
+            consistencygroup_id=consistencygroup_id)
 
         body = {"cgsnapshot": {"name": "cg1",
                                "description":
index f4032c7bf6a0f6ee3bdc64ef149a8ca0e177a4ea..bba9bd650ce62fd58c319a47a073092f3f847e9b 100644 (file)
@@ -215,7 +215,7 @@ class TestGlanceImageService(test.TestCase):
         properties = {'owner_id': 'proj1'}
         fixture['properties'] = properties
 
-        self.service.create(self.context, fixture)['id']
+        self.service.create(self.context, fixture)
 
         proj = self.context.project_id
         self.context.project_id = 'proj1'
index 7c53a1be9fdd61e16ed4bad120f4ea6fc34a6a24..35de9584bd9bade5f9dcc74318d3008a8fcf9b66 100644 (file)
@@ -5730,7 +5730,7 @@ class LVMVolumeDriverTestCase(DriverTestCase):
         backup['parent_id'] = None
         backup['size'] = 5 * 1024 * 1024
         backup['object_count'] = 22
-        db.backup_create(self.context, backup)['id']
+        db.backup_create(self.context, backup)
 
         lvm_driver.check_for_setup_error()
 
index 9e461992ea04d459b4276631c2bc77fa5d44426a..4193fe5b1176e62ba390fbc1137b393fcf8af6dd 100644 (file)
@@ -578,7 +578,7 @@ class NetAppBlockStorageLibrary(object):
             raise exception.ManageExistingInvalidReference(
                 existing_ref=existing_ref, reason=reason)
         lun_info = {}
-        lun_info.setdefault('path', path) if path else None
+        lun_info.setdefault('path', path if path else None)
         if hasattr(self, 'vserver') and uuid:
             lun_info['uuid'] = uuid
         luns = self.zapi_client.get_lun_by_args(**lun_info)
index d7c496c02e8e0b9c2c6f49a38e1afee49f09ecad..87812df5ea19db842b6d072ab073f0f4a338c164 100644 (file)
@@ -260,8 +260,8 @@ class RestClient(WebserviceClient):
         """Creates host on array."""
         path = "/storage-systems/{system-id}/hosts"
         data = {'name': label, 'hostType': host_type}
-        data.setdefault('groupId', group_id) if group_id else None
-        data.setdefault('ports', ports) if ports else None
+        data.setdefault('groupId', group_id if group_id else None)
+        data.setdefault('ports', ports if ports else None)
         return self._invoke('POST', path, data)
 
     def create_host_with_port(self, label, host_type, port_id,
@@ -377,8 +377,8 @@ class RestClient(WebserviceClient):
         """Registers storage system with web service."""
         path = "/storage-systems"
         data = {'controllerAddresses': controller_addresses}
-        data.setdefault('wwn', wwn) if wwn else None
-        data.setdefault('password', password) if password else None
+        data.setdefault('wwn', wwn if wwn else None)
+        data.setdefault('password', password if password else None)
         return self._invoke('POST', path, data, use_system=False)
 
     def update_stored_system_password(self, password):
index b56d6749744d1b91796b20efc51a002128ff9638..8461607f6c2109592a555e2bc742be7d4ccdf318 100644 (file)
@@ -593,9 +593,11 @@ class RBDDriver(driver.RetypeVD, driver.TransferVD, driver.ExtendVD,
         snapshot still depends on the parent.
         """
         try:
-            snap and volume.set_snap(snap)
+            if snap:
+                volume.set_snap(snap)
             pool, parent, parent_snap = tuple(volume.parent_info())
-            snap and volume.set_snap(None)
+            if snap:
+                volume.set_snap(None)
             # Strip the tag off the end of the volume name since it will not be
             # in the snap name.
             if volume_name.endswith('.deleted'):