summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cinderclient/shell.py12
-rw-r--r--cinderclient/tests/unit/test_api_versions.py12
-rw-r--r--cinderclient/tests/unit/test_shell.py12
-rw-r--r--cinderclient/tests/unit/v2/test_shell.py8
-rw-r--r--cinderclient/tests/unit/v3/test_shell.py16
-rw-r--r--cinderclient/v2/shell.py6
-rw-r--r--cinderclient/v3/shell.py8
-rw-r--r--doc/source/contributor/functional_tests.rst5
-rw-r--r--doc/source/contributor/unit_tests.rst5
-rw-r--r--doc/source/index.rst28
-rw-r--r--doc/source/user/cinder.rst58
-rw-r--r--doc/source/user/no_auth.rst6
-rw-r--r--playbooks/legacy/cinderclient-dsvm-functional-identity-v3-only/run.yaml2
-rw-r--r--playbooks/legacy/cinderclient-dsvm-functional/run.yaml2
-rw-r--r--requirements.txt1
-rw-r--r--setup.cfg3
-rw-r--r--tox.ini4
17 files changed, 59 insertions, 129 deletions
diff --git a/cinderclient/shell.py b/cinderclient/shell.py
index 841748a..ecc5862 100644
--- a/cinderclient/shell.py
+++ b/cinderclient/shell.py
@@ -39,7 +39,6 @@ import six
import six.moves.urllib.parse as urlparse
import cinderclient
-from cinderclient import _i18n
from cinderclient._i18n import _
from cinderclient import api_versions
from cinderclient import client
@@ -47,10 +46,7 @@ from cinderclient import exceptions as exc
from cinderclient import utils
-# Enable i18n lazy translation
-_i18n.enable_lazy()
-
-
+DEFAULT_MAJOR_OS_VOLUME_API_VERSION = "3"
DEFAULT_CINDER_ENDPOINT_TYPE = 'publicURL'
V1_SHELL = 'cinderclient.v1.shell'
V2_SHELL = 'cinderclient.v2.shell'
@@ -532,8 +528,10 @@ class OpenStackCinderShell(object):
'--help' in argv) or ('-h' in argv) or not argv
if not options.os_volume_api_version:
- api_version = api_versions.get_api_version(
- api_versions.MAX_VERSION)
+ use_version = DEFAULT_MAJOR_OS_VOLUME_API_VERSION
+ if do_help:
+ use_version = api_versions.MAX_VERSION
+ api_version = api_versions.get_api_version(use_version)
else:
api_version = api_versions.get_api_version(
options.os_volume_api_version)
diff --git a/cinderclient/tests/unit/test_api_versions.py b/cinderclient/tests/unit/test_api_versions.py
index 24b09d0..559d814 100644
--- a/cinderclient/tests/unit/test_api_versions.py
+++ b/cinderclient/tests/unit/test_api_versions.py
@@ -236,12 +236,12 @@ class DiscoverVersionTestCase(utils.TestCase):
api_versions.MIN_VERSION = client_min
if exp_range:
- self.assertRaisesRegexp(exceptions.UnsupportedVersion,
- ".*range is '%s' to '%s'.*" %
- (server_min, server_max),
- api_versions.discover_version,
- self.fake_client,
- api_versions.APIVersion(requested_version))
+ self.assertRaisesRegex(exceptions.UnsupportedVersion,
+ ".*range is '%s' to '%s'.*" %
+ (server_min, server_max),
+ api_versions.discover_version,
+ self.fake_client,
+ api_versions.APIVersion(requested_version))
else:
discovered_version = api_versions.discover_version(
self.fake_client,
diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py
index 6156f36..e611ace 100644
--- a/cinderclient/tests/unit/test_shell.py
+++ b/cinderclient/tests/unit/test_shell.py
@@ -114,9 +114,11 @@ class ShellTest(utils.TestCase):
self.assertRaises(exceptions.CommandError, self.shell, 'help foofoo')
def test_help(self):
+ # Some expected help output, including microversioned commands
required = [
'.*?^usage: ',
'.*?(?m)^\s+create\s+Creates a volume.',
+ '.*?(?m)^\s+summary\s+Get volumes summary.',
'.*?(?m)^Run "cinder help SUBCOMMAND" for help on a subcommand.',
]
help_text = self.shell('help')
@@ -134,6 +136,16 @@ class ShellTest(utils.TestCase):
self.assertThat(help_text,
matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
+ def test_help_on_subcommand_mv(self):
+ required = [
+ '.*?^usage: cinder summary',
+ '.*?(?m)^Get volumes summary.',
+ ]
+ help_text = self.shell('help summary')
+ for r in required:
+ self.assertThat(help_text,
+ matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
+
@ddt.data('backup-create --help', '--help backup-create')
def test_dash_dash_help_on_subcommand(self, cmd):
required = ['.*?^Creates a volume backup.']
diff --git a/cinderclient/tests/unit/v2/test_shell.py b/cinderclient/tests/unit/v2/test_shell.py
index 6284122..4e966dd 100644
--- a/cinderclient/tests/unit/v2/test_shell.py
+++ b/cinderclient/tests/unit/v2/test_shell.py
@@ -529,10 +529,10 @@ class ShellTest(utils.TestCase):
def test_rename_invalid_args(self):
"""Ensure that error generated does not reference an HTTP code."""
- self.assertRaisesRegexp(exceptions.ClientException,
- '(?!HTTP)',
- self.run_command,
- 'rename volume-1234-abcd')
+ self.assertRaisesRegex(exceptions.ClientException,
+ '(?!HTTP)',
+ self.run_command,
+ 'rename volume-1234-abcd')
def test_rename_snapshot(self):
# basic rename with positional arguments
diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py
index a5ed614..eaba63f 100644
--- a/cinderclient/tests/unit/v3/test_shell.py
+++ b/cinderclient/tests/unit/v3/test_shell.py
@@ -140,28 +140,28 @@ class ShellTest(utils.TestCase):
{'command':
'group-list --filters name=456',
'expected':
- '/groups/detail?all_tenants=0&name=456'},
+ '/groups/detail?name=456'},
{'command':
'group-list --filters status=available',
'expected':
- '/groups/detail?all_tenants=0&status=available'},
+ '/groups/detail?status=available'},
{'command':
'group-list --filters name~=456',
'expected':
- '/groups/detail?all_tenants=0&name~=456'},
+ '/groups/detail?name~=456'},
# testcases for list group-snapshot
{'command':
'group-snapshot-list --status=error --filters status=available',
'expected':
- '/group_snapshots/detail?all_tenants=0&status=available'},
+ '/group_snapshots/detail?status=available'},
{'command':
'group-snapshot-list --filters availability_zone=123',
'expected':
- '/group_snapshots/detail?all_tenants=0&availability_zone=123'},
+ '/group_snapshots/detail?availability_zone=123'},
{'command':
'group-snapshot-list --filters status~=available',
'expected':
- '/group_snapshots/detail?all_tenants=0&status~=available'},
+ '/group_snapshots/detail?status~=available'},
# testcases for list message
{'command':
'message-list --event_id=123 --filters event_id=456',
@@ -632,7 +632,7 @@ class ShellTest(utils.TestCase):
def test_group_list(self):
self.run_command('--os-volume-api-version 3.13 group-list')
- self.assert_called_anytime('GET', '/groups/detail?all_tenants=0')
+ self.assert_called_anytime('GET', '/groups/detail')
def test_group_list__with_all_tenant(self):
self.run_command(
@@ -692,7 +692,7 @@ class ShellTest(utils.TestCase):
def test_group_snapshot_list(self):
self.run_command('--os-volume-api-version 3.14 group-snapshot-list')
self.assert_called_anytime('GET',
- '/group_snapshots/detail?all_tenants=0')
+ '/group_snapshots/detail')
def test_group_snapshot_show(self):
self.run_command('--os-volume-api-version 3.14 '
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py
index d4975dc..dddf388 100644
--- a/cinderclient/v2/shell.py
+++ b/cinderclient/v2/shell.py
@@ -1656,7 +1656,7 @@ def do_encryption_type_show(cs, args):
metavar='<provider>',
type=str,
help='The encryption provider format. '
- 'For example, "luks" or "plain."')
+ 'For example, "luks" or "plain".')
@utils.arg('--cipher',
metavar='<cipher>',
type=str,
@@ -1683,8 +1683,8 @@ def do_encryption_type_show(cs, args):
required=False,
default='front-end',
help='Notional service where encryption is performed. '
- 'Valid values are "front-end" or "back-end." '
- 'For example, front-end=Nova. Default is "front-end."')
+ 'Valid values are "front-end" or "back-end". '
+ 'For example, front-end=Nova. Default is "front-end".')
@utils.arg('--control_location',
type=str,
required=False,
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index d0f1b95..2cd3ffe 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -1273,7 +1273,7 @@ def do_manageable_list(cs, args):
nargs='?',
type=int,
const=1,
- default=utils.env('ALL_TENANTS', default=0),
+ default=utils.env('ALL_TENANTS', default=None),
help='Shows details for all tenants. Admin only.')
@utils.arg('--filters',
type=six.text_type,
@@ -1548,7 +1548,7 @@ def do_group_list_replication_targets(cs, args):
nargs='?',
type=int,
const=1,
- default=0,
+ default=utils.env('ALL_TENANTS', default=None),
help='Shows details for all tenants. Admin only.')
@utils.arg('--status',
metavar='<status>',
@@ -1572,10 +1572,8 @@ def do_group_list_replication_targets(cs, args):
def do_group_snapshot_list(cs, args):
"""Lists all group snapshots."""
- all_tenants = int(os.environ.get("ALL_TENANTS", args.all_tenants))
-
search_opts = {
- 'all_tenants': all_tenants,
+ 'all_tenants': args.all_tenants,
'status': args.status,
'group_id': args.group_id,
}
diff --git a/doc/source/contributor/functional_tests.rst b/doc/source/contributor/functional_tests.rst
index 6af85ba..9eea42d 100644
--- a/doc/source/contributor/functional_tests.rst
+++ b/doc/source/contributor/functional_tests.rst
@@ -1,7 +1,4 @@
-==================
-CINDERCLIENT Tests
-==================
-
+================
Functional Tests
================
diff --git a/doc/source/contributor/unit_tests.rst b/doc/source/contributor/unit_tests.rst
index dcb6c2c..07247aa 100644
--- a/doc/source/contributor/unit_tests.rst
+++ b/doc/source/contributor/unit_tests.rst
@@ -1,7 +1,4 @@
-==================
-CINDERCLIENT Tests
-==================
-
+==========
Unit Tests
==========
diff --git a/doc/source/index.rst b/doc/source/index.rst
index abe5c0d..edf0695 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -34,41 +34,25 @@ API::
[]
User Guides
-===========
-
-In order to use the CLI, you must provide your OpenStack username, password,
-tenant, and auth endpoint. Use the corresponding configuration options
-(``--os-username``, ``--os-password``, ``--os-tenant-id``, and
-``--os-auth-url``) or set them in environment variables::
-
- export OS_USERNAME=user
- export OS_PASSWORD=pass
- export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b
- export OS_AUTH_URL=http://auth.example.com:5000/v2.0
-
-Once you've configured your authentication parameters, you can run ``cinder
-help`` to see a complete listing of available commands.
-
-See also :doc:`/cli/index` for detailed documentation.
+~~~~~~~~~~~
.. toctree::
:maxdepth: 2
- user/cinder
+ user/shell
+ user/no_auth
Command-Line Reference
-======================
+~~~~~~~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
cli/index
cli/details
- user/shell
- user/no_auth
Developer Guides
-================
+~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
@@ -77,7 +61,7 @@ Developer Guides
contributor/unit_tests
Release Notes
-=============
+~~~~~~~~~~~~~
All python-cinderclient release notes can now be found on the `release notes`_
page.
diff --git a/doc/source/user/cinder.rst b/doc/source/user/cinder.rst
deleted file mode 100644
index ceebbba..0000000
--- a/doc/source/user/cinder.rst
+++ /dev/null
@@ -1,58 +0,0 @@
-==============================
-:program:`cinder` CLI man page
-==============================
-
-.. program:: cinder
-.. highlight:: bash
-
-
-SYNOPSIS
-========
-
-:program:`cinder` [options] <command> [command-options]
-
-:program:`cinder help`
-
-:program:`cinder help` <command>
-
-
-DESCRIPTION
-===========
-
-The :program:`cinder` command line utility interacts with OpenStack Block
-Storage Service (Cinder).
-
-In order to use the CLI, you must provide your OpenStack username, password,
-project (historically called tenant), and auth endpoint. You can use
-configuration options `--os-username`, `--os-password`, `--os-tenant-name` or
-`--os-tenant-id`, and `--os-auth-url` or set corresponding environment
-variables::
-
- export OS_USERNAME=user
- export OS_PASSWORD=pass
- export OS_TENANT_NAME=myproject
- export OS_AUTH_URL=http://auth.example.com:5000/v3
-
-You can select an API version to use by `--os-volume-api-version`
-option or by setting corresponding environment variable::
-
- export OS_VOLUME_API_VERSION=3
-
-
-OPTIONS
-=======
-
-To get a list of available commands and options run::
-
- cinder help
-
-To get usage and options of a command::
-
- cinder help <command>
-
-
-BUGS
-====
-
-Cinder client is hosted in Launchpad so you can view current bugs at
-https://bugs.launchpad.net/python-cinderclient/.
diff --git a/doc/source/user/no_auth.rst b/doc/source/user/no_auth.rst
index 9885df2..71a65e9 100644
--- a/doc/source/user/no_auth.rst
+++ b/doc/source/user/no_auth.rst
@@ -1,6 +1,6 @@
-=========================
-CINDERCLIENT Using noauth
-=========================
+============
+Using noauth
+============
Cinder Server side API setup
============================
diff --git a/playbooks/legacy/cinderclient-dsvm-functional-identity-v3-only/run.yaml b/playbooks/legacy/cinderclient-dsvm-functional-identity-v3-only/run.yaml
index 7c6ca33..d4cc68e 100644
--- a/playbooks/legacy/cinderclient-dsvm-functional-identity-v3-only/run.yaml
+++ b/playbooks/legacy/cinderclient-dsvm-functional-identity-v3-only/run.yaml
@@ -18,7 +18,7 @@
dest: devstack-gate
EOF
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
- git://git.openstack.org \
+ https://git.openstack.org \
openstack-infra/devstack-gate
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
diff --git a/playbooks/legacy/cinderclient-dsvm-functional/run.yaml b/playbooks/legacy/cinderclient-dsvm-functional/run.yaml
index dccf961..8e6f9b1 100644
--- a/playbooks/legacy/cinderclient-dsvm-functional/run.yaml
+++ b/playbooks/legacy/cinderclient-dsvm-functional/run.yaml
@@ -17,7 +17,7 @@
dest: devstack-gate
EOF
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \
- git://git.openstack.org \
+ https://git.openstack.org \
openstack-infra/devstack-gate
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
diff --git a/requirements.txt b/requirements.txt
index e07ffad..efa6cf3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,3 +9,4 @@ Babel!=2.4.0,>=2.3.4 # BSD
six>=1.10.0 # MIT
oslo.i18n>=3.15.3 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
+requests!=2.20.0,>=2.14.2 # Apache-2.0
diff --git a/setup.cfg b/setup.cfg
index f809d94..c0ae02e 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,7 +4,7 @@ summary = OpenStack Block Storage API Client Library
description-file =
README.rst
author = OpenStack
-author-email = openstack-dev@lists.openstack.org
+author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/python-cinderclient/latest/
classifier =
Development Status :: 5 - Production/Stable
@@ -19,6 +19,7 @@ classifier =
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
+ Programming Language :: Python :: 3.6
[global]
diff --git a/tox.ini b/tox.ini
index 43f5947..1d6be00 100644
--- a/tox.ini
+++ b/tox.ini
@@ -20,7 +20,7 @@ deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = find . -type f -name "*.pyc" -delete
- stestr run '{posargs}'
+ stestr run {posargs}
stestr slowest
whitelist_externals = find
@@ -70,7 +70,7 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen
[testenv:functional]
basepython = python3
-commands = stestr run '{posargs}'
+commands = stestr run {posargs}
setenv =
{[testenv]setenv}
OS_TEST_PATH = ./cinderclient/tests/functional