constants: fix pylint warnings for OSError 39/52139/2
authorRoss Brattain <ross.b.brattain@intel.com>
Wed, 14 Feb 2018 05:07:36 +0000 (21:07 -0800)
committerEmma Foley <emma.l.foley@intel.com>
Wed, 14 Feb 2018 10:52:52 +0000 (10:52 +0000)
IOError and OSError are the same in Python 3?
Anyway we want to ignore ENOENT, not EEXIST

JIRA: YARDSTICK-1012
Change-Id: Ia75e41fecce505685745e0099669e45f3e82a1be
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
yardstick/common/constants.py

index 32ed746..646a1f2 100644 (file)
@@ -7,9 +7,9 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 from __future__ import absolute_import
-import os
-import errno
 
+import errno
+import os
 from functools import reduce
 
 import pkg_resources
@@ -40,10 +40,8 @@ def get_param(key, default=''):
         try:
             with open(conf_file) as f:
                 value = yaml_load(f)
-        except IOError:
-            pass
-        except OSError as e:
-            if e.errno != errno.EEXIST:
+        except (IOError, OSError) as e:
+            if e.errno != errno.ENOENT:
                 raise
         else:
             CONF.update(value)