openstack-auto-commands: fix issues with python-glanceclient 1.0.0

* explicitly set --os-image-api-version 1

This is necessary because python-glanceclient 1.0.0 will use v2 when v2
is accessible.

* only extract subcommands from lastline of bash-completion output

This is necessary because 'glance bash-completion' outputs a
warning starting with python-glanceclient 1.0.0.

---snip---
WARNING: The client is falling back to v1 because the accessing to v2
failed. This behavior will be removed in future versions
---snap---

Change-Id: I936f5704e3badd4cb12d3d9c0753eb154bf594b2
This commit is contained in:
Christian Berendt 2015-08-31 21:59:57 +02:00
parent 534b4a308e
commit 92dda518f4
1 changed files with 7 additions and 5 deletions

View File

@ -531,7 +531,7 @@ def generate_subcommands(os_command, os_file, subcommands, extra_params,
args.append('bash-completion')
subcommands = subprocess.check_output(
args,
universal_newlines=True).strip().split()
universal_newlines=True).strip().split('\n')[-1].split()
subcommands = sorted([o for o in subcommands if not (o.startswith('-') or
o in blacklist)])
@ -588,13 +588,15 @@ def document_single_project(os_command, output_dir):
out_file.write("""
<section xml:id=\"cinder_cli_v1\">
<title>Block Storage API v1 commands</title>\n""")
if os_command == 'glance':
out_file.write("""
<section xml:id=\"glance_cli_v1\">
<title>Image service API v1 commands</title>\n""")
if os_command == 'openstack':
generate_subcommands(os_command, out_file, subcommands,
["--os-auth-type", "token"], "", "")
elif os_command == 'glance':
out_file.write("""
<section xml:id=\"glance_cli_v1\">
<title>Image service API v1 commands</title>\n""")
generate_subcommands(os_command, out_file, subcommands,
["--os-image-api-version", "1"], "_v1", " (v1)")
else:
generate_subcommands(os_command, out_file, subcommands, None, "", "")