summaryrefslogtreecommitdiff
path: root/openstackclient/compute/v2/usage.py
Commit message (Collapse)AuthorAgeFilesLines
* Blacken openstackclient.computeStephen Finucane2023-05-101-37/+53
| | | | | | | | | | 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: I9af45c062d179ab3dc2a5e969e1c467932753a2b Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Use the compute SDK in usage commandsDaniel Wilson2022-10-251-39/+30
| | | | | | | Update usage list and usage show to use the compute component of the OpenStack SDK instead of directly using the nova interface. Change-Id: I1c4d2247c9c1a577ed9efad7e8332e7c9b974ad5
* compute: Fix 'usage * -f yaml' outputStephen Finucane2021-01-061-24/+79
| | | | | | | | | Make use of 'FormattableColumn'-derived formatters, which provide better output than what we were using before, particularly for the YAML output format. Change-Id: Ic770f27cb1f74222636f05350f97400808adffbf Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Replace six.iteritems() with .items()lihaijing2020-01-091-2/+1
| | | | | | | | | | | | | | | | 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
* Paginate over usage list to return all usagesPavlo Shchelokovskyy2019-02-281-1/+49
| | | | | | | | | | | | | | | 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
* Fix additional output encoding issuesDean Troyer2018-03-201-4/+4
| | | | | | | | 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
* Modified API calls in os usagejiahui.qiang2016-12-081-1/+1
| | | | | | | We usually call v3 keystoneclient APIs for V2 OSC, this patch modified 'tenants' to 'projects'. Change-Id: Idbf74f098cd1386aa675c081480b89bbc11c8534
* translate all command help strings3.4.0Steve Martinelli2016-11-171-2/+2
| | | | | | | | | | | | | | 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
* osc-lib: commandDean Troyer2016-06-131-1/+1
| | | | | | | Leave command.py and test_command.py as a sanity check during the deprecation period. Change-Id: I24e1b755cbfbcbcaeb5273ec0c9706b82384fc85
* osc-lib: utilsDean Troyer2016-06-131-1/+1
| | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* Fix i18n support for help and error messages in computeTang Chen2016-05-241-16/+18
| | | | | Change-Id: Id6eebcb48d1b7b49b6636524506294edbc44a83f Partial-bug: #1574965
* log take_action parameters in a single placeAkihiro Motoki2016-02-021-12/+3
| | | | | | | | | | | | 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
* Remove deprecated 'project usage list' commandDean Troyer2015-11-181-17/+0
| | | | | | | | | | 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
* Fix the bug of "openstack usage show"xiexs2015-11-021-4/+12
| | | | | | | | | 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
* Deprecate project usage list commandDean Troyer2015-01-151-6/+23
| | | | | | | | | | | | | | | | | | | | | | | 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
* Add docs for usage show/listSteve Martinelli2014-12-311-6/+6
| | | | Change-Id: Iaf911d69a0b63d705f8789a4640018a428b87be6
* Add usage show commandSteve Martinelli2014-12-261-0/+74
| | | | | | | | 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
* Fix a few issues with 'usage list'Steve Martinelli2014-12-261-3/+6
| | | | | | | * Added number of servers column, was missing * Added a new line character after the initial usage message Change-Id: I6c4e5bda6ba9ceafa92ecf13987c56d0bbe99961
* Ignore most of the new hacking 0.9.2 rulesDean Troyer2014-06-131-1/+1
| | | | | | | | So we can update requriements.txt. But fix a couple of easy ones: * Fix E251 (1 occurrance) * Fix E131 (1 occurrance) Change-Id: I62aaa423aa6da9e9f0ca026ec586b51cc6a6df03
* replace string format arguments with function parametersChristian Berendt2014-05-201-1/+1
| | | | | | | | There are files containing string format arguments inside logging messages. Using logging function parameters should be preferred. Change-Id: Ic749ac9eb55564ed631d57055a5a4dfc3aebd169
* Fix some help stringsAndreas Jaeger2014-02-211-1/+1
| | | | | | | | | | 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
* Remove remaining print statementsDean Troyer2014-01-221-2/+5
| | | | | | I think these are the last two stragglers, including debugging lines Change-Id: Ic3dd98480211d0f7d3cc951bec5cd54f902a101f
* Remove tenant round 3 - other commandsDean Troyer2013-07-311-1/+20
| | | | | | | Mostly options and help strings: * image, server, project usage, volume Change-Id: I788b0660f8c2daacde53c20a72dd1afc60cf5159
* Add usage command for compute apiSteve Martinelli2013-07-261-0/+91
As per the blueprint: nova-client, adding usage command for compute Change-Id: Ib694b0b1ebf56b2a62b6f09c67ffaa6959911605