summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-03-08 12:06:25 -0500
committerScott Moser <smoser@ubuntu.com>2016-03-08 12:06:25 -0500
commit13fa076e7d9d3f04a93e6edd0db828c7e0238892 (patch)
tree07d309ff8273fb613a37806352646120484b52e4
parent5db46cfb68422b0c14d4a6c097553edd0016de3f (diff)
parentd23868d6d3e35a91c348b94ce8416f56514aaf15 (diff)
downloadvyos-cloud-init-13fa076e7d9d3f04a93e6edd0db828c7e0238892.tar.gz
vyos-cloud-init-13fa076e7d9d3f04a93e6edd0db828c7e0238892.zip
BigStep: enable datasource in default settings
This enables BigStep in the default settings, and also changes the datasource to not raise exception if we are not on BigStep.
-rw-r--r--cloudinit/settings.py1
-rw-r--r--cloudinit/sources/DataSourceBigstep.py13
2 files changed, 13 insertions, 1 deletions
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
index b61e5613..8c258ea1 100644
--- a/cloudinit/settings.py
+++ b/cloudinit/settings.py
@@ -42,6 +42,7 @@ CFG_BUILTIN = {
'CloudSigma',
'CloudStack',
'SmartOS',
+ 'Bigstep',
# At the end to act as a 'catch' when none of the above work...
'None',
],
diff --git a/cloudinit/sources/DataSourceBigstep.py b/cloudinit/sources/DataSourceBigstep.py
index c22ffdb6..b5ee4129 100644
--- a/cloudinit/sources/DataSourceBigstep.py
+++ b/cloudinit/sources/DataSourceBigstep.py
@@ -5,6 +5,7 @@
#
import json
+import errno
from cloudinit import log as logging
from cloudinit import sources
@@ -23,6 +24,8 @@ class DataSourceBigstep(sources.DataSource):
def get_data(self, apply_filter=False):
url = get_url_from_file()
+ if url is None:
+ return False
response = url_helper.readurl(url)
decoded = json.loads(response.contents)
self.metadata = decoded["metadata"]
@@ -32,7 +35,15 @@ class DataSourceBigstep(sources.DataSource):
def get_url_from_file():
- content = util.load_file("/var/lib/cloud/data/seed/bigstep/url")
+ try:
+ content = util.load_file("/var/lib/cloud/data/seed/bigstep/url")
+ except IOError as e:
+ # If the file doesn't exist, then the server probably isn't a Bigstep
+ # instance; otherwise, another problem exists which needs investigation
+ if e.errno == errno.ENOENT:
+ return None
+ else:
+ raise
return content
# Used to match classes to dependencies