diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-05-27 09:55:10 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-05-27 09:55:10 -0400 |
commit | 318bd66461cba2f480b2ef6be119d2fcd5c6e9c0 (patch) | |
tree | 1817b310efc0190c92c5c95b15df6491119233ce /cloudinit/sources/DataSourceOpenStack.py | |
parent | 949cebd48c9100d4fd00b74232bcf048980e6e0d (diff) | |
parent | 0dbe69aa34948d73d5709a7ddc19389e05e1a268 (diff) | |
download | vyos-cloud-init-318bd66461cba2f480b2ef6be119d2fcd5c6e9c0.tar.gz vyos-cloud-init-318bd66461cba2f480b2ef6be119d2fcd5c6e9c0.zip |
merge from trunk
Diffstat (limited to 'cloudinit/sources/DataSourceOpenStack.py')
-rw-r--r-- | cloudinit/sources/DataSourceOpenStack.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py index 3af17b10..dfd96035 100644 --- a/cloudinit/sources/DataSourceOpenStack.py +++ b/cloudinit/sources/DataSourceOpenStack.py @@ -103,7 +103,7 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource): self.metadata_address = url2base.get(avail_url) return bool(avail_url) - def get_data(self): + def get_data(self, retries=5, timeout=5): try: if not self.wait_for_metadata_service(): return False @@ -115,7 +115,9 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource): 'Crawl of openstack metadata service', read_metadata_service, args=[self.metadata_address], - kwargs={'ssl_details': self.ssl_details}) + kwargs={'ssl_details': self.ssl_details, + 'retries': retries, + 'timeout': timeout}) except openstack.NonReadable: return False except (openstack.BrokenMetadata, IOError): @@ -153,8 +155,10 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource): return sources.instance_id_matches_system_uuid(self.get_instance_id()) -def read_metadata_service(base_url, ssl_details=None): - reader = openstack.MetadataReader(base_url, ssl_details=ssl_details) +def read_metadata_service(base_url, ssl_details=None, + timeout=5, retries=5): + reader = openstack.MetadataReader(base_url, ssl_details=ssl_details, + timeout=timeout, retries=retries) return reader.read_v2() |