Some PEP8 cleanup

This commit is contained in:
Uggla 2016-02-12 09:11:05 +01:00
parent 89ae5f7d76
commit e699acf328

View File

@ -23,7 +23,7 @@ class Base(object):
self.api_url = tortilla.wrap(url, debug=config.TORTILLADEBUG)
try:
if connection_parameters.auth_token == None:
if connection_parameters.auth_token is None:
self.data = self.api_url.get(verify=connection_parameters.verify_cert)
else:
self.data = self.api_url.get(verify=connection_parameters.verify_cert,
@ -138,8 +138,7 @@ class BaseCollection(Base):
def __init__(self, url, connection_parameters):
super(BaseCollection, self).__init__(url, connection_parameters)
self.links=[]
self.links = []
#linksmembers = self.data.Links.Members
#linksmembers = self.data.links.Member
@ -153,7 +152,6 @@ class BaseCollection(Base):
#self.links.append(getattr(link,'href'))
self.links.append(urljoin(self.url, getattr(link, mapping.redfish_mapper.map_links_ref())))
config.logger.debug(self.links)
@ -204,10 +202,10 @@ class Managers(Base):
try:
# New proliant firmware now respects Redfish v1.00, so seems to correct below statement
# TODO : better handle exception and if possible support old firmware ?
self.ethernet_interfaces_collection = EthernetInterfacesCollection(
self.ethernet_interfaces_collection = \
EthernetInterfacesCollection(
self.get_link_url('EthernetInterfaces'),
connection_parameters
)
connection_parameters)
# Works on proliant, need to treat 095 vs 0.96 differences
#self.ethernet_interfaces_collection = EthernetInterfacesCollection(
@ -222,7 +220,6 @@ class Managers(Base):
# This means we don't have EthernetInterfaces
self.ethernet_interfaces_collection = None
def get_firmware_version(self):
'''Get firmware version of the manager
@ -473,7 +470,8 @@ class Boot(Base):
class EthernetInterfacesCollection(BaseCollection):
'''Class to manage redfish EthernetInterfacesColkection data.'''
def __init__(self, url, connection_parameters):
super(EthernetInterfacesCollection, self).__init__(url, connection_parameters)
super(EthernetInterfacesCollection,
self).__init__(url, connection_parameters)
self.ethernet_interfaces_dict = {}
@ -482,7 +480,8 @@ class EthernetInterfacesCollection(BaseCollection):
# Check more than 1 hour for this bug.... grrr....
for link in self.links:
index = re.search(r'EthernetInterfaces/(\w+)', link)
self.ethernet_interfaces_dict[index.group(1)] = EthernetInterfaces(link, connection_parameters)
self.ethernet_interfaces_dict[index.group(1)] = \
EthernetInterfaces(link, connection_parameters)
class EthernetInterfaces(Base):
@ -509,7 +508,6 @@ class EthernetInterfaces(Base):
except AttributeError:
return "Not available"
def get_ipv4(self):
'''Get EthernetInterface ipv4 address