[commands] extract correct version string when client is deprecated

With the deprecation of python-keystoneclient the output of keystone
--version changed to:

DeprecationWarning: The keystone CLI is deprecated in favor of
python-openstackclient. For a Python library, continue using
python-keystoneclient. 'python-keystoneclient.', DeprecationWarning)
1.3.0

Because of that it is necessary to only handle the last line of the
output to extract the version string.

Change-Id: Ibdfaa1de4f1c8880ce1a049fec9bea3004c11fea
This commit is contained in:
Christian Berendt 2015-03-26 13:21:52 +01:00
parent 8c32f5043a
commit d1a9fc4f90

View File

@ -65,7 +65,7 @@ def generate_heading(os_command, api_name, title, os_file):
print("Command %s not found, aborting." % os_command)
sys.exit(1)
# Extract version from "swift 0.3"
version = version.strip().rpartition(' ')[2]
version = version.splitlines()[-1].strip().rpartition(' ')[2]
print("Documenting '%s help (version %s)'" % (os_command, version))