Address python3 pylint errors and warnings
This commit addresses issues detected by the updated python3 pylint: - Added a return code to the report_app_dependencies function to satisfy the E1111 error reported. - Added line-specific pylint disable for unused-argument for cases where the inclusion of such arguments in the function signature was intentional. - Added line-specific pylint disable for the duplicate-except case found, as python3 has merged IOError into OSError, while these are separate exceptions in python2. Once we're running solely on python3, this duplicate exception handling can be dropped. Change-Id: I96a521288e71948f06ad0c88a12c8f475ed8bc99 Closes-Bug: 1855180 Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
parent
93688ac6e5
commit
678e786c5b
|
@ -182,7 +182,7 @@ class PatchAPIController(object):
|
||||||
|
|
||||||
@expose('json')
|
@expose('json')
|
||||||
@expose('query_hosts.xml', content_type='application/xml')
|
@expose('query_hosts.xml', content_type='application/xml')
|
||||||
def query_hosts(self, *args):
|
def query_hosts(self, *args): # pylint: disable=unused-argument
|
||||||
return dict(data=pc.query_host_cache())
|
return dict(data=pc.query_host_cache())
|
||||||
|
|
||||||
@expose('json')
|
@expose('json')
|
||||||
|
@ -197,7 +197,7 @@ class PatchAPIController(object):
|
||||||
|
|
||||||
@expose('json')
|
@expose('json')
|
||||||
@expose('query.xml', content_type='application/xml')
|
@expose('query.xml', content_type='application/xml')
|
||||||
def host_install(self, *args):
|
def host_install(self, *args): # pylint: disable=unused-argument
|
||||||
return dict(error="Deprecated: Use host_install_async")
|
return dict(error="Deprecated: Use host_install_async")
|
||||||
|
|
||||||
@expose('json')
|
@expose('json')
|
||||||
|
|
|
@ -60,5 +60,5 @@ class PatchMessage(object):
|
||||||
return PATCHMSG_STR[self.msgtype]
|
return PATCHMSG_STR[self.msgtype]
|
||||||
return "invalid-type"
|
return "invalid-type"
|
||||||
|
|
||||||
def handle(self, sock, addr):
|
def handle(self, sock, addr): # pylint: disable=unused-argument
|
||||||
LOG.info("Unhandled message type: %s" % self.msgtype)
|
LOG.info("Unhandled message type: %s" % self.msgtype)
|
||||||
|
|
|
@ -151,7 +151,7 @@ class PatchMessageHelloAgent(messages.PatchMessage):
|
||||||
resp = PatchMessageHelloAgentAck()
|
resp = PatchMessageHelloAgentAck()
|
||||||
resp.send(sock)
|
resp.send(sock)
|
||||||
|
|
||||||
def send(self, sock):
|
def send(self, sock): # pylint: disable=unused-argument
|
||||||
LOG.error("Should not get here")
|
LOG.error("Should not get here")
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class PatchMessageQueryDetailed(messages.PatchMessage):
|
||||||
resp = PatchMessageQueryDetailedResp()
|
resp = PatchMessageQueryDetailedResp()
|
||||||
resp.send(sock)
|
resp.send(sock)
|
||||||
|
|
||||||
def send(self, sock):
|
def send(self, sock): # pylint: disable=unused-argument
|
||||||
LOG.error("Should not get here")
|
LOG.error("Should not get here")
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ class PatchMessageAgentInstallReq(messages.PatchMessage):
|
||||||
resp.status = pa.handle_install()
|
resp.status = pa.handle_install()
|
||||||
resp.send(sock, addr)
|
resp.send(sock, addr)
|
||||||
|
|
||||||
def send(self, sock):
|
def send(self, sock): # pylint: disable=unused-argument
|
||||||
LOG.error("Should not get here")
|
LOG.error("Should not get here")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -960,7 +960,7 @@ def wait_for_install_complete(agent_ip):
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
|
|
||||||
def host_install(debug, args):
|
def host_install(debug, args): # pylint: disable=unused-argument
|
||||||
force = False
|
force = False
|
||||||
rc = 0
|
rc = 0
|
||||||
|
|
||||||
|
@ -1072,7 +1072,7 @@ def patch_upload_dir_req(debug, args):
|
||||||
return check_rc(req)
|
return check_rc(req)
|
||||||
|
|
||||||
|
|
||||||
def patch_install_local(debug, args):
|
def patch_install_local(debug, args): # pylint: disable=unused-argument
|
||||||
""" This function is used to trigger patch installation prior to configuration """
|
""" This function is used to trigger patch installation prior to configuration """
|
||||||
# Check to see if initial configuration has completed
|
# Check to see if initial configuration has completed
|
||||||
if os.path.isfile(INITIAL_CONTROLLER_CONFIG_COMPLETE):
|
if os.path.isfile(INITIAL_CONTROLLER_CONFIG_COMPLETE):
|
||||||
|
@ -1214,7 +1214,7 @@ def patch_is_available_req(args):
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
|
|
||||||
def patch_report_app_dependencies_req(debug, args):
|
def patch_report_app_dependencies_req(debug, args): # pylint: disable=unused-argument
|
||||||
if len(args) < 2:
|
if len(args) < 2:
|
||||||
print_help()
|
print_help()
|
||||||
|
|
||||||
|
|
|
@ -392,7 +392,7 @@ class PatchMessageHelloAgentAck(messages.PatchMessage):
|
||||||
self.agent_state)
|
self.agent_state)
|
||||||
pc.hosts_lock.release()
|
pc.hosts_lock.release()
|
||||||
|
|
||||||
def send(self, sock):
|
def send(self, sock): # pylint: disable=unused-argument
|
||||||
LOG.error("Should not get here")
|
LOG.error("Should not get here")
|
||||||
|
|
||||||
|
|
||||||
|
@ -469,7 +469,7 @@ class PatchMessageQueryDetailedResp(messages.PatchMessage):
|
||||||
else:
|
else:
|
||||||
pc.hosts_lock.release()
|
pc.hosts_lock.release()
|
||||||
|
|
||||||
def send(self, sock):
|
def send(self, sock): # pylint: disable=unused-argument
|
||||||
LOG.error("Should not get here")
|
LOG.error("Should not get here")
|
||||||
|
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ class PatchMessageAgentInstallResp(messages.PatchMessage):
|
||||||
pc.hosts[addr[0]].install_reject_reason = self.reject_reason
|
pc.hosts[addr[0]].install_reject_reason = self.reject_reason
|
||||||
pc.hosts_lock.release()
|
pc.hosts_lock.release()
|
||||||
|
|
||||||
def send(self, sock):
|
def send(self, sock): # pylint: disable=unused-argument
|
||||||
LOG.error("Should not get here")
|
LOG.error("Should not get here")
|
||||||
|
|
||||||
|
|
||||||
|
@ -2298,6 +2298,8 @@ class PatchController(PatchService):
|
||||||
finally:
|
finally:
|
||||||
self.patch_data_lock.release()
|
self.patch_data_lock.release()
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def query_app_dependencies(self):
|
def query_app_dependencies(self):
|
||||||
"""
|
"""
|
||||||
Query application dependencies
|
Query application dependencies
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ class PatchFile(object):
|
||||||
msg = "Failed during patch extraction"
|
msg = "Failed during patch extraction"
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
raise PatchFail(msg)
|
raise PatchFail(msg)
|
||||||
except IOError:
|
except IOError: # pylint: disable=duplicate-except
|
||||||
msg = "Failed during patch extraction"
|
msg = "Failed during patch extraction"
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
raise PatchFail(msg)
|
raise PatchFail(msg)
|
||||||
|
|
|
@ -19,6 +19,6 @@ import cgcs_patch.patch_controller # noqa: E402
|
||||||
class CgcsPatchControllerTestCase(testtools.TestCase):
|
class CgcsPatchControllerTestCase(testtools.TestCase):
|
||||||
|
|
||||||
@mock.patch('six.moves.builtins.open')
|
@mock.patch('six.moves.builtins.open')
|
||||||
def test_cgcs_patch_controller_instantiate(self, mock_open):
|
def test_cgcs_patch_controller_instantiate(self, mock_open): # pylint: disable=unused-argument
|
||||||
# pylint: disable=unused-variable
|
# pylint: disable=unused-variable
|
||||||
pc = cgcs_patch.patch_controller.PatchController() # noqa: F841
|
pc = cgcs_patch.patch_controller.PatchController() # noqa: F841
|
||||||
|
|
|
@ -44,16 +44,12 @@ symbols=no
|
||||||
# --enable=similarities". If you want to run only the classes checker, but have
|
# --enable=similarities". If you want to run only the classes checker, but have
|
||||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||||
# --disable=W"
|
# --disable=W"
|
||||||
# E1111 assignment-from-no-return
|
|
||||||
# W0107 unnecessary-pass
|
# W0107 unnecessary-pass
|
||||||
# W0603 global-statement
|
# W0603 global-statement
|
||||||
# W0612 unused-variable
|
|
||||||
# W0613 unused-argument
|
|
||||||
# W0703 broad-except
|
# W0703 broad-except
|
||||||
# W0705 duplicate-except
|
|
||||||
# W1201 logging-not-lazy
|
# W1201 logging-not-lazy
|
||||||
# W1505, deprecated-method
|
# W1505, deprecated-method
|
||||||
disable=C, R, E1111, W0107, W0603, W0612, W0613, W0703, W0705, W1201, W1505
|
disable=C, R, W0107, W0603, W0703, W1201, W1505
|
||||||
|
|
||||||
|
|
||||||
[REPORTS]
|
[REPORTS]
|
||||||
|
|
Loading…
Reference in New Issue