summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-15 23:20:22 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-15 23:20:22 -0400
commitd598ceeb838b4ccaf667ded84bb02bf096ab7b12 (patch)
treedc7e2ba5e64facf8aa941c3d64643dd27dcc095e
parentb2fd5b65dc89c3fd5dbc1414968505367fc7126a (diff)
parent8e5f63cb2f11ce08f7de1df23b8937305b91b707 (diff)
downloadvyos-cloud-init-d598ceeb838b4ccaf667ded84bb02bf096ab7b12.tar.gz
vyos-cloud-init-d598ceeb838b4ccaf667ded84bb02bf096ab7b12.zip
DataSourceNoCloud: fix stack trace on reboot, default to dsmode=net
On reboot (loading module from obj.pkl) we would hit a AttributeError when trying to access cmdline_id. Addtionally, dsmode was inadvertantly defaulting to local for DataSourceNoCloud. LP: #1592505
-rw-r--r--cloudinit/sources/DataSourceNoCloud.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py
index 7e30118c..cdc9eef5 100644
--- a/cloudinit/sources/DataSourceNoCloud.py
+++ b/cloudinit/sources/DataSourceNoCloud.py
@@ -24,7 +24,7 @@ import errno
import os
from cloudinit import log as logging
-from cloudinit import net
+from cloudinit.net import eni
from cloudinit import sources
from cloudinit import util
@@ -34,7 +34,6 @@ LOG = logging.getLogger(__name__)
class DataSourceNoCloud(sources.DataSource):
def __init__(self, sys_cfg, distro, paths):
sources.DataSource.__init__(self, sys_cfg, distro, paths)
- self.dsmode = 'local'
self.seed = None
self.seed_dirs = [os.path.join(paths.seed_dir, 'nocloud'),
os.path.join(paths.seed_dir, 'nocloud-net')]
@@ -194,8 +193,7 @@ class DataSourceNoCloud(sources.DataSource):
# LP: #1568150 need getattr in the case that an old class object
# has been loaded from a pickled file and now executing new source.
dirs = getattr(self, 'seed_dirs', [self.seed_dir])
- quick_id = _quick_read_instance_id(cmdline_id=self.cmdline_id,
- dirs=dirs)
+ quick_id = _quick_read_instance_id(dirs=dirs)
if not quick_id:
return None
return quick_id == current
@@ -203,20 +201,19 @@ class DataSourceNoCloud(sources.DataSource):
@property
def network_config(self):
if self._network_config is None:
- if self.network_eni is not None:
- self._network_config = net.convert_eni_data(self.network_eni)
+ if self._network_eni is not None:
+ self._network_config = eni.convert_eni_data(self._network_eni)
return self._network_config
-def _quick_read_instance_id(cmdline_id, dirs=None):
+def _quick_read_instance_id(dirs=None):
if dirs is None:
dirs = []
iid_key = 'instance-id'
- if cmdline_id is None:
- fill = {}
- if parse_cmdline_data(cmdline_id, fill) and iid_key in fill:
- return fill[iid_key]
+ fill = {}
+ if load_cmdline_data(fill) and iid_key in fill:
+ return fill[iid_key]
for d in dirs:
if d is None: