summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceBigstep.py
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 /cloudinit/sources/DataSourceBigstep.py
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.
Diffstat (limited to 'cloudinit/sources/DataSourceBigstep.py')
-rw-r--r--cloudinit/sources/DataSourceBigstep.py13
1 files changed, 12 insertions, 1 deletions
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