summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-05-11 22:03:46 -0400
committerGitHub <noreply@github.com>2020-05-11 20:03:46 -0600
commitd10ce3ecfe89d7ec2a69bdbd109b100090698ded (patch)
treee3541566d18daa6754335bedbdccd960bf40127b
parent73aed0431c20759bd3dd4db774ea6ee349575e16 (diff)
downloadvyos-cloud-init-d10ce3ecfe89d7ec2a69bdbd109b100090698ded.tar.gz
vyos-cloud-init-d10ce3ecfe89d7ec2a69bdbd109b100090698ded.zip
analyze/dump: refactor shared string into variable (#350)
-rw-r--r--cloudinit/analyze/dump.py5
1 files changed, 3 insertions, 2 deletions
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.