summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-05-24 19:08:14 -0400
committerScott Moser <smoser@ubuntu.com>2016-05-24 19:08:14 -0400
commitfdede2004249a8c0ac302531a5b3bc048458be3d (patch)
treef1db0a4e73814bf7b7903c932d873203e957f1b3 /cloudinit
parentea4bc2c603a9d964a918e01d00e39a851e979830 (diff)
parent70ee3c4e6806996401d747e4f8b25855e85d86eb (diff)
downloadvyos-cloud-init-fdede2004249a8c0ac302531a5b3bc048458be3d.tar.gz
vyos-cloud-init-fdede2004249a8c0ac302531a5b3bc048458be3d.zip
fix up tests that take too long due to retries and timeouts
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/sources/DataSourceOpenStack.py12
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()