Add auth_version config option
Change-Id: Iba84890437a0b7ba0fa00a9bd893fe2ef7f9b797
Closes-Bug: #1683995
diff --git a/common/clients.py b/common/clients.py
index d4ccda3..48db671 100644
--- a/common/clients.py
+++ b/common/clients.py
@@ -71,11 +71,13 @@
self.conf = conf
self.admin_credentials = admin_credentials
- if self.conf.auth_url.find('/v'):
- self.auth_version = self.conf.auth_url.split('/v')[1]
- else:
- raise ValueError(_('Incorrectly specified auth_url config: no '
- 'version found.'))
+ self.auth_version = self.conf.auth_version
+ if not self.auth_version:
+ try:
+ self.auth_version = self.conf.auth_url.split('/v')[1]
+ except IndexError:
+ raise ValueError(_('Please specify version in auth_url or '
+ 'auth_version in config.'))
self.insecure = self.conf.disable_ssl_certificate_validation
self.ca_file = self.conf.ca_file
diff --git a/common/config.py b/common/config.py
index baf8380..d7126c4 100644
--- a/common/config.py
+++ b/common/config.py
@@ -50,7 +50,9 @@
deprecated_opts=[cfg.DeprecatedOpt('admin_tenant_name',
group='heat_plugin')]),
cfg.StrOpt('auth_url',
- help="Full URI of the OpenStack Identity API (Keystone)"),
+ help="Full URI of the OpenStack Identity API (Keystone)."),
+ cfg.StrOpt('auth_version',
+ help="OpenStack Identity API version."),
cfg.StrOpt('user_domain_name',
help="User domain name, if keystone v3 auth_url "
"is used"),