It is considered bad practice to use a bare except as this kind
of except statement can have untended consequences such as disabling
ctrl+c interrupts. At the vary least we should use Exception however
a more specific one would be better. This PR uses the general Exception
to resolve the linter which we can add more specific ones later when
we can appropriately unit test the code.
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: I9afcff49f34326d279a63ce972d12f9aa72f18e2
log.info(access_str)
try:
result = self.get(access_str)[1]
- except:
+ except Exception:
log.info("Not found {}".format(access_str))
exit(1)
log.info("found {} {}".format(access_str, mylist))
try:
owner = result["local"]["refs/*"]["permissions"]["owner"]["rules"]
- except:
+ except Exception:
print("ERROR: Check project config, no owner set!")
for x in owner:
user_info = ldap_query(l, ldap_user_base, user, ["uid", "cn", "mail"])
try:
print("%s,%s" % (group_name, user_to_csv(user_info)))
- except:
+ except Exception:
eprint("Error parsing user: %s" % user)
continue
ldap_disconnect(l)
try:
dom1 = parseString(xml_data)
childnode = dom1.getElementsByTagName(tag_name)[0]
- except:
+ except Exception:
_log_error_and_exit("Received bad XML, can not find tag {}".format(tag_name), xml_data)
return childnode.firstChild.data