diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-02-24 20:05:45 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-02-24 20:05:45 -0500 |
commit | 38ed9efa80d328d30f0a0296471a9dd734b27d23 (patch) | |
tree | e1572a92a0e6cb620d5276712d75cdf454219a37 | |
parent | 82c659d5473d4f06705c233bc43f5d5a8ba262f7 (diff) | |
parent | 2185ec2920e3c08690d87c19f0980cca18267af6 (diff) | |
download | vyos-cloud-init-38ed9efa80d328d30f0a0296471a9dd734b27d23.tar.gz vyos-cloud-init-38ed9efa80d328d30f0a0296471a9dd734b27d23.zip |
DataSourceOpenStack: debug, not warn on non-ideal version. do not use latest.
do not search 'latest', as that would be assuming the versioned
api would never break.
Also, instead of warning when we use something else, just debug.
-rw-r--r-- | cloudinit/sources/DataSourceOpenStack.py | 12 | ||||
-rw-r--r-- | cloudinit/sources/helpers/openstack.py | 21 |
2 files changed, 18 insertions, 15 deletions
diff --git a/cloudinit/sources/DataSourceOpenStack.py b/cloudinit/sources/DataSourceOpenStack.py index 72ec8075..0970d07b 100644 --- a/cloudinit/sources/DataSourceOpenStack.py +++ b/cloudinit/sources/DataSourceOpenStack.py @@ -88,11 +88,11 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource): md_urls = [] url2base = {} for url in urls: - md_url = url_helper.combine_url(url, 'openstack', - openstack.OS_LATEST, - 'meta_data.json') - md_urls.append(md_url) - url2base[md_url] = url + for version in openstack.OS_VERSIONS + (openstack.OS_LATEST,): + md_url = url_helper.combine_url(url, 'openstack', + version, 'meta_data.json') + md_urls.append(md_url) + url2base[md_url] = url (max_wait, timeout) = self._get_url_settings() start_time = time.time() @@ -120,7 +120,7 @@ class DataSourceOpenStack(openstack.SourceMixin, sources.DataSource): read_metadata_service, args=[self.metadata_address], kwargs={'ssl_details': self.ssl_details, - 'version': openstack.OS_LATEST}) + 'version': openstack.OS_HAVANA}) except openstack.NonReadable: return False except (openstack.BrokenMetadata, IOError): diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py index a17148d3..0fac0335 100644 --- a/cloudinit/sources/helpers/openstack.py +++ b/cloudinit/sources/helpers/openstack.py @@ -44,12 +44,15 @@ KEY_COPIES = ( ('local-hostname', 'hostname', False), ('instance-id', 'uuid', True), ) +OS_LATEST = 'latest' +OS_FOLSOM = '2012-08-10' +OS_GRIZZLY = '2013-04-04' +OS_HAVANA = '2013-10-17' OS_VERSIONS = ( - '2012-08-10', # folsom - '2013-04-04', # grizzly - '2013-10-17', # havana + OS_FOLSOM, + OS_GRIZZLY, + OS_HAVANA, ) -OS_LATEST = 'latest' class NonReadable(IOError): @@ -176,12 +179,12 @@ class BaseReader(object): potential_version) if self._path_exists(path): if potential_version != version: - LOG.warn("Version '%s' not available, attempting to use" - " version '%s' instead", version, - potential_version) + LOG.debug("Version '%s' not available, attempting to use" + " version '%s' instead", version, + potential_version) return potential_version - LOG.warn("Version '%s' not available, attempting to use '%s'" - " instead", version, OS_LATEST) + LOG.debug("Version '%s' not available, attempting to use '%s'" + " instead", version, OS_LATEST) return OS_LATEST def read_v2(self, version=None): |