summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceCloudStack.py
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2015-02-18 18:09:34 +0000
committerDaniel Watkins <daniel.watkins@canonical.com>2015-02-18 18:09:34 +0000
commit5e864eb373ead67d2bc29a19d970f9d3d94c53df (patch)
tree0b809e551d798362fccace5c53f5251f24513d00 /cloudinit/sources/DataSourceCloudStack.py
parente01795dac74cd31bd6054e3185c2dba6203690ca (diff)
downloadvyos-cloud-init-5e864eb373ead67d2bc29a19d970f9d3d94c53df.tar.gz
vyos-cloud-init-5e864eb373ead67d2bc29a19d970f9d3d94c53df.zip
Failing to fetch a CloudStack password should never fail the whole DS.
There might be some CloudStack deployments without the :8080 password server, and there's no reason the rest of the data source can't be used for them.
Diffstat (limited to 'cloudinit/sources/DataSourceCloudStack.py')
-rw-r--r--cloudinit/sources/DataSourceCloudStack.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
index 5eda10a5..a8f8daec 100644
--- a/cloudinit/sources/DataSourceCloudStack.py
+++ b/cloudinit/sources/DataSourceCloudStack.py
@@ -115,15 +115,21 @@ class DataSourceCloudStack(sources.DataSource):
self.metadata_address)
LOG.debug("Crawl of metadata service took %s seconds",
int(time.time() - start_time))
- set_password = self.get_password()
- if set_password:
- self.cfg = {
- 'ssh_pwauth': True,
- 'password': set_password,
- 'chpasswd': {
- 'expire': False,
- },
- }
+ try:
+ set_password = self.get_password()
+ except Exception:
+ util.logexc(LOG,
+ 'Failed to fetch password from virtual router %s',
+ self.vr_addr)
+ else:
+ if set_password:
+ self.cfg = {
+ 'ssh_pwauth': True,
+ 'password': set_password,
+ 'chpasswd': {
+ 'expire': False,
+ },
+ }
return True
except Exception:
util.logexc(LOG, 'Failed fetching from metadata service %s',