summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceRbxCloud.py
diff options
context:
space:
mode:
authorzdc <zdc@users.noreply.github.com>2020-12-25 18:57:19 +0200
committerGitHub <noreply@github.com>2020-12-25 18:57:19 +0200
commit27c317f83d8e393254b6766b34fdf8d29148ea8f (patch)
treeea824de28fa639ba6ba8b212efaf53b5df2e90d9 /cloudinit/sources/DataSourceRbxCloud.py
parent66dc53b1b3f8786f3bbb25e914c1dc8161af0494 (diff)
parentc6bcb8df28daa234686a563549681082eb3283a1 (diff)
downloadvyos-cloud-init-27c317f83d8e393254b6766b34fdf8d29148ea8f.tar.gz
vyos-cloud-init-27c317f83d8e393254b6766b34fdf8d29148ea8f.zip
Merge pull request #28 from zdc/T2117-equuleus-20.4
T2117: Cloud-init updated to 20.4
Diffstat (limited to 'cloudinit/sources/DataSourceRbxCloud.py')
-rw-r--r--cloudinit/sources/DataSourceRbxCloud.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py
index e064c8d6..0b8994bf 100644
--- a/cloudinit/sources/DataSourceRbxCloud.py
+++ b/cloudinit/sources/DataSourceRbxCloud.py
@@ -71,11 +71,13 @@ def gratuitous_arp(items, distro):
def get_md():
- rbx_data = None
+ """Returns False (not found or error) or a dictionary with metadata."""
devices = set(
util.find_devs_with('LABEL=CLOUDMD') +
util.find_devs_with('LABEL=cloudmd')
)
+ if not devices:
+ return False
for device in devices:
try:
rbx_data = util.mount_cb(
@@ -84,17 +86,17 @@ def get_md():
mtype=['vfat', 'fat', 'msdosfs']
)
if rbx_data:
- break
+ return rbx_data
except OSError as err:
if err.errno != errno.ENOENT:
raise
except util.MountFailedError:
util.logexc(LOG, "Failed to mount %s when looking for user "
"data", device)
- if not rbx_data:
- util.logexc(LOG, "Failed to load metadata and userdata")
- return False
- return rbx_data
+
+ LOG.debug("Did not find RbxCloud data, searched devices: %s",
+ ",".join(devices))
+ return False
def generate_network_config(netadps):
@@ -223,6 +225,8 @@ class DataSourceRbxCloud(sources.DataSource):
is used to perform instance configuration.
"""
rbx_data = get_md()
+ if rbx_data is False:
+ return False
self.userdata_raw = rbx_data['userdata']
self.metadata = rbx_data['metadata']
self.gratuitous_arp = rbx_data['gratuitous_arp']