~smoser/ubuntu/vivid/cloud-init/snappy

« back to all changes in this revision

Viewing changes to cloudinit/sources/DataSourceOpenNebula.py

  • Committer: Scott Moser
  • Date: 2015-02-27 20:55:58 UTC
  • mfrom: (355.2.8 vivid)
  • Revision ID: smoser@ubuntu.com-20150227205558-glrwdgxqkaz6zyxa
* Merge with vivid at 0.7.7~bzr1067-0ubuntu1
* New upstream snapshot.
  * fix broken consumption of gzipped user-data (LP: #1424900)
  * functional user-data on Azure again (LP: #1423972)
  * CloudStack: support fetching password from virtual router (LP: #1422388)
* New upstream snapshot.
  * Fix for ascii decode in DataSourceAzure (LP: #1422993).
* New upstream snapshot.
  * support for gpt partitioning, utilized in Azure [Daniel Watkins]
  * fix bug in exception handling in mount_cb.
* New upstream snapshot.
  * move to python3 (LP: #1247132)
  * systemd: run cloud-init before systemd-user-sessions.service
  * Use the GCE short hostname. (LP: #1383794)
  * Enable user-data encoding support for GCE. (LP: #1404311)
  * Update to use a newer and better OMNIBUS_URL
  * Be more tolerant of 'ssh_authorized_keys' types
  * Fix parse_ssh_config failing in ssh_util.py
  * Increase the robustness/configurability of the chef module.
  * retain trailing newline from template files when using
    jinja2 (LP: #1355343)
  * fix broken output handling (LP: #1387340)
  * digital ocean datasource
  * update url in config drive documentation
  * freebsd: enable correct behavior on Ec2.
  * freebsd: Use the proper virtio FreeBSD network interface name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from cloudinit import sources
35
35
from cloudinit import util
36
36
 
 
37
 
37
38
LOG = logging.getLogger(__name__)
38
39
 
39
40
DEFAULT_IID = "iid-dsopennebula"
280
281
 
281
282
    # allvars expands to all existing variables by using '${!x*}' notation
282
283
    # where x is lower or upper case letters or '_'
283
 
    allvars = ["${!%s*}" % x for x in string.letters + "_"]
 
284
    allvars = ["${!%s*}" % x for x in string.ascii_letters + "_"]
284
285
 
285
286
    keylist_in = keylist
286
287
    if keylist is None:
379
380
                raise BrokenContextDiskDir("configured user '%s' "
380
381
                                           "does not exist", asuser)
381
382
        try:
382
 
            with open(os.path.join(source_dir, 'context.sh'), 'r') as f:
383
 
                content = f.read().strip()
384
 
 
 
383
            path = os.path.join(source_dir, 'context.sh')
 
384
            content = util.load_file(path)
385
385
            context = parse_shell_config(content, asuser=asuser)
386
386
        except util.ProcessExecutionError as e:
387
387
            raise BrokenContextDiskDir("Error processing context.sh: %s" % (e))
426
426
                               context.get('USER_DATA_ENCODING'))
427
427
        if encoding == "base64":
428
428
            try:
429
 
                results['userdata'] = base64.b64decode(results['userdata'])
 
429
                results['userdata'] = util.b64d(results['userdata'])
430
430
            except TypeError:
431
431
                LOG.warn("Failed base64 decoding of userdata")
432
432
 
433
433
    # generate static /etc/network/interfaces
434
434
    # only if there are any required context variables
435
435
    # http://opennebula.org/documentation:rel3.8:cong#network_configuration
436
 
    for k in context.keys():
 
436
    for k in context:
437
437
        if re.match(r'^ETH\d+_IP$', k):
438
438
            (out, _) = util.subp(['/sbin/ip', 'link'])
439
439
            net = OpenNebulaNetwork(out, context)