diff options
-rw-r--r-- | .zuul.yaml | 2 | ||||
-rw-r--r-- | doc/source/cli/details.rst | 27 | ||||
-rw-r--r-- | glanceclient/shell.py | 6 | ||||
-rw-r--r-- | glanceclient/tests/unit/test_shell.py | 11 | ||||
-rw-r--r-- | releasenotes/notes/drop-python-3-6-and-3-7-0b299b4dc9673c6e.yaml | 5 | ||||
-rw-r--r-- | setup.cfg | 4 |
6 files changed, 50 insertions, 5 deletions
@@ -79,7 +79,7 @@ - check-requirements - lib-forward-testing-python3 - openstack-cover-jobs - - openstack-python3-yoga-jobs + - openstack-python3-zed-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 check: diff --git a/doc/source/cli/details.rst b/doc/source/cli/details.rst index f446aba..a4ae3f5 100644 --- a/doc/source/cli/details.rst +++ b/doc/source/cli/details.rst @@ -598,6 +598,10 @@ glance image-import .. code-block:: console usage: glance image-import [--import-method <METHOD>] + [--uri <IMAGE_URL>] + [--store <STORE>] [--stores <STORES>] + [--all-stores [True|False]] + [--allow-failure [True|False]] <IMAGE_ID> Initiate the image import taskflow. @@ -614,6 +618,29 @@ Initiate the image import taskflow. be retrieved with import-info command and the default "glance-direct" is used with "image-stage". +``--uri <IMAGE_URL>`` + URI to download the external image + +``--store <STORE>`` + Backend store to upload image to. + +``--stores <STORES>`` + List of comma separated stores to upload image if multi-stores are + enabled in the environment. + +``--all-stores [True|False]`` + "all-stores" can be used instead of "--stores <STORES>" to indicate + that image should be imported all available stores. + +``--allow-failure [True|False]`` + Indicator if all stores listed (or available) must + succeed. "True" by default meaning that we allow some + stores to fail and the status can be monitored from + the image metadata. If this is set to "False" the + import will be reverted should any of the uploads + fail. Only usable with "stores" or "all-stores". + + .. _glance_image-create-via-import: glance image-create-via-import diff --git a/glanceclient/shell.py b/glanceclient/shell.py index 3a32bfb..4a505a5 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -224,8 +224,12 @@ class OpenStackImagesShell(object): help=argparse.SUPPRESS, ) self.subcommands[command] = subparser + required_args = subparser.add_argument_group('Required arguments') for (args, kwargs) in arguments: - subparser.add_argument(*args, **kwargs) + if kwargs.get('required', False): + required_args.add_argument(*args, **kwargs) + else: + subparser.add_argument(*args, **kwargs) subparser.set_defaults(func=callback) def _add_bash_completion_subparser(self, subparsers): diff --git a/glanceclient/tests/unit/test_shell.py b/glanceclient/tests/unit/test_shell.py index 129b127..6b9472e 100644 --- a/glanceclient/tests/unit/test_shell.py +++ b/glanceclient/tests/unit/test_shell.py @@ -600,6 +600,17 @@ class ShellTest(testutils.TestCase): self.assertEqual(glance_logger.getEffectiveLevel(), logging.DEBUG) conf.assert_called_with(level=logging.DEBUG) + def test_subcommand_help(self): + # Ensure that main works with sub command help + stdout, stderr = self.shell('help stores-delete') + + expected = 'usage: glance stores-delete --store <STORE_ID> ' \ + '<IMAGE_ID>\n\nDelete image from specific store.' \ + '\n\nPositional arguments:\n <IMAGE_ID> ' \ + 'ID of image to update.\n\nRequired arguments:\n ' \ + '--store <STORE_ID> Store to delete image from.\n' + self.assertEqual(expected, stdout) + class ShellTestWithKeystoneV3Auth(ShellTest): # auth environment to use diff --git a/releasenotes/notes/drop-python-3-6-and-3-7-0b299b4dc9673c6e.yaml b/releasenotes/notes/drop-python-3-6-and-3-7-0b299b4dc9673c6e.yaml new file mode 100644 index 0000000..db420d7 --- /dev/null +++ b/releasenotes/notes/drop-python-3-6-and-3-7-0b299b4dc9673c6e.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + Python 3.6 & 3.7 support has been dropped. The minimum version of Python now + supported is Python 3.8. @@ -7,7 +7,7 @@ license = Apache License, Version 2.0 author = OpenStack author_email = openstack-discuss@lists.openstack.org home_page = https://docs.openstack.org/python-glanceclient/latest/ -python_requires = >=3.6 +python_requires = >=3.8 classifier = Development Status :: 5 - Production/Stable Environment :: Console @@ -20,8 +20,6 @@ classifier = Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 |