Bugfix: pylint fix for yardstick/orchestrator/heat.py (no-value-for-parameter) 57/60757/1
authorrexlee8776 <limingjiang@huawei.com>
Thu, 9 Aug 2018 02:59:02 +0000 (02:59 +0000)
committerrexlee8776 <limingjiang@huawei.com>
Thu, 9 Aug 2018 02:59:02 +0000 (02:59 +0000)
Problem
op_utils.get_volume_id takes 2 arguments and only pass 1. This would
cause tc006 fail!
volume_id = op_utils.get_volume_id(volume_name)
it will cause:
Running pylint...
You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~0, this
change only)...
Using config file /home/opnfv/repos/yardstick/.pylintrc
************* Module yardstick.orchestrator.heat
E:235,20: No value for argument 'volume_name' in function call
(no-value-for-parameter)

To Do
It doesn't need to call get_volume_id here, just use heat get_resource
would be enough. This fix should work with tc006 test case.

JIRA: YARDSTICK-1371

Change-Id: I913ffd085f742ae4464dbcc4269719e2c50e37b5
Signed-off-by: rexlee8776 <limingjiang@huawei.com>
yardstick/orchestrator/heat.py

index e0c0db2..99a5760 100644 (file)
@@ -227,14 +227,10 @@ name (i.e. %s).
 
     def add_volume_attachment(self, server_name, volume_name, mountpoint=None):
         """add to the template an association of volume to instance"""
-        log.debug("adding Cinder::VolumeAttachment server '%s' volume '%s' ", server_name,
-                  volume_name)
-
+        log.debug("adding Cinder::VolumeAttachment server '%s' volume '%s' ",
+                  server_name, volume_name)
         name = "%s-%s" % (server_name, volume_name)
-
-        volume_id = op_utils.get_volume_id(volume_name)
-        if not volume_id:
-            volume_id = {'get_resource': volume_name}
+        volume_id = {'get_resource': volume_name}
         self.resources[name] = {
             'type': 'OS::Cinder::VolumeAttachment',
             'properties': {'instance_uuid': {'get_resource': server_name},