summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/sources')
-rw-r--r--cloudinit/sources/DataSourceCloudStack.py6
-rw-r--r--cloudinit/sources/DataSourceEc2.py4
-rw-r--r--cloudinit/sources/DataSourceOpenStack.py2
-rw-r--r--cloudinit/sources/__init__.py3
4 files changed, 3 insertions, 12 deletions
diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
index 64595020..455a4652 100644
--- a/cloudinit/sources/DataSourceCloudStack.py
+++ b/cloudinit/sources/DataSourceCloudStack.py
@@ -89,8 +89,6 @@ class DataSourceCloudStack(sources.DataSource):
def _get_url_settings(self):
mcfg = self.ds_cfg
- if not mcfg:
- mcfg = {}
max_wait = 120
try:
max_wait = int(mcfg.get("max_wait", max_wait))
@@ -109,10 +107,6 @@ class DataSourceCloudStack(sources.DataSource):
return (max_wait, timeout)
def wait_for_metadata_service(self):
- mcfg = self.ds_cfg
- if not mcfg:
- mcfg = {}
-
(max_wait, timeout) = self._get_url_settings()
urls = [uhelp.combine_url(self.metadata_address,
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index 3ef2c6af..6fe2a0bb 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -84,8 +84,6 @@ class DataSourceEc2(sources.DataSource):
def _get_url_settings(self):
mcfg = self.ds_cfg
- if not mcfg:
- mcfg = {}
max_wait = 120
try:
max_wait = int(mcfg.get("max_wait", max_wait))
@@ -102,8 +100,6 @@ class DataSourceEc2(sources.DataSource):
def wait_for_metadata_service(self):
mcfg = self.ds_cfg
- if not mcfg:
- mcfg = {}
(max_wait, timeout) = self._get_url_settings()
if max_wait <= 0:
diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py
index f7f4590b..3af17b10 100644
--- a/cloudinit/sources/DataSourceOpenStack.py
+++ b/cloudinit/sources/DataSourceOpenStack.py
@@ -45,8 +45,6 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource):
self.version = None
self.files = {}
self.ec2_metadata = None
- if not self.ds_cfg:
- self.ds_cfg = {}
def __str__(self):
root = sources.DataSource.__str__(self)
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index 82cd3553..6bf2c33b 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -70,6 +70,9 @@ class DataSource(object):
self.ds_cfg = util.get_cfg_by_path(self.sys_cfg,
("datasource", name), {})
+ if not self.ds_cfg:
+ self.ds_cfg = {}
+
if not ud_proc:
self.ud_proc = ud.UserDataProcessor(self.paths)
else: