summaryrefslogtreecommitdiff
path: root/ec2-run-user-data.py
diff options
context:
space:
mode:
authorSoren Hansen <soren@canonical.com>2009-08-25 14:46:16 +0200
committerSoren Hansen <soren@canonical.com>2009-08-25 14:46:16 +0200
commit76d5d79c0ec119cf5e87e71578125081c40c291d (patch)
tree91baa01c1772c55c00eb2d4ba5800f79c9a796dc /ec2-run-user-data.py
parentc4f3133dc99b68a41353f763a65dee1b323f8868 (diff)
downloadvyos-cloud-init-76d5d79c0ec119cf5e87e71578125081c40c291d.tar.gz
vyos-cloud-init-76d5d79c0ec119cf5e87e71578125081c40c291d.zip
Added script handling to appliance config handling.
Added test cases for this.
Diffstat (limited to 'ec2-run-user-data.py')
-rwxr-xr-xec2-run-user-data.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/ec2-run-user-data.py b/ec2-run-user-data.py
index 784a1b3f..2917b2fe 100755
--- a/ec2-run-user-data.py
+++ b/ec2-run-user-data.py
@@ -107,6 +107,21 @@ class ApplianceConfig(object):
remove_package(pkg)
else:
install_package(pkg)
+ elif node.tagName == 'script':
+ script = ''
+ for subnode in node.childNodes:
+ # If someone went through the trouble of wrapping it in CDATA,
+ # it's probably the script we want to run..
+ if subnode.nodeType == root.CDATA_SECTION_NODE:
+ script = subnode.nodeValue
+ # ..however, fall back to whatever TEXT_NODE stuff is between
+ # the <script> tags.
+ if subnode.nodeType == root.TEXT_NODE and not script:
+ script = subnode.nodeValue
+ if not script:
+ # An empty script?
+ continue
+ content_type_handlers['text/x-shellscript'](script)
def main():
ec2 = ec2init.EC2Init()