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