20 Commits

Author SHA1 Message Date
Pavlo Shchelokovskyy
c79de8a90b Paginate over usage list to return all usages
since nova api 2.40 the os-simple-tenant-usage API supports pagination
and will by default return a number of entities configured internally in
Nova.
This means that when there are many enough projects,
the single call to usage.list() will not return usages for all projects.

This patch effectively copy-pastes the logic to paginate over usage list
results from novaclient/v2/shell.py code.

Change-Id: I1b639fe386b7b7db3223f6965495094b9d51533a
Story: #2005099
Task: #29713
2019-02-28 20:27:04 +02:00
Dean Troyer
6df58b6366 Fix additional output encoding issues
This is a followup to https://review.openstack.org/#/c/541609/ that
changes most outstanding direct uses of sys.stdout to use the encoded
stdout set up by cliff.

Change-Id: I07cfc418385fc787d3b7d3c32d39676cf81bb91f
2018-03-20 15:40:23 -05:00
jiahui.qiang
035a87051c Modified API calls in os usage
We usually call v3 keystoneclient APIs for V2 OSC, this patch
modified 'tenants' to 'projects'.

Change-Id: Idbf74f098cd1386aa675c081480b89bbc11c8534
2016-12-08 03:00:45 +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
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
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
Dean Troyer
1a8020cc1b Remove deprecated 'project usage list' command
Remove the 'project usage list' command that was deprecated in version
1.0.2 in review Ie08d4f88d71a660fca1862405351109cd0aa86b6.

Note that the removed command class is a good example of how to wrap a
command and show a deprecation message.

Change-Id: I6c750730963615895f5d9953487d2d5a905885a8
2015-11-18 15:37:55 -06:00
xiexs
9e50752321 Fix the bug of "openstack usage show"
When there is no resouce usage associated with the project,
an odd output will be displayed.
This patch tried to fix this issue.

Change-Id: I6f254c6ba37fbb760ada08e640c4938668d560dc
Closes-Bug: #1512220
2015-11-02 04:28:17 -05:00
Dean Troyer
bc11c4d7d8 Deprecate project usage list command
Rather than pointing the 'project usage list' entry point directly to
ListUsage, this makes a ListProjectUsage subclass to alias the desired
command and still allow for changing behaviour or issuing a deprecation
messages.  This implementation simply sets a new 'deprecated' attribute
in the command class that cliff will use to skip this command when
generating help output.

The actual skipping of the command in help output is dependant on
https://review.openstack.org/147349 merging in cliff, this review will
simply have no effect on help output until a version of cliff with
that update is present.

The deprecation message printed is somewhat generic until
https://review.openstack.org/147381 is merged in cliff.
Until that is merged, the deprecation message will not have the name
of the actual command given by the user in it, but rather the text
'this command'.

Closes-bug: #1406654
Change-Id: Ie08d4f88d71a660fca1862405351109cd0aa86b6
2015-01-15 00:04:55 -06:00
Steve Martinelli
480921d0e8 Add docs for usage show/list
Change-Id: Iaf911d69a0b63d705f8789a4640018a428b87be6
2014-12-31 14:21:48 -05:00
Steve Martinelli
5761a0f0b7 Add usage show command
Should show basic usage by project id, if not specified then
use the project id the user is authN'ing with.

Change-Id: I0284a5efd84075b18e1a7117cc9f8f7fecf16274
Closes-Bug: #1400796
2014-12-26 03:25:51 -05:00
Steve Martinelli
6e3c9a3d2d Fix a few issues with 'usage list'
* Added number of servers column, was missing
* Added a new line character after the initial usage message

Change-Id: I6c4e5bda6ba9ceafa92ecf13987c56d0bbe99961
2014-12-26 03:23:10 -05:00
Dean Troyer
0059f045a9 Ignore most of the new hacking 0.9.2 rules
So we can update requriements.txt.  But fix a couple of easy ones:
* Fix E251 (1 occurrance)
* Fix E131 (1 occurrance)

Change-Id: I62aaa423aa6da9e9f0ca026ec586b51cc6a6df03
2014-06-13 17:06:28 -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
Andreas Jaeger
5043293156 Fix some help strings
This fixes some errors and inconsistencies I found reviewing the
help strings:
* Capitalize help strings
* Add missing space between words (in multi-line strings)
* Improve wording

Change-Id: I2fb31ab4191c330146e31c1a9651115a6657769a
2014-02-21 19:40:41 +01:00
Dean Troyer
350718f3bb Remove remaining print statements
I think these are the last two stragglers, including debugging lines

Change-Id: Ic3dd98480211d0f7d3cc951bec5cd54f902a101f
2014-01-22 18:53:11 -06:00
Dean Troyer
7d138b94ec Remove tenant round 3 - other commands
Mostly options and help strings:
* image, server, project usage, volume

Change-Id: I788b0660f8c2daacde53c20a72dd1afc60cf5159
2013-07-31 10:12:20 -05:00
Steve Martinelli
fcc34652ec Add usage command for compute api
As per the blueprint: nova-client, adding usage command for
compute

Change-Id: Ib694b0b1ebf56b2a62b6f09c67ffaa6959911605
2013-07-26 00:12:04 -05:00