summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarm Weites <harm@weites.com>2014-08-08 19:23:56 +0000
committerHarm Weites <harm@weites.com>2014-08-08 19:23:56 +0000
commit019c90f07061adeda54173ea9afd7752cd11cd90 (patch)
tree9fbbd468e027c7300b51ac3f56df0d89ab997af5
parent0ae8b2f5d1fda34f1efa50de8defd127a7907576 (diff)
downloadvyos-cloud-init-019c90f07061adeda54173ea9afd7752cd11cd90.tar.gz
vyos-cloud-init-019c90f07061adeda54173ea9afd7752cd11cd90.zip
fix: Skip lines from /etc/rc.conf not matching the pattern key=value.
-rw-r--r--cloudinit/distros/freebsd.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py
index 1085185b..b4d841f8 100644
--- a/cloudinit/distros/freebsd.py
+++ b/cloudinit/distros/freebsd.py
@@ -72,6 +72,11 @@ class Distro(distros.Distro):
conf = {}
lines = util.load_file(self.rc_conf_fn).splitlines()
for line in lines:
+ if not re.match(r'^(.+)=(.+)', line):
+ LOG.debug("Skipping line from /etc/rc.conf: %s", line)
+ continue
+
+ # TODO: just use the matches please...
tok = line.split('=')
key = tok[0]
val = re.sub(r'^"|"$', '', tok[1].rstrip())