← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~kotcauer/cloud-init/cloud-init into lp:cloud-init

 

Peter Kotcauer has proposed merging lp:~kotcauer/cloud-init/cloud-init into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~kotcauer/cloud-init/cloud-init/+merge/211341

The purposes of this commit are:

a) In order to support legacy OpenNebula deployments dig the user-data from the EC2_USER_DATA context variable.
b) Base64 decode support has been added to be able to contextualize user-data submitted through EC2 server.

Peter Kotcauer
Hungarian Academy of Sciences Institute for Computer Science and Control 
Laboratory of Parallel and Distributed Systems
-- 
https://code.launchpad.net/~kotcauer/cloud-init/cloud-init/+merge/211341
Your team cloud init development team is requested to review the proposed merge of lp:~kotcauer/cloud-init/cloud-init into lp:cloud-init.
=== modified file 'cloudinit/sources/DataSourceOpenNebula.py'
--- cloudinit/sources/DataSourceOpenNebula.py	2014-01-17 01:11:27 +0000
+++ cloudinit/sources/DataSourceOpenNebula.py	2014-03-17 15:45:46 +0000
@@ -25,6 +25,7 @@
 import os
 import pwd
 import re
+import base64
 import string  # pylint: disable=W0402
 
 from cloudinit import log as logging
@@ -412,10 +413,13 @@
             break
 
     # raw user data
-    if "USER_DATA" in context:
-        results['userdata'] = context["USER_DATA"]
-    elif "USERDATA" in context:
-        results['userdata'] = context["USERDATA"]
+    userdata = context["USER_DATA"] if "USER_DATA" in context else context["USERDATA"] if "USERDATA" in context else context["EC2_USER_DATA"] if "EC2_USER_DATA" in context else None
+    LOG.debug("userdata is: %s", userdata)
+    try:
+	results['userdata'] = base64.decodestring(userdata)
+    except:
+	results['userdata'] = userdata
+    LOG.debug("final userdata is: %s", results['userdata'])
 
     # generate static /etc/network/interfaces
     # only if there are any required context variables


Follow ups