summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijendra Soni <vijendra.soni@cognizant.com>2016-11-11 20:01:05 +0530
committerVijendra Soni <vijendra.soni@cognizant.com>2016-11-21 20:19:53 +0530
commita7a0d0c61a6a88e044b781bbc4903cdcfc919e55 (patch)
treea5318b78d5deae23be434afdb0ca5fd2aade2752
parent95c26cebaa6bf7419a54d632b07ea5303ad0d134 (diff)
downloadpython-openstackclient-a7a0d0c61a6a88e044b781bbc4903cdcfc919e55.tar.gz
Sort list images by name by default
Set the default key and dir for openstack image list, if no command line argument passed Changing sort_key to name(old value: created_at) Change-Id: I6c61f6e5a04824d655ccf43477afcec9652101df Closes-Bug: #1639231
-rw-r--r--doc/source/command-objects/image.rst2
-rw-r--r--openstackclient/image/v1/image.py3
-rw-r--r--openstackclient/image/v2/image.py3
-rw-r--r--releasenotes/notes/bug-1639231-21823768bd54170a.yaml6
4 files changed, 11 insertions, 3 deletions
diff --git a/doc/source/command-objects/image.rst b/doc/source/command-objects/image.rst
index 842eab8d..84e6baa5 100644
--- a/doc/source/command-objects/image.rst
+++ b/doc/source/command-objects/image.rst
@@ -221,7 +221,7 @@ List available images
.. option:: --sort <key>[:<direction>]
- Sort output by selected keys and directions(asc or desc) (default: asc),
+ Sort output by selected keys and directions(asc or desc) (default: name:asc),
multiple keys and directions can be specified separated by comma
.. option:: --limit <limit>
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index 5f669c64..26ce1aac 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -350,8 +350,9 @@ class ListImage(command.Lister):
parser.add_argument(
'--sort',
metavar="<key>[:<direction>]",
+ default='name:asc',
help=_("Sort output by selected keys and directions(asc or desc) "
- "(default: asc), multiple keys and directions can be "
+ "(default: name:asc), multiple keys and directions can be "
"specified separated by comma"),
)
return parser
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index 0712e09c..2edec9db 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -447,8 +447,9 @@ class ListImage(command.Lister):
parser.add_argument(
'--sort',
metavar="<key>[:<direction>]",
+ default='name:asc',
help=_("Sort output by selected keys and directions(asc or desc) "
- "(default: asc), multiple keys and directions can be "
+ "(default: name:asc), multiple keys and directions can be "
"specified separated by comma"),
)
parser.add_argument(
diff --git a/releasenotes/notes/bug-1639231-21823768bd54170a.yaml b/releasenotes/notes/bug-1639231-21823768bd54170a.yaml
new file mode 100644
index 00000000..740a0dd1
--- /dev/null
+++ b/releasenotes/notes/bug-1639231-21823768bd54170a.yaml
@@ -0,0 +1,6 @@
+---
+features:
+ - |
+ The ``image list`` command will now sort by name in ascending order by
+ default. ``--sort`` option will have the default value of ``name:asc``.
+ [Bug `1639231 <https://bugs.launchpad.net/bugs/1639231>`_]