From 9ec6c876b72ccfa2ae590505fe6dbf7c0c561520 Mon Sep 17 00:00:00 2001 From: Alex Sirbu Date: Mon, 7 Mar 2016 09:33:40 +0000 Subject: Returning false if file does not exist, instead of throwing error --- cloudinit/sources/DataSourceBigstep.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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"] -- cgit v1.2.3