Fixing pep8 errors

Change-Id: Id792009e36f4d7fc6489373b1b432855301a09ad
This commit is contained in:
Anand Shanmugam 2019-12-13 06:52:31 +00:00
parent d13bb14f28
commit 9d629e2976
6 changed files with 25 additions and 23 deletions

View File

@ -34,6 +34,7 @@ from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_utils import excutils
import paramiko
from past.builtins import basestring
import six
from cloudpulse.common import exception
@ -314,16 +315,16 @@ def read_cached_file(filename, cache_info, reload_func=None):
return cache_info['data']
def file_open(*args, **kwargs):
"""Open file
see built-in file() documentation for more details
Note: The reason this is kept in a separate module is to easily
be able to provide a stub module that doesn't alter system
state at all (for unit tests)
"""
return file(*args, **kwargs)
# def file_open(*args, **kwargs):
# """Open file
#
# see built-in file() documentation for more details
#
# Note: The reason this is kept in a separate module is to easily
# be able to provide a stub module that doesn't alter system
# state at all (for unit tests)
# """
# return file(*args, **kwargs)
def hash_file(file_like_object):

View File

@ -16,6 +16,7 @@ from cloudpulse import objects
import contextlib
from oslo_log import log as logging
from oslo_utils import excutils
from past.builtins import xrange
import time
LOG = logging.getLogger(__name__)

View File

@ -26,7 +26,7 @@ class os_cfg_reader(object):
try:
fp = open(abs_path)
except IOError as e:
print ("Error while opening the file...%s" % e)
print("Error while opening the file...%s" % e)
return
try:
@ -34,7 +34,7 @@ class os_cfg_reader(object):
# print "self.hostYamlObj: ", self.hostYamlObj,
# dir(self.hostYamlObj)
except yaml.error.YAMLError as perr:
print ("Error while parsing...%s" % perr)
print("Error while parsing...%s" % perr)
return
def setOpenstackNodeIp(self):
@ -62,10 +62,10 @@ class os_cfg_reader(object):
def printHostList(self):
for hostObj in self.openstack_host_list:
print ("IP - %s" % (hostObj.getIp()))
print ("HOST - %s" % (hostObj.getHost()))
print ("USER - %s" % (hostObj.getUser()))
print ("NAGIOS RUNNING - %s" % (str(hostObj.isNagiosRunning())))
print("IP - %s" % (hostObj.getIp()))
print("HOST - %s" % (hostObj.getHost()))
print("USER - %s" % (hostObj.getUser()))
print("NAGIOS RUNNING - %s" % (str(hostObj.isNagiosRunning())))
def generate_ansible_config(self, os_obj_list):
f = open('/var/sec_hc/ansible_hosts', 'w+')

View File

@ -25,12 +25,12 @@ class openstack_node_info_reader(object):
try:
fp = open(os_node_file)
except IOError as e:
print ("Error while opening the file...%s", e)
print("Error while opening the file...%s", e)
return
try:
self.hostYamlObj = yaml.safe_load(fp)
except yaml.error.YAMLError as perr:
print ("Error while parsing...%s", perr)
print("Error while parsing...%s", perr)
return
def get_host_list(self):
@ -54,8 +54,8 @@ class openstack_node_info_reader(object):
def printHostList(self, openstack_host_list):
for hostObj in openstack_host_list:
print ("%s - %s - %s", hostObj.getIp(),
hostObj.getHost(), hostObj.getUser())
print("%s - %s - %s", hostObj.getIp(),
hostObj.getHost(), hostObj.getUser())
def get_galera_details(self):
galera = {}

View File

@ -160,12 +160,12 @@ def create_parsed_yaml(yaml_file):
try:
fp = open(yaml_file)
except IOError as ioerr:
print ("Failed to open file %s [%s]" % (yaml_file, ioerr))
print("Failed to open file %s [%s]" % (yaml_file, ioerr))
raise IOError(ioerr)
try:
parsed = yaml.safe_load(fp)
except yaml.error.YAMLError as perr:
print ("Failed to parse %s [%s]" % (yaml_file, perr))
print("Failed to parse %s [%s]" % (yaml_file, perr))
return None
fp.close()
return parsed

View File

@ -7,7 +7,7 @@ pbr>=1.6
ansible<2.0.0.0
eventlet!=0.18.3,>=0.18.2 # MIT
keystonemiddleware>=4.0.0,!=4.1.0,!=4.5.0 # Apache-2.0
MySQL-python
mysql-connector
PyMySQL>=0.6.2,!=0.7.7 # MIT License
oslo.config>=3.14.0 # Apache-2.0
oslo.concurrency>=3.8.0 # Apache-2.0