summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorRui Chen <chenrui.momo@gmail.com>2017-02-06 18:49:40 +0800
committerSteve Martinelli <s.martinelli@gmail.com>2017-02-08 00:47:22 +0000
commite8b6a9f7be7e773396c8fe1021d8798aa0e2a4a9 (patch)
treeaa12792591f3b8472adc02f4157d70dcf9473abd /openstackclient
parent083b115d09b7ccf15bb3c3ab5c799a47efc2d6ac (diff)
downloadpython-openstackclient-e8b6a9f7be7e773396c8fe1021d8798aa0e2a4a9.tar.gz
Fix wrong behavior of parsing plugin service name
When the service name end with keyword "os", like: antiddos, the parsing logic isn't suitable, that cause the service api version specified by users don't work. Change-Id: I5d6217c77d7cd2d2f360d78d8561261398b96685 Closes-Bug: #1658614
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/shell.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index e08eee61..d7fe6ac1 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -76,7 +76,9 @@ class OpenStackShell(shell.OpenStackShell):
# Loop through extensions to get API versions
for mod in clientmanager.PLUGIN_MODULES:
default_version = getattr(mod, 'DEFAULT_API_VERSION', None)
- option = mod.API_VERSION_OPTION.replace('os_', '')
+ # Only replace the first instance of "os", some service names will
+ # have "os" in their name, like: "antiddos"
+ option = mod.API_VERSION_OPTION.replace('os_', '', 1)
version_opt = str(self.cloud.config.get(option, default_version))
if version_opt:
api = mod.API_NAME