summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceBigstep.py
diff options
context:
space:
mode:
authorAlex Sirbu <alexandru.sirbu@bigstep.com>2016-03-07 09:33:40 +0000
committerAlex Sirbu <alexandru.sirbu@bigstep.com>2016-03-07 09:33:40 +0000
commit9ec6c876b72ccfa2ae590505fe6dbf7c0c561520 (patch)
tree9819715101fcd649c9e146c61f82da4fab26b117 /cloudinit/sources/DataSourceBigstep.py
parent0a4c7983613a134fa62b8ee0c11b558f9e405346 (diff)
downloadvyos-cloud-init-9ec6c876b72ccfa2ae590505fe6dbf7c0c561520.tar.gz
vyos-cloud-init-9ec6c876b72ccfa2ae590505fe6dbf7c0c561520.zip
Returning false if file does not exist, instead of throwing error
Diffstat (limited to 'cloudinit/sources/DataSourceBigstep.py')
-rw-r--r--cloudinit/sources/DataSourceBigstep.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceBigstep.py b/cloudinit/sources/DataSourceBigstep.py
index c22ffdb6..2d66c609 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
@@ -22,7 +23,13 @@ class DataSourceBigstep(sources.DataSource):
self.userdata_raw = ""
def get_data(self, apply_filter=False):
- url = get_url_from_file()
+ try:
+ url = get_url_from_file()
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ return False
+ else:
+ raise
response = url_helper.readurl(url)
decoded = json.loads(response.contents)
self.metadata = decoded["metadata"]