diff options
author | Joshua Harlow <harlowja@gmail.com> | 2016-05-16 16:08:19 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@gmail.com> | 2016-05-16 16:08:19 -0700 |
commit | f2665c246a3e6dec55064eced09919d912ae0e52 (patch) | |
tree | 180b78b402c4c3a30dc56c989a7ce7e8081a70a5 /cloudinit/sources | |
parent | 75211bdfd58b3209455c88ab00c96e9e7c7acecc (diff) | |
download | vyos-cloud-init-f2665c246a3e6dec55064eced09919d912ae0e52.tar.gz vyos-cloud-init-f2665c246a3e6dec55064eced09919d912ae0e52.zip |
Fix slow tests
Timeouts and retries were triggering so make it so
that tests do not use the typical timesouts and retries
so that the tests finish faster.
Diffstat (limited to 'cloudinit/sources')
-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() |