1 From b206b6574a75dfc3793886529064e3d938759be8 Mon Sep 17 00:00:00 2001
2 From: Don Penney <don.penney@windriver.com>
3 Date: Mon, 23 Dec 2019 14:36:08 -0500
4 Subject: [PATCH] Clean up pylint W1201 logging-not-lazy in cgcs-patch
6 Change-Id: Ib461890ddf7635645d42660dc07a153e2449b09e
9 Signed-off-by: Don Penney <don.penney@windriver.com>
12 .../cgcs-patch/cgcs_patch/api/controllers/root.py | 2 +-
13 cgcs-patch/cgcs-patch/cgcs_patch/base.py | 4 +-
14 cgcs-patch/cgcs-patch/cgcs_patch/messages.py | 2 +-
15 cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py | 76 +++++++++----------
16 .../cgcs-patch/cgcs_patch/patch_controller.py | 86 +++++++++++-----------
17 cgcs-patch/cgcs-patch/pylint.rc | 3 +-
18 6 files changed, 86 insertions(+), 87 deletions(-)
20 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py b/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py
21 index 4c7bd7f..883b58d 100644
22 --- a/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py
23 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/api/controllers/root.py
24 @@ -135,7 +135,7 @@ class PatchAPIController(object):
25 def upload_dir(self, **kwargs):
27 for path in kwargs.values():
28 - LOG.info("upload-dir: Retrieving patches from %s" % path)
29 + LOG.info("upload-dir: Retrieving patches from %s", path)
30 for f in glob.glob(path + '/*.patch'):
33 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/base.py b/cgcs-patch/cgcs-patch/cgcs_patch/base.py
34 index 8e47905..e12e26c 100644
35 --- a/cgcs-patch/cgcs-patch/cgcs_patch/base.py
36 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/base.py
37 @@ -160,11 +160,11 @@ class PatchService(object):
38 if result == self.mcast_addr:
40 except subprocess.CalledProcessError as e:
41 - LOG.error("Command output: %s" % e.output)
42 + LOG.error("Command output: %s", e.output)
45 # Close the socket and set it up again
46 - LOG.info("Detected missing multicast addr (%s). Reconfiguring" % self.mcast_addr)
47 + LOG.info("Detected missing multicast addr (%s). Reconfiguring", self.mcast_addr)
48 while self.setup_socket() is None:
49 LOG.info("Unable to setup sockets. Waiting to retry")
51 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/messages.py b/cgcs-patch/cgcs-patch/cgcs_patch/messages.py
52 index 6abc29d..86ff99f 100644
53 --- a/cgcs-patch/cgcs-patch/cgcs_patch/messages.py
54 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/messages.py
55 @@ -61,4 +61,4 @@ class PatchMessage(object):
58 def handle(self, sock, addr): # pylint: disable=unused-argument
59 - LOG.info("Unhandled message type: %s" % self.msgtype)
60 + LOG.info("Unhandled message type: %s", self.msgtype)
61 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py
62 index 547db52..3abd891 100644
63 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py
64 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_agent.py
65 @@ -70,7 +70,7 @@ def setflag(fname):
66 with open(fname, "w") as f:
67 f.write("%d\n" % os.getpid())
69 - LOG.exception("Failed to update %s flag" % fname)
70 + LOG.exception("Failed to update %s flag", fname)
74 @@ -78,7 +78,7 @@ def clearflag(fname):
78 - LOG.exception("Failed to clear %s flag" % fname)
79 + LOG.exception("Failed to clear %s flag", fname)
82 def check_install_uuid():
83 @@ -101,7 +101,7 @@ def check_install_uuid():
84 controller_install_uuid = str(req.text).rstrip()
86 if install_uuid != controller_install_uuid:
87 - LOG.error("Local install_uuid=%s doesn't match controller=%s" % (install_uuid, controller_install_uuid))
88 + LOG.error("Local install_uuid=%s doesn't match controller=%s", install_uuid, controller_install_uuid)
92 @@ -239,7 +239,7 @@ class PatchMessageAgentInstallReq(messages.PatchMessage):
93 messages.PatchMessage.encode(self)
95 def handle(self, sock, addr):
96 - LOG.info("Handling host install request, force=%s" % self.force)
97 + LOG.info("Handling host install request, force=%s", self.force)
99 resp = PatchMessageAgentInstallResp()
101 @@ -354,7 +354,7 @@ class PatchAgent(PatchService):
102 config = yaml.load(output)
103 except subprocess.CalledProcessError as e:
104 LOG.exception("Failed to query channels")
105 - LOG.error("Command output: %s" % e.output)
106 + LOG.error("Command output: %s", e.output)
109 LOG.exception("Failed to query channels")
110 @@ -390,23 +390,23 @@ class PatchAgent(PatchService):
111 config[channel].get('baseurl') != ch_baseurl):
114 - LOG.warning("Invalid smart config found for %s" % channel)
115 + LOG.warning("Invalid smart config found for %s", channel)
117 output = subprocess.check_output(smart_cmd +
119 "--remove", channel],
120 stderr=subprocess.STDOUT)
121 except subprocess.CalledProcessError as e:
122 - LOG.exception("Failed to configure %s channel" % channel)
123 - LOG.error("Command output: %s" % e.output)
124 + LOG.exception("Failed to configure %s channel", channel)
125 + LOG.error("Command output: %s", e.output)
130 - LOG.warning("Channel %s is missing from config" % channel)
131 + LOG.warning("Channel %s is missing from config", channel)
134 - LOG.info("Adding channel %s" % channel)
135 + LOG.info("Adding channel %s", channel)
136 cmd_args = ["channel", "--yes", "--add", channel,
139 @@ -417,8 +417,8 @@ class PatchAgent(PatchService):
140 output = subprocess.check_output(smart_cmd + cmd_args,
141 stderr=subprocess.STDOUT)
142 except subprocess.CalledProcessError as e:
143 - LOG.exception("Failed to configure %s channel" % channel)
144 - LOG.error("Command output: %s" % e.output)
145 + LOG.exception("Failed to configure %s channel", channel)
146 + LOG.error("Command output: %s", e.output)
150 @@ -431,7 +431,7 @@ class PatchAgent(PatchService):
151 config = yaml.load(output)
152 except subprocess.CalledProcessError as e:
153 LOG.exception("Failed to query smart config")
154 - LOG.error("Command output: %s" % e.output)
155 + LOG.error("Command output: %s", e.output)
158 LOG.exception("Failed to query smart config")
159 @@ -441,15 +441,15 @@ class PatchAgent(PatchService):
160 nolinktos = 'rpm-nolinktos'
161 if config.get(nolinktos) is not True:
163 - LOG.warning("Setting %s option" % nolinktos)
164 + LOG.warning("Setting %s option", nolinktos)
166 output = subprocess.check_output(smart_cmd +
168 "%s=true" % nolinktos],
169 stderr=subprocess.STDOUT)
170 except subprocess.CalledProcessError as e:
171 - LOG.exception("Failed to configure %s option" % nolinktos)
172 - LOG.error("Command output: %s" % e.output)
173 + LOG.exception("Failed to configure %s option", nolinktos)
174 + LOG.error("Command output: %s", e.output)
178 @@ -458,15 +458,15 @@ class PatchAgent(PatchService):
179 nosignature = 'rpm-check-signatures'
180 if config.get(nosignature) is not False:
182 - LOG.warning("Setting %s option" % nosignature)
183 + LOG.warning("Setting %s option", nosignature)
185 output = subprocess.check_output(smart_cmd +
187 "%s=false" % nosignature],
188 stderr=subprocess.STDOUT)
189 except subprocess.CalledProcessError as e:
190 - LOG.exception("Failed to configure %s option" % nosignature)
191 - LOG.error("Command output: %s" % e.output)
192 + LOG.exception("Failed to configure %s option", nosignature)
193 + LOG.error("Command output: %s", e.output)
197 @@ -476,7 +476,7 @@ class PatchAgent(PatchService):
198 subprocess.check_output(smart_update, stderr=subprocess.STDOUT)
199 except subprocess.CalledProcessError as e:
200 LOG.exception("Failed to update smartpm")
201 - LOG.error("Command output: %s" % e.output)
202 + LOG.error("Command output: %s", e.output)
205 # Reset the patch op counter to force a detailed query
206 @@ -584,7 +584,7 @@ class PatchAgent(PatchService):
207 self.installed[pkgname] = version.split('@')[0]
209 except subprocess.CalledProcessError:
210 - LOG.error("Failed to query installed version of %s" % pkgname)
211 + LOG.error("Failed to query installed version of %s", pkgname)
215 @@ -641,7 +641,7 @@ class PatchAgent(PatchService):
216 subprocess.check_output(smart_update, stderr=subprocess.STDOUT)
217 except subprocess.CalledProcessError as e:
218 LOG.error("Failed to update smartpm")
219 - LOG.error("Command output: %s" % e.output)
220 + LOG.error("Command output: %s", e.output)
221 # Set a state to "unknown"?
224 @@ -663,7 +663,7 @@ class PatchAgent(PatchService):
225 output = subprocess.check_output(smart_query_installed)
226 pkgs_installed = self.parse_smart_pkglist(output)
227 except subprocess.CalledProcessError as e:
228 - LOG.error("Failed to query installed pkgs: %s" % e.output)
229 + LOG.error("Failed to query installed pkgs: %s", e.output)
230 # Set a state to "unknown"?
233 @@ -671,7 +671,7 @@ class PatchAgent(PatchService):
234 output = subprocess.check_output(smart_query_base)
235 pkgs_base = self.parse_smart_pkglist(output)
236 except subprocess.CalledProcessError as e:
237 - LOG.error("Failed to query base pkgs: %s" % e.output)
238 + LOG.error("Failed to query base pkgs: %s", e.output)
239 # Set a state to "unknown"?
242 @@ -679,7 +679,7 @@ class PatchAgent(PatchService):
243 output = subprocess.check_output(smart_query_updates)
244 pkgs_updates = self.parse_smart_pkglist(output)
245 except subprocess.CalledProcessError as e:
246 - LOG.error("Failed to query patched pkgs: %s" % e.output)
247 + LOG.error("Failed to query patched pkgs: %s", e.output)
248 # Set a state to "unknown"?
251 @@ -722,11 +722,11 @@ class PatchAgent(PatchService):
252 # Look for new packages
255 - LOG.info("Patch state query returns %s" % self.changes)
256 - LOG.info("Installed: %s" % self.installed)
257 - LOG.info("To install: %s" % self.to_install)
258 - LOG.info("To remove: %s" % self.to_remove)
259 - LOG.info("Missing: %s" % self.missing_pkgs)
260 + LOG.info("Patch state query returns %s", self.changes)
261 + LOG.info("Installed: %s", self.installed)
262 + LOG.info("To install: %s", self.to_install)
263 + LOG.info("To remove: %s", self.to_remove)
264 + LOG.info("Missing: %s", self.missing_pkgs)
268 @@ -794,16 +794,16 @@ class PatchAgent(PatchService):
270 if verbose_to_stdout:
271 print("Installing software updates...")
272 - LOG.info("Installing: %s" % ", ".join(install_set))
273 + LOG.info("Installing: %s", ", ".join(install_set))
274 output = subprocess.check_output(smart_install_cmd + install_set, stderr=subprocess.STDOUT)
276 for line in output.split('\n'):
277 - LOG.info("INSTALL: %s" % line)
278 + LOG.info("INSTALL: %s", line)
279 if verbose_to_stdout:
280 print("Software updated.")
281 except subprocess.CalledProcessError as e:
282 LOG.exception("Failed to install RPMs")
283 - LOG.error("Command output: %s" % e.output)
284 + LOG.error("Command output: %s", e.output)
286 if verbose_to_stdout:
287 print("WARNING: Software update failed.")
288 @@ -820,16 +820,16 @@ class PatchAgent(PatchService):
290 if verbose_to_stdout:
291 print("Handling patch removal...")
292 - LOG.info("Removing: %s" % ", ".join(remove_set))
293 + LOG.info("Removing: %s", ", ".join(remove_set))
294 output = subprocess.check_output(smart_remove_cmd + remove_set, stderr=subprocess.STDOUT)
296 for line in output.split('\n'):
297 - LOG.info("REMOVE: %s" % line)
298 + LOG.info("REMOVE: %s", line)
299 if verbose_to_stdout:
300 print("Patch removal complete.")
301 except subprocess.CalledProcessError as e:
302 LOG.exception("Failed to remove RPMs")
303 - LOG.error("Command output: %s" % e.output)
304 + LOG.error("Command output: %s", e.output)
306 if verbose_to_stdout:
307 print("WARNING: Patch removal failed.")
308 @@ -862,7 +862,7 @@ class PatchAgent(PatchService):
309 self.node_is_patched = False
310 except subprocess.CalledProcessError as e:
311 LOG.exception("In-Service patch scripts failed")
312 - LOG.error("Command output: %s" % e.output)
313 + LOG.error("Command output: %s", e.output)
314 # Fail the patching operation
317 @@ -1071,7 +1071,7 @@ def main():
318 # In certain cases, the lighttpd server could still be running using
319 # its default port 80, as opposed to the port configured in platform.conf
320 global http_port_real
321 - LOG.info("Failed install_uuid check via http_port=%s. Trying with default port 80" % http_port_real)
322 + LOG.info("Failed install_uuid check via http_port=%s. Trying with default port 80", http_port_real)
325 pa.handle_install(verbose_to_stdout=True, disallow_insvc_patch=True)
326 diff --git a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py
327 index 79a6401..f2b24c8 100644
328 --- a/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py
329 +++ b/cgcs-patch/cgcs-patch/cgcs_patch/patch_controller.py
330 @@ -137,11 +137,11 @@ class AgentNeighbour(object):
331 if out_of_date != self.out_of_date or requires_reboot != self.requires_reboot:
332 self.out_of_date = out_of_date
333 self.requires_reboot = requires_reboot
334 - LOG.info("Agent %s (%s) reporting out_of_date=%s, requires_reboot=%s" % (
338 - self.requires_reboot))
339 + LOG.info("Agent %s (%s) reporting out_of_date=%s, requires_reboot=%s",
343 + self.requires_reboot)
345 if self.last_query_id != query_id:
346 self.last_query_id = query_id
347 @@ -488,7 +488,7 @@ class PatchMessageAgentInstallReq(messages.PatchMessage):
348 LOG.error("Should not get here")
350 def send(self, sock):
351 - LOG.info("sending install request to node: %s" % self.ip)
352 + LOG.info("sending install request to node: %s", self.ip)
354 message = json.dumps(self.message)
355 sock.sendto(message, (self.ip, cfg.agent_port))
356 @@ -512,7 +512,7 @@ class PatchMessageAgentInstallResp(messages.PatchMessage):
357 messages.PatchMessage.encode(self)
359 def handle(self, sock, addr):
360 - LOG.info("Handling install resp from %s" % addr[0])
361 + LOG.info("Handling install resp from %s", addr[0])
363 # LOG.info("Handling hello ack")
365 @@ -551,7 +551,7 @@ class PatchMessageDropHostReq(messages.PatchMessage):
369 - LOG.error("Received PATCHMSG_DROP_HOST_REQ with no ip: %s" % json.dumps(self.data))
370 + LOG.error("Received PATCHMSG_DROP_HOST_REQ with no ip: %s", json.dumps(self.data))
373 pc.drop_host(self.ip, sync_nbr=False)
374 @@ -602,7 +602,7 @@ class PatchController(PatchService):
375 with open(app_dependency_filename, 'r') as f:
376 self.app_dependencies = json.loads(f.read())
378 - LOG.exception("Failed to read app dependencies: %s" % app_dependency_filename)
379 + LOG.exception("Failed to read app dependencies: %s", app_dependency_filename)
381 self.app_dependencies = {}
383 @@ -658,7 +658,7 @@ class PatchController(PatchService):
384 counter = config.getint('runtime', 'patch_op_counter')
385 self.patch_op_counter = counter
387 - LOG.info("patch_op_counter is: %d" % self.patch_op_counter)
388 + LOG.info("patch_op_counter is: %d", self.patch_op_counter)
389 except configparser.Error:
390 LOG.exception("Failed to read state info")
392 @@ -679,9 +679,9 @@ class PatchController(PatchService):
393 "rsync://%s/patching/" % host_url,
395 stderr=subprocess.STDOUT)
396 - LOG.info("Synced to mate patching via rsync: %s" % output)
397 + LOG.info("Synced to mate patching via rsync: %s", output)
398 except subprocess.CalledProcessError as e:
399 - LOG.error("Failed to rsync: %s" % e.output)
400 + LOG.error("Failed to rsync: %s", e.output)
404 @@ -691,9 +691,9 @@ class PatchController(PatchService):
405 "rsync://%s/repo/" % host_url,
406 "%s/" % repo_root_dir],
407 stderr=subprocess.STDOUT)
408 - LOG.info("Synced to mate repo via rsync: %s" % output)
409 + LOG.info("Synced to mate repo via rsync: %s", output)
410 except subprocess.CalledProcessError:
411 - LOG.error("Failed to rsync: %s" % output)
412 + LOG.error("Failed to rsync: %s", output)
415 self.read_state_file()
416 @@ -710,7 +710,7 @@ class PatchController(PatchService):
417 with open(app_dependency_filename, 'r') as f:
418 self.app_dependencies = json.loads(f.read())
420 - LOG.exception("Failed to read app dependencies: %s" % app_dependency_filename)
421 + LOG.exception("Failed to read app dependencies: %s", app_dependency_filename)
423 self.app_dependencies = {}
425 @@ -757,7 +757,7 @@ class PatchController(PatchService):
428 if patch_id not in self.patch_data.metadata:
429 - LOG.error("Patch data missing for %s" % patch_id)
430 + LOG.error("Patch data missing for %s", patch_id)
433 # If the patch is on a different release than the host, skip it.
434 @@ -811,7 +811,7 @@ class PatchController(PatchService):
437 if patch_id not in self.patch_data.metadata:
438 - LOG.error("Patch data missing for %s" % patch_id)
439 + LOG.error("Patch data missing for %s", patch_id)
442 if personality not in self.patch_data.metadata[patch_id]:
443 @@ -835,7 +835,7 @@ class PatchController(PatchService):
446 if patch_id not in self.patch_data.metadata:
447 - LOG.error("Patch data missing for %s" % patch_id)
448 + LOG.error("Patch data missing for %s", patch_id)
451 if personality not in self.patch_data.metadata[patch_id]:
452 @@ -902,10 +902,10 @@ class PatchController(PatchService):
454 if os.path.exists(semchk):
456 - LOG.info("Running semantic check: %s" % semchk)
457 + LOG.info("Running semantic check: %s", semchk)
458 subprocess.check_output([semchk] + patch_state_args,
459 stderr=subprocess.STDOUT)
460 - LOG.info("Semantic check %s passed" % semchk)
461 + LOG.info("Semantic check %s passed", semchk)
462 except subprocess.CalledProcessError as e:
463 msg = "Semantic check failed for %s:\n%s" % (patch_id, e.output)
465 @@ -1158,7 +1158,7 @@ class PatchController(PatchService):
466 # Copy the RPMs. If a failure occurs, clean up copied files.
468 for rpmfile in rpmlist:
469 - LOG.info("Copy %s to %s" % (rpmfile, rpmlist[rpmfile]))
470 + LOG.info("Copy %s to %s", rpmfile, rpmlist[rpmfile])
472 shutil.copy(rpmfile, rpmlist[rpmfile])
473 copied.append(rpmlist[rpmfile])
474 @@ -1167,7 +1167,7 @@ class PatchController(PatchService):
477 for filename in copied:
478 - LOG.info("Cleaning up %s" % filename)
479 + LOG.info("Cleaning up %s", filename)
483 @@ -1206,7 +1206,7 @@ class PatchController(PatchService):
486 stderr=subprocess.STDOUT)
487 - LOG.info("Repo[%s] updated:\n%s" % (ver, output))
488 + LOG.info("Repo[%s] updated:\n%s", ver, output)
489 except subprocess.CalledProcessError:
490 msg = "Failed to update the repo for %s" % ver
492 @@ -1387,7 +1387,7 @@ class PatchController(PatchService):
495 stderr=subprocess.STDOUT)
496 - LOG.info("Repo[%s] updated:\n%s" % (ver, output))
497 + LOG.info("Repo[%s] updated:\n%s", ver, output)
498 except subprocess.CalledProcessError:
499 msg = "Failed to update the repo for %s" % ver
501 @@ -1529,7 +1529,7 @@ class PatchController(PatchService):
504 stderr=subprocess.STDOUT)
505 - LOG.info("Repo[%s] updated:\n%s" % (release, output))
506 + LOG.info("Repo[%s] updated:\n%s", release, output)
507 except subprocess.CalledProcessError:
508 msg = "Failed to update the repo for %s" % release
510 @@ -1844,7 +1844,7 @@ class PatchController(PatchService):
511 for patch_id in sorted(patch_ids):
512 if patch_id not in self.patch_data.metadata.keys():
513 errormsg = "%s is unrecognized\n" % patch_id
514 - LOG.info("patch_query_dependencies: %s" % errormsg)
515 + LOG.info("patch_query_dependencies: %s", errormsg)
516 results["error"] += errormsg
518 self.patch_data_lock.release()
519 @@ -1892,7 +1892,7 @@ class PatchController(PatchService):
520 errormsg = "A commit cannot be performed with non-REL status patches in the system:\n"
521 for patch_id in non_rel_list:
522 errormsg += " %s\n" % patch_id
523 - LOG.info("patch_commit rejected: %s" % errormsg)
524 + LOG.info("patch_commit rejected: %s", errormsg)
525 results["error"] += errormsg
528 @@ -1901,7 +1901,7 @@ class PatchController(PatchService):
529 for patch_id in sorted(patch_ids):
530 if patch_id not in self.patch_data.metadata.keys():
531 errormsg = "%s is unrecognized\n" % patch_id
532 - LOG.info("patch_commit: %s" % errormsg)
533 + LOG.info("patch_commit: %s", errormsg)
534 results["error"] += errormsg
536 self.patch_data_lock.release()
537 @@ -1925,7 +1925,7 @@ class PatchController(PatchService):
538 errormsg = "The following patches are not applied and cannot be committed:\n"
539 for patch_id in avail_list:
540 errormsg += " %s\n" % patch_id
541 - LOG.info("patch_commit rejected: %s" % errormsg)
542 + LOG.info("patch_commit rejected: %s", errormsg)
543 results["error"] += errormsg
546 @@ -2039,7 +2039,7 @@ class PatchController(PatchService):
549 stderr=subprocess.STDOUT)
550 - LOG.info("Repo[%s] updated:\n%s" % (ver, output))
551 + LOG.info("Repo[%s] updated:\n%s", ver, output)
552 except subprocess.CalledProcessError:
553 msg = "Failed to update the repo for %s" % ver
555 @@ -2100,7 +2100,7 @@ class PatchController(PatchService):
556 self.hosts_lock.release()
557 msg = "Unknown host specified: %s" % host_ip
558 msg_error += msg + "\n"
559 - LOG.error("Error in host-install: " + msg)
560 + LOG.error("Error in host-install: %s", msg)
561 return dict(info=msg_info, warning=msg_warning, error=msg_error)
563 msg = "Running host-install for %s (%s), force=%s, async_req=%s" % (host_ip, ip, force, async_req)
564 @@ -2128,7 +2128,7 @@ class PatchController(PatchService):
565 # async_req install requested, so return now
566 msg = "Patch installation request sent to %s." % self.hosts[ip].hostname
567 msg_info += msg + "\n"
568 - LOG.info("host-install async_req: " + msg)
569 + LOG.info("host-install async_req: %s", msg)
570 return dict(info=msg_info, warning=msg_warning, error=msg_error)
572 # Now we wait, up to ten mins... TODO: Wait on a condition
573 @@ -2141,7 +2141,7 @@ class PatchController(PatchService):
574 self.hosts_lock.release()
575 msg = "Agent expired while waiting: %s" % ip
576 msg_error += msg + "\n"
577 - LOG.error("Error in host-install: " + msg)
578 + LOG.error("Error in host-install: %s", msg)
581 if not self.hosts[ip].install_pending:
582 @@ -2150,17 +2150,17 @@ class PatchController(PatchService):
583 if self.hosts[ip].install_status:
584 msg = "Patch installation was successful on %s." % self.hosts[ip].hostname
585 msg_info += msg + "\n"
586 - LOG.info("host-install: " + msg)
587 + LOG.info("host-install: %s", msg)
588 elif self.hosts[ip].install_reject_reason:
589 msg = "Patch installation rejected by %s. %s" % (
590 self.hosts[ip].hostname,
591 self.hosts[ip].install_reject_reason)
592 msg_error += msg + "\n"
593 - LOG.error("Error in host-install: " + msg)
594 + LOG.error("Error in host-install: %s", msg)
596 msg = "Patch installation failed on %s." % self.hosts[ip].hostname
597 msg_error += msg + "\n"
598 - LOG.error("Error in host-install: " + msg)
599 + LOG.error("Error in host-install: %s", msg)
601 self.hosts_lock.release()
603 @@ -2172,7 +2172,7 @@ class PatchController(PatchService):
605 msg = "Timeout occurred while waiting response from %s." % ip
606 msg_error += msg + "\n"
607 - LOG.error("Error in host-install: " + msg)
608 + LOG.error("Error in host-install: %s", msg)
610 return dict(info=msg_info, warning=msg_warning, error=msg_error)
612 @@ -2203,7 +2203,7 @@ class PatchController(PatchService):
613 self.hosts_lock.release()
614 msg = "Unknown host specified: %s" % host_ip
615 msg_error += msg + "\n"
616 - LOG.error("Error in drop-host: " + msg)
617 + LOG.error("Error in drop-host: %s", msg)
618 return dict(info=msg_info, warning=msg_warning, error=msg_error)
620 msg = "Running drop-host for %s (%s)" % (host_ip, ip)
621 @@ -2272,8 +2272,8 @@ class PatchController(PatchService):
623 appname = kwargs.get("app")
625 - LOG.info("Handling app dependencies report: app=%s, patch_ids=%s" %
626 - (appname, ','.join(patch_ids)))
627 + LOG.info("Handling app dependencies report: app=%s, patch_ids=%s",
628 + appname, ','.join(patch_ids))
630 self.patch_data_lock.acquire()
632 @@ -2516,7 +2516,7 @@ class PatchControllerMainThread(threading.Thread):
633 inputs = [pc.sock_in] + agent_query_conns
636 - # LOG.info("Running select, remaining=%d" % remaining)
637 + # LOG.info("Running select, remaining=%d", remaining)
638 rlist, wlist, xlist = select.select(inputs, outputs, inputs, remaining)
640 if (len(rlist) == 0 and
641 @@ -2641,7 +2641,7 @@ class PatchControllerMainThread(threading.Thread):
643 # Age out controllers after 2 minutes
644 if pc.controller_neighbours[n].get_age() >= 120:
645 - LOG.info("Aging out controller %s from table" % n)
646 + LOG.info("Aging out controller %s from table", n)
647 del pc.controller_neighbours[n]
648 pc.controller_neighbours_lock.release()
650 @@ -2650,7 +2650,7 @@ class PatchControllerMainThread(threading.Thread):
652 # Age out hosts after 1 hour
653 if pc.hosts[n].get_age() >= 3600:
654 - LOG.info("Aging out host %s from table" % n)
655 + LOG.info("Aging out host %s from table", n)
657 for patch_id in pc.interim_state.keys():
658 if n in pc.interim_state[patch_id]:
659 diff --git a/cgcs-patch/cgcs-patch/pylint.rc b/cgcs-patch/cgcs-patch/pylint.rc
660 index a2d888b..57a9829 100644
661 --- a/cgcs-patch/cgcs-patch/pylint.rc
662 +++ b/cgcs-patch/cgcs-patch/pylint.rc
663 @@ -47,9 +47,8 @@ symbols=no
664 # W0107 unnecessary-pass
665 # W0603 global-statement
667 -# W1201 logging-not-lazy
668 # W1505, deprecated-method
669 -disable=C, R, W0107, W0603, W0703, W1201, W1505
670 +disable=C, R, W0107, W0603, W0703, W1505