diff options
| author | zsdc <taras@vyos.io> | 2020-12-25 17:52:03 +0200 |
|---|---|---|
| committer | zsdc <taras@vyos.io> | 2020-12-25 17:52:03 +0200 |
| commit | 526c2760b85ff625a10f4a1c9ba83759d8de1441 (patch) | |
| tree | c7a87d78a7944dd6a9d02544d1605f3a7d77e313 /cloudinit/sources/DataSourceRbxCloud.py | |
| parent | 66dc53b1b3f8786f3bbb25e914c1dc8161af0494 (diff) | |
| parent | 47f4229ebcef9f83df8b549bb869a2dbf6dff17c (diff) | |
| download | vyos-cloud-init-526c2760b85ff625a10f4a1c9ba83759d8de1441.tar.gz vyos-cloud-init-526c2760b85ff625a10f4a1c9ba83759d8de1441.zip | |
T2117: Cloud-init updated to 20.4
Merged with 20.4 tag from the upstream Cloud-init repository
Diffstat (limited to 'cloudinit/sources/DataSourceRbxCloud.py')
| -rw-r--r-- | cloudinit/sources/DataSourceRbxCloud.py | 16 |
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'] |
