CloudKitty's v1 API has been deprecated for a while, but the CLI
continued to use that as a default, keeping v2 as optional. This patch
changes that behaviour, switching to use the more modern and currently
maintained v2 as default, while v1 is still available via the
--os-rating-api-version parameter.
Change-Id: I4ca8c4f69b022af53d9f7ec71f3a2efadfc9163e
Signed-off-by: Juan Larriba <jlarriba@redhat.com>
It was introduced the concept of start and end periods in
Cloudkitty rating rules. Therefore to make Cloudkitty CLI
compatible with the Cloudkitty REST API, we need to add
those new available attributes in the CLI as well.
Change-Id: I0cd9b61fa81232d235c959da551a7840465fae88
Signed-off-by: Pedro Henrique <phpm13@gmail.com>
The POST request for triggering reprocessing needs to be made to
``/v2/task/reprocesses``. This is the same as for other requests, so we
can drop ``url_for_post``.
Change-Id: If630d4f313c875733dbe1937ff7ca625821e04af
While running the tests with the latest tox I was getting the following error message:
```
failed with pass_env values cannot contain whitespace, use comma to have multiple values in a single line'
```
That error is happening because of the passenv declaration. This patch is proposing a fix for that.
Besides the `tox` issue, we also needed to create a patch for the use of virtual env inside DevStack.
This patches presents a solution to run tests using the virtual env of DevStack.
Change-Id: Id8249ebb15d4047dcc6181908eae66eb39722863
ABCs in collections should be imported from collections.abc and direct
import from collections is deprecated since Python 3.3.
Change-Id: I871810bbe95a3cd10f8a8df42c99e747a6dd463b
A cost of 0.0 was interpreted as a False value, making the check think
the cost argument was missing.
Change-Id: I5f86540221b80667fc63b8b54659092c637b7353
Story: 2009047
Task: 42814
When using 0 as the cost, the `create_threshold` method
throws an exception. That happens because 0 (zero) is evaluated
to False. Therefore, we need to change the validation method to
check if the values are None.
Change-Id: Iedd541c0ad16db0d11d6e6de332eddf880af1698
Support for the ``GET /v2/dataframes`` endpoint has been added
to the client. A new ``dataframes get`` CLI command is also available.
Story: 2005890
Task: 36384
Depends-On: https://review.opendev.org/#/c/679636
Change-Id: Idfe93025e0f740906d0f53f33547c7746fc15169
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I9bf0a8fbb7b4f22aa2f5b5ed0836d11cac27552b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Work items:
* Removed the globale-requirements constraint. Since python-cloudkittyclient
is now part of the global requirements, the upstream requirements
file can't be used anymore.
* Add cliff to docs requirements.
* Change cloudkittyclient namespace names: Having a dot in a namespace
name causes the "autoprogram-cliff" to use the "application mode".
Change-Id: I8020d816b3397550fbcbd42cc14a9861bca7ae80
This improves formatting for HTTP errors. keystoneauth's HttpErrors
are now caught an re-formatted to include the body of the http response.
Work items:
* Introduce the "http_error_formatter" function decorator, which catches
an re-formats keystoneauths HttpErrors.
* Introduce the "format_http_errors" class decorator, which applies the
"http_error_formatter" to all functions of a class.
* Add an "HttpDecoratorMeta" to the "BaseManager" class. This will decorate
all functions of classes inheriting from "BaseManager" with the
"http_error_formatter" decorator.
Change-Id: I6735f1fa8d876a87e2b7d4aaa533d5a32b085735
A test looking for a regex in an argparse error message is failing when ran
on python3. Since this is now the default python runtime for devstack-based
jobs, this updates the message.
Change-Id: Id3372998715f13f7641d11a4a1d9d16629acfd18
Story: 2006896
Task: 37530
This adds support for the new v2 API rating modules endpoints. Unit tests included.
Change-Id: Ie116c518f30128b49c3991f36101db7535af7db1
Story: 2006572
Task: 36680
Support for the ``/v2/dataframes`` endpoint has been added to the client.
A new ``dataframes add`` CLI command is also available.
Change-Id: I7fe9072d7280f251edc865a653a0b9ed2ab26c90
Story: 2005890
Task: 35970
This allows to reset the state of one or several scopes through the API via
the client library and cli tool.
Change-Id: I69ce9a1c2ee0d8a6dd191a39e5c843e0baa1290f
Story: 2005395
Task: 30794
This allows to get a summary through the v2 API endpoint via the client
library and cli tool.
Depends-On: https://review.opendev.org/#/c/660608/
Change-Id: Id63f2419fe3a1eb518a0ffa7ea5fa572b18df651
Story: 2005664
Task: 30960
This allows to retrieve the state of one or several scopes through the API via
the client library and cli tool.
Change-Id: I53995062fe76100f6dfcc672af482f653cc85bde
Story: 2005395
Task: 30795
Depends-On: https://review.opendev.org/#/c/658073/
This adds a v2 client class allowing to add support for upcoming
v2 API endpoints. The v2 client class implements all v1 endpoints.
The cloudkitty API version can be specified with the
"--os-rating-api-version" option or the "OS_RATING_API_VERSION"
environment variable.
Change-Id: If38730da3baed59c93543a08f8a4989f919611db
This updates the rating.get_quotation method of the client. Tests on this
method have been added.
Depends-On: https://review.openstack.org/#/c/648062/
Change-Id: Ie2de0162311c2d162c1573042187ac4e628bd966
Since no data is available in devstack in our functional test environment,
we make the assertion that 'summary get' returns nothing. This is prone to
update if more complete test scenarios are implemented.
Change-Id: Ic80e39f0d2a75882762ebd6a0dba46033c9fd7f4
This fixes the "cloudkitty report tenant list": command, by transforming each
element of the list returned by CliTenantList's take_action method
into a tuple.
Change-Id: Iba1401b0cb4319a668d449139c8d20fc011cf178
Story: 2004149
Task: 27622
The client does support SSL authentication through keystoneauth right now. In
CLI mode, this is done through the "--os-cert" and "--os-cacert" options, or
through environment variables.
However, when the client is used as a python library,this is done through
requests' "verify" parameter, which is not very explicit.
This adds two parameters to the client
Change-Id: I68969c658724f53c85c47ab6098a3e2165f5925d
Story: 2003689
Task: 26224
The --os-interface/OS_INTERFACE and --os-region-name/OS_REGION_NAME
options were considered by cloudkitty CLI but ignored when using the OSC
integration.
Change-Id: I36dc3616fba59c9b2e77da75abe0f76db7ddb7e4
The client has been completely rewritten in order to use cliff. The code
should be easier to maintain: authentication is now entirely handled by
keystoneauth, CloudKitty's client and CK's OSC plugin use the exact same
classes (no code duplication).
New features for users:
* Client-side CSV report generation: It is possible for users to generate
CSV reports with the new client. There is a default format, but reports
may also be configured through a yaml config file. (see documentation)
* The documentation has been improved. (A few examples on how to use the
python library + complete API bindings and CLI reference).
* It is now possible to use the client without Keystone authentication (this
requires that CK's API is configured to use the noauth auth strategy).
* Various features are brought by cliff: completion, command output formatting
(table, shell, yaml, json...).
New features for developpers:
* Python 2.7/3.5 compatible 'python-cloudkittyclient' module.
* Integration tests (for 'openstack rating' and 'cloudkitty') have been
added. These allow to create gate jobs running against a CK devstack
* Tests are now ran with stestr instead of testr, which allows a better
control over execution.
* The dependency list has been reduced and upper constraints have been set.
Change-Id: I7c6afa46138d499b37b8be3d049b23ab5302a928
Task: 6589
Story: 2001614
Use `cloudkitty total-get --all-tenants` to get total
rate of all_tenants. Same with summary-get
Depends-On: 8cf7332162ad30bcdb2c8dfd10a3d348601c2870
Change-Id: I1efcbb8eff77c5f8d358a02178b1f99204b6cba7
This patch adds access to new REST API for config and service
metadata retrieval.
The following work has been done:
* Create new manager for config retrieval
* Create new Resource and CRUD manager for service info retrieval
* Add managers to client
* Add new CLI command and openstack client entries
Change-Id: I43f572202b1cd3832a820f46f7c7b44a0d998406
Depends-on: https://review.openstack.org/#/c/406180/
Use commands as follows to get summary:
-- cloudkitty summary-get
-- openstack rating summary-get
Change-Id: I07da26cb31a03104493ab749efffd73ba8d17d62
Implements: blueprint price-groupby-fields