summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2013-07-21 09:34:26 -0700
committerJoshua Harlow <harlowja@gmail.com>2013-07-21 09:34:26 -0700
commit27f096a1ab2e60222f85d87c961e388fdefaf92c (patch)
tree2caf81d15bd749166b760b31212a4bd45c75d4e6 /cloudinit/util.py
parent7022512f3ceb955be2834844f05d4683f78ff276 (diff)
downloadvyos-cloud-init-27f096a1ab2e60222f85d87c961e388fdefaf92c.tar.gz
vyos-cloud-init-27f096a1ab2e60222f85d87c961e388fdefaf92c.zip
Use a util helper to do prefix/suffix removal.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index c45aae06..47d71ef4 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1530,6 +1530,14 @@ def shellify(cmdlist, add_header=True):
return content
+def strip_prefix_suffix(line, prefix=None, suffix=None):
+ if prefix and line.startswith(prefix):
+ line = line[len(prefix):]
+ if suffix and line.endswith(suffix):
+ line = line[:-len(suffix)]
+ return line
+
+
def is_container():
"""
Checks to see if this code running in a container of some sort