15 Commits

Author SHA1 Message Date
Stephen Finucane
7d80f9e962 Blacken openstack.common
Black used with the '-l 79 -S' flags.

A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.

Change-Id: Ifcb3c798666d74d596b8ecb3d6d507f782de7ba5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-05-10 10:51:30 +01:00
lihaijing
d15bbada73 Replace six.iteritems() with .items()
1. As mentioned in [1], we should avoid using six.iteritems to achieve
   iterators. We can use dict.items instead, as it will return iterators
   in PY3 as well. And dict.items/keys will more readable.

2. In py2, the performance about list should be negligible,
   see the link [2].

[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85
Implements: blueprint replace-iteritems-with-items
2020-01-09 18:41:29 +09:00
Rui Chen
0898ebacb8 Support list commands by group name keyword
The output of current "command list" is so long, it's
very difficult for users to find out the commands
they care about.

Add "--group <group-keyword>" option to filter the commands by group
name keyword, like: --group volume, list all openstack.volume.v2
(cinder) commands

That support the scenario that users need to know the current support
commands of some OpenStack services(nova, neutron, cinder and so on) in
OSC.

Change-Id: Id673042729ad36a0cac0b81fb31a3537c24f03fc
Closes-Bug: #1666780
2017-02-23 12:13:06 +08:00
Rui Chen
10f0300f70 Show openstacksdk version info in "module list"
openstacksdk bug/1588823 exist, no good way to add __version__ for
openstack module properly, fix the issue in osc side, make openstacksdk
module information be available.

Change-Id: I27ff61792443d1aa07f31598bed3aa32f924ff40
Partial-Bug: #1662058
2017-02-22 16:40:22 +08:00
Rui Chen
3afd2b7ff2 Fix "module list --all" failed
KeyError cause the command "module list --all" failed,
fix it, and do refactor to filter private modules and
reduce the loop times, add related unit tests and
functional tests.

Change-Id: Icd77739502e05b5f763a04a92547497bf82d5d63
Closes-Bug: #1661814
2017-02-06 09:44:18 +08:00
Steve Martinelli
0ef8535036 translate all command help strings
Leverage the new cliff command class attribute (_description)
to get the help of a command, this allows us to mark strings
for translation. We could not do this before since the help
was grabbed from the docstring.

This also depends on a new release of cliff and a bump to the
minimum level in osc's requirements.

Closes-Bug: 1636209
Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da
Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
2016-11-17 02:33:42 +00:00
Dean Troyer
9e2b8e6730 osc-lib: command
Leave command.py and test_command.py as a sanity check during the
deprecation period.

Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
2016-06-13 11:00:22 -05:00
Dean Troyer
e5e29a8fef osc-lib: utils
Use osc-lib directly for utils.

Leave openstackclient.common.utils for deprecation period.

Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
2016-06-13 10:50:44 -05:00
Huanxuan Ao
b36d521ff6 Fix i18n supports in commom
I checked all the files in openstackclient/common
and fixed the missing i18n supprots.

Change-Id: Id7f76a24aae663f5832ef9bcf1bd5a6b7081af24
Partial-bug: #1574965
2016-06-07 19:56:00 +08:00
Brandon Palm
f0c3b4e69d Fixed command list
The cliff module expects an array of tuples however
the array that this function was returning was an array
of tuples that was also containing an array of values for
the commands attached to each group and the
cliff module wasn't liking it.

The output now comes out looking like:

| openstack.common | limits show |
|                  | extension list |
| openstack.baremetal.v1 | baremetal set |

Change-Id: Ifa1c149cb5c66ba27dc72bf72d7c8f2f50e42f73
Closes-Bug: 1545609
2016-03-09 16:00:39 +00:00
Akihiro Motoki
258c1102cc log take_action parameters in a single place
Previously each command logs take_action parameters explicitly
by using @utils.log_method decorator or log.debug().
Some commands have no logging.

This commit calls a logger in the base class and
drops all logging definition from individual commands.

Closes-Bug: #1532294
Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
2016-02-02 09:58:32 +09:00
Joshua Harlow
e3c46ece4a Use a common decorator to log 'take_action' activation
Instead of duplicating the same log statement throughout
the code, the same logic can be provided by a shared decorator
that abstracts away the logging capability and unifies it behind
a common function instead.

Change-Id: Icc63bced7347c8bbf0299a4c5821425a10892a79
2015-09-01 16:49:54 -07:00
Dean Troyer
d32185cb34 Add 'command list' command
* Add method to CommandManager to retrieve command names by group
* Add ListCommands

To list command groups loaded by cliff

Change-Id: I37fe2471aa2fafa8aa223159452d52b1981021d6
2014-10-08 21:57:26 -05:00
Christian Berendt
3b485de6b0 replace string format arguments with function parameters
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.

Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
2014-05-20 13:49:56 +02:00
Dean Troyer
a93cc3fae2 Add module list command
Lists versions of installed python modules

(Origianlly proposed as 'version list')

Change-Id: I76a51d3d6783f46ef2daa0a41626019a880a2a50
2013-12-03 17:53:55 -06:00