Fix new pylint errors
Fix the following new errors detected by pylint 3.2.0. - possibly-used-before-assignment - used-before-assignment - useless-return Change-Id: Ibfa282e7311a06ed69797cb9969aa66459372d79
This commit is contained in:
parent
5898d54b13
commit
bc259c0bf0
|
@ -64,6 +64,7 @@ class Keepalived:
|
|||
|
||||
file_path = util.keepalived_init_path(init_system)
|
||||
|
||||
init_enable_cmd = None
|
||||
if init_system == consts.INIT_SYSTEMD:
|
||||
template = SYSTEMD_TEMPLATE
|
||||
init_enable_cmd = "systemctl enable octavia-keepalived"
|
||||
|
@ -117,7 +118,7 @@ class Keepalived:
|
|||
util.vrrp_check_script_update(None, consts.AMP_ACTION_START)
|
||||
|
||||
# Make sure the new service is enabled on boot
|
||||
if init_system != consts.INIT_UPSTART:
|
||||
if init_enable_cmd is not None:
|
||||
try:
|
||||
subprocess.check_output(init_enable_cmd.split(),
|
||||
stderr=subprocess.STDOUT)
|
||||
|
|
|
@ -304,12 +304,9 @@ class KeepalivedLvs(lvs_listener_base.LvsListenerApiServerBase):
|
|||
if init_system == consts.INIT_SYSTEMD:
|
||||
util.run_systemctl_command(
|
||||
consts.DISABLE, f"octavia-keepalivedlvs-{listener_id}")
|
||||
|
||||
elif init_system == consts.INIT_SYSVINIT:
|
||||
init_disable_cmd = f"insserv -r {init_path}"
|
||||
elif init_system != consts.INIT_UPSTART:
|
||||
raise util.UnknownInitError()
|
||||
|
||||
if init_system == consts.INIT_SYSVINIT:
|
||||
try:
|
||||
subprocess.check_output(init_disable_cmd.split(),
|
||||
stderr=subprocess.STDOUT)
|
||||
|
@ -323,6 +320,9 @@ class KeepalivedLvs(lvs_listener_base.LvsListenerApiServerBase):
|
|||
"{} service".format(listener_id)),
|
||||
'details': e.output}, status=500)
|
||||
|
||||
elif init_system != consts.INIT_UPSTART:
|
||||
raise util.UnknownInitError()
|
||||
|
||||
# delete init script ,config file and log file for that listener
|
||||
if os.path.exists(init_path):
|
||||
os.remove(init_path)
|
||||
|
|
|
@ -396,12 +396,9 @@ class Loadbalancer:
|
|||
util.run_systemctl_command(
|
||||
consts.DISABLE, "haproxy-{lb_id}".format(
|
||||
lb_id=lb_id))
|
||||
|
||||
elif init_system == consts.INIT_SYSVINIT:
|
||||
init_disable_cmd = f"insserv -r {init_path}"
|
||||
elif init_system != consts.INIT_UPSTART:
|
||||
raise util.UnknownInitError()
|
||||
|
||||
if init_system == consts.INIT_SYSVINIT:
|
||||
try:
|
||||
subprocess.check_output(init_disable_cmd.split(),
|
||||
stderr=subprocess.STDOUT)
|
||||
|
@ -413,6 +410,9 @@ class Loadbalancer:
|
|||
'message': "Error disabling haproxy-{} service".format(
|
||||
lb_id), 'details': e.output}, status=500)
|
||||
|
||||
elif init_system != consts.INIT_UPSTART:
|
||||
raise util.UnknownInitError()
|
||||
|
||||
# delete the directory + init script for that listener
|
||||
shutil.rmtree(util.haproxy_dir(lb_id))
|
||||
if os.path.exists(init_path):
|
||||
|
|
|
@ -193,6 +193,7 @@ def _read_pem_blocks(data):
|
|||
state = stSpam
|
||||
if isinstance(data, bytes):
|
||||
data = data.decode('utf-8')
|
||||
certLines = []
|
||||
for certLine in data.replace('\r', '').split('\n'):
|
||||
if not certLine:
|
||||
continue
|
||||
|
|
|
@ -342,8 +342,6 @@ class NovaServerGroupDelete(BaseComputeTask):
|
|||
def execute(self, server_group_id):
|
||||
if server_group_id is not None:
|
||||
self.compute.delete_server_group(server_group_id)
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
class AttachPort(BaseComputeTask):
|
||||
|
|
Loading…
Reference in New Issue