Skip to content

Commit bc259c0

Browse files
committed
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
1 parent 5898d54 commit bc259c0

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

octavia/amphorae/backends/agent/api_server/keepalived.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def upload_keepalived_config(self):
6464

6565
file_path = util.keepalived_init_path(init_system)
6666

67+
init_enable_cmd = None
6768
if init_system == consts.INIT_SYSTEMD:
6869
template = SYSTEMD_TEMPLATE
6970
init_enable_cmd = "systemctl enable octavia-keepalived"
@@ -117,7 +118,7 @@ def upload_keepalived_config(self):
117118
util.vrrp_check_script_update(None, consts.AMP_ACTION_START)
118119

119120
# Make sure the new service is enabled on boot
120-
if init_system != consts.INIT_UPSTART:
121+
if init_enable_cmd is not None:
121122
try:
122123
subprocess.check_output(init_enable_cmd.split(),
123124
stderr=subprocess.STDOUT)

octavia/amphorae/backends/agent/api_server/keepalivedlvs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,9 @@ def delete_lvs_listener(self, listener_id):
304304
if init_system == consts.INIT_SYSTEMD:
305305
util.run_systemctl_command(
306306
consts.DISABLE, f"octavia-keepalivedlvs-{listener_id}")
307+
307308
elif init_system == consts.INIT_SYSVINIT:
308309
init_disable_cmd = f"insserv -r {init_path}"
309-
elif init_system != consts.INIT_UPSTART:
310-
raise util.UnknownInitError()
311-
312-
if init_system == consts.INIT_SYSVINIT:
313310
try:
314311
subprocess.check_output(init_disable_cmd.split(),
315312
stderr=subprocess.STDOUT)
@@ -323,6 +320,9 @@ def delete_lvs_listener(self, listener_id):
323320
"{} service".format(listener_id)),
324321
'details': e.output}, status=500)
325322

323+
elif init_system != consts.INIT_UPSTART:
324+
raise util.UnknownInitError()
325+
326326
# delete init script ,config file and log file for that listener
327327
if os.path.exists(init_path):
328328
os.remove(init_path)

octavia/amphorae/backends/agent/api_server/loadbalancer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,9 @@ def delete_lb(self, lb_id):
396396
util.run_systemctl_command(
397397
consts.DISABLE, "haproxy-{lb_id}".format(
398398
lb_id=lb_id))
399+
399400
elif init_system == consts.INIT_SYSVINIT:
400401
init_disable_cmd = f"insserv -r {init_path}"
401-
elif init_system != consts.INIT_UPSTART:
402-
raise util.UnknownInitError()
403-
404-
if init_system == consts.INIT_SYSVINIT:
405402
try:
406403
subprocess.check_output(init_disable_cmd.split(),
407404
stderr=subprocess.STDOUT)
@@ -413,6 +410,9 @@ def delete_lb(self, lb_id):
413410
'message': "Error disabling haproxy-{} service".format(
414411
lb_id), 'details': e.output}, status=500)
415412

413+
elif init_system != consts.INIT_UPSTART:
414+
raise util.UnknownInitError()
415+
416416
# delete the directory + init script for that listener
417417
shutil.rmtree(util.haproxy_dir(lb_id))
418418
if os.path.exists(init_path):

octavia/common/tls_utils/cert_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ def _read_pem_blocks(data):
193193
state = stSpam
194194
if isinstance(data, bytes):
195195
data = data.decode('utf-8')
196+
certLines = []
196197
for certLine in data.replace('\r', '').split('\n'):
197198
if not certLine:
198199
continue

octavia/controller/worker/v2/tasks/compute_tasks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,6 @@ class NovaServerGroupDelete(BaseComputeTask):
342342
def execute(self, server_group_id):
343343
if server_group_id is not None:
344344
self.compute.delete_server_group(server_group_id)
345-
else:
346-
return
347345

348346

349347
class AttachPort(BaseComputeTask):

0 commit comments

Comments
 (0)