Fix linting errors; fix some real bugs (#5111) (#5115)

* Fix linting errors.

* Fix bugs.

* Another linter error ignored.

* More fixes.

* Ignore sanity errors with older versions.

ci_complete

* Forgot to commit more changes.

(cherry picked from commit a54af8909c)
This commit is contained in:
Felix Fontein 2022-08-12 14:37:34 +02:00 committed by GitHub
commit e4eead189b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 115 additions and 94 deletions

View file

@ -91,7 +91,7 @@ class iLORedfishUtils(RedfishUtils):
data = response['data']
ntp_list = data[setkey]
if(len(ntp_list) == 2):
if len(ntp_list) == 2:
ntp_list.pop(0)
ntp_list.append(mgr_attributes['mgr_attr_value'])

View file

@ -78,7 +78,7 @@ def memset_api_call(api_key, api_method, payload=None):
if msg is None:
msg = response.json()
return(has_failed, msg, response)
return has_failed, msg, response
def check_zone_domain(data, domain):
@ -92,7 +92,7 @@ def check_zone_domain(data, domain):
if zone_domain['domain'] == domain:
exists = True
return(exists)
return exists
def check_zone(data, name):
@ -109,7 +109,7 @@ def check_zone(data, name):
if counter == 1:
exists = True
return(exists, counter)
return exists, counter
def get_zone_id(zone_name, current_zones):
@ -135,4 +135,4 @@ def get_zone_id(zone_name, current_zones):
zone_id = None
msg = 'Zone ID could not be returned as duplicate zone names were detected'
return(zone_exists, msg, counter, zone_id)
return zone_exists, msg, counter, zone_id

View file

@ -122,8 +122,7 @@ def rax_find_image(module, rax_module, image, exit=True):
except ValueError:
try:
image = cs.images.find(human_id=image)
except(cs.exceptions.NotFound,
cs.exceptions.NoUniqueMatch):
except (cs.exceptions.NotFound, cs.exceptions.NoUniqueMatch):
try:
image = cs.images.find(name=image)
except (cs.exceptions.NotFound,

View file

@ -2055,7 +2055,7 @@ class RedfishUtils(object):
if property in data:
nic[property] = data[property]
result['entries'] = nic
return(result)
return result
def get_nic_inventory(self, resource_uri):
result = {}

View file

@ -15,6 +15,7 @@ try:
from redis import Redis
from redis import __version__ as redis_version
HAS_REDIS_PACKAGE = True
REDIS_IMP_ERR = None
except ImportError:
REDIS_IMP_ERR = traceback.format_exc()
HAS_REDIS_PACKAGE = False
@ -22,6 +23,7 @@ except ImportError:
try:
import certifi
HAS_CERTIFI_PACKAGE = True
CERTIFI_IMPORT_ERROR = None
except ImportError:
CERTIFI_IMPORT_ERROR = traceback.format_exc()
HAS_CERTIFI_PACKAGE = False