~smoser/cloud-init/azure_dhcp

« back to all changes in this revision

Viewing changes to cloudinit/sources/__init__.py

  • Committer: Scott Moser
  • Date: 2016-06-27 20:18:25 UTC
  • Revision ID: smoser@ubuntu.com-20160627201825-8fbth9wzy601viei
fix restoring from a datasource that did not have dsmode

On upgrade and reboot, if datasource restored from obj.pkl did not have
a dsmode attribute, then 'init --local' would fail due to stack trace.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
@six.add_metaclass(abc.ABCMeta)
56
56
class DataSource(object):
57
57
 
 
58
    dsmode = DSMODE_NETWORK
 
59
 
58
60
    def __init__(self, sys_cfg, distro, paths, ud_proc=None):
59
61
        self.sys_cfg = sys_cfg
60
62
        self.distro = distro
64
66
        self.userdata_raw = None
65
67
        self.vendordata = None
66
68
        self.vendordata_raw = None
67
 
        self.dsmode = DSMODE_NETWORK
68
69
 
69
70
        # find the datasource config name.
70
71
        # remove 'DataSource' from classname on front, and remove 'Net' on end.