From d10ce3ecfe89d7ec2a69bdbd109b100090698ded Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Mon, 11 May 2020 22:03:46 -0400 Subject: analyze/dump: refactor shared string into variable (#350) --- cloudinit/analyze/dump.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/analyze/dump.py b/cloudinit/analyze/dump.py index f5762854..939c3126 100644 --- a/cloudinit/analyze/dump.py +++ b/cloudinit/analyze/dump.py @@ -78,7 +78,8 @@ def parse_ci_logline(line): # Apr 30 19:39:11 cloud-init[2673]: handlers.py[DEBUG]: start: \ # init-local/check-cache: attempting to read from cache [check] - separators = [' - ', ' [CLOUDINIT] ', ' cloud-init['] + amazon_linux_2_sep = ' cloud-init[' + separators = [' - ', ' [CLOUDINIT] ', amazon_linux_2_sep] found = False for sep in separators: if sep in line: @@ -101,7 +102,7 @@ def parse_ci_logline(line): hostname = extra.split()[-1] else: hostname = timehost.split()[-1] - if sep == ' cloud-init[': + if sep == amazon_linux_2_sep: # This is an Amazon Linux style line, with no hostname and a PID. # Use the whole of timehost as timestampstr, and strip off the PID # from the start of eventstr. -- cgit v1.2.3