20 Commits

Author SHA1 Message Date
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
Dean Troyer
03a2accb2f Format aggregate command fields and de-race functional tests
Rename metadata to property in all aggregate commands

Beef up functional tests to reduce street racing

Change-Id: I4598da73b85a954f3e6a3981db21891b45d9548c
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-08-26 17:50:06 -05:00
Dean Troyer
99c3be93c8 Serialize more aggregate functional tests
These tests are showing signs of problems running in parallel
so serialse the create/delete/list/set/unset tests.  They all
used two aggregates each anyway...

Change-Id: Iba4b52c179e6914eaeefea1da0f7eaefcdcf1f87
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2019-05-17 19:15:28 -05:00
Gábor Antal
1c91e9828d Handle log message interpolation by the logger in compute/
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: Ib7b5fb5f794026fc8a84260c4803afea321a9cf5
Closes-Bug: #1596829
2017-02-13 18:43:12 +01: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
Rui Chen
6371556916 Support "--no" option in aggregate set
Supporting "--no-property" option will apply user a convenience
way to clean all properties of aggregate in a short command,
and this kind of behavior is the recommended way to devref.
The patch add "--no-property" option in "aggregate set" command,
and update related test cases and devref document.

Change-Id: I7614a23c0db05144562330dc600dbab7d003d5d8
Implements: blueprint support-no-property-in-aggregate
2016-09-24 15:59:13 +08:00
Huanxuan Ao
640014fa91 Support bulk deletion for "flavor/aggregate delete"
Support bulk deletion and error handling for "aggregate delete"
and "flavor delete" commands.

Change-Id: I3f6105cbeeab1c9f8cd571c63ce0e7ac3d4252b3
Partially-Implements: blueprint multi-argument-compute
Partial-Bug: #1592906
2016-06-21 11:04:13 +08: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
be192676bd osc-lib: parseractions
Leave parseractions.py and test_parseractions.py as a sanity check during the
deprecation period.

Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
2016-06-13 10:55:44 -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
Tang Chen
5398c96e2a Fix i18n support for help and error messages in compute
Change-Id: Id6eebcb48d1b7b49b6636524506294edbc44a83f
Partial-bug: #1574965
2016-05-24 11:03:49 +08:00
Rui Chen
4cbcd02a57 Add "aggregate unset" to osc
Support "aggregate unset" command in order to
remove the property of aggregate object in OSC.

Change-Id: I49645135586362f0fd251f5e4a4c03eff273d9e9
Closes-Bug: #1559866
2016-03-24 10:33:23 +08:00
Tang Chen
ba826fa04f Make SetAggregate inherit from cliff.Command
set/unset comamnd classes should inherit from cliff.Command class.

Also, this patch adds functional tests for aggregate.

And also, use utils.format_dict() to format the output of the
properties dict.

Change-Id: Idb50bef8990da95666960e2414dfd7c9be234bba
Partial-bug: #1519503
Closes-Bug: 1546065
2016-02-27 03:50:47 +08: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
Tang Chen
494659fbe4 Trivial: Remove useless return from files in compute.
Change-Id: I9dc6749256fcd53d292d7f658912c032e9ce9df5
2015-12-17 09:34:12 +08: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
Steve Martinelli
019c155e9b Fine tune some of the helps commands
try and add some consistency with the show and delete commands.

replace 'show x' with 'display x'
change 'delete a y' with just 'delete y'

Change-Id: I47dfa8ee23ac5c41b355796415eb515155832f65
2015-01-13 00:58:57 -05:00
Dean Troyer
9eb30efbf3 Command object docs: aggregate, console *, keypair
aggregate
console log
console url
keypair

Change-Id: Iec9b8404ed5febd061a5dfd674b76aaa8aba67bc
2014-11-19 14:47:53 -06: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
2cc996356c Add aggregate commands
* Add aggregate: add host, create, delete, list, remove host, set, show

* Add list --long option
* Filter 'availability_zone' from the metadata fields
* Rename 'metadata' column to 'properties' in all output

Bug: 1172032
Blueprint: nova-client

Change-Id: Icd408c2b34af07f5102f53d3778d8546952a12c5
2013-07-19 15:37:10 -05:00