Commit Graph

498 Commits

Author SHA1 Message Date
OpenDev Sysadmins 25b2e062d2 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:50:31 +00:00
Jenkins 2ac63f70c1 Merge "Return invoice status" 2017-08-21 02:41:11 +00:00
Feilong Wang c769c1ced8 Return invoice status
The state/status of invoice can indidate if the invoice has been paid
or not. It would be nice to show/remind our customer via billing panel
if their invoices have been paid.

Change-Id: Ia3f77bbf04ece10f0dc9fdcafa93fcb8d8401c98
2017-08-14 14:40:11 +12:00
Feilong Wang 6d990b6ca6 Support discount for prodcut category mapping
To show the discount info in invoice, it's necessary to add discount
into the discount/category mapping.

Change-Id: I53580eaafbd80bd9efd9a17eab03d42bf1edf481
2017-08-11 02:12:49 +00:00
Jenkins e61b323a32 Merge "Fix getting context info when doing policy check" 2017-08-10 22:19:48 +00:00
Jenkins 100e458502 Merge "Fix object storage mapping" 2017-08-10 01:10:54 +00:00
Jenkins cfdf8d0c19 Merge "Round the quantity for storage product" 2017-08-10 01:04:47 +00:00
Jenkins 95b5564599 Merge "Remove useless config options" 2017-08-10 01:04:28 +00:00
Feilong Wang 03e938b2e0 Fix typo
Change-Id: I1e2e4c1eb92200934a7d023fa2a3c065904be2db
2017-08-09 19:05:17 +00:00
Jenkins 54953ed06c Merge "Improve cache about get products" 2017-08-09 05:49:42 +00:00
Jenkins fcbb7add49 Merge "Ensure using UTC for /quotations" 2017-08-09 05:03:23 +00:00
Jenkins a8716fb3bc Merge "Fix ut for project order" 2017-08-09 04:48:58 +00:00
Jenkins 5064f42c79 Merge "Cache invoices" 2017-08-09 04:44:59 +00:00
Feilong Wang b10b6d5260 Round the quantity for storage product
Change-Id: I2ac1c9c8999c63085aa032e5d52c7ef99f679bf6
2017-08-09 15:33:53 +12:00
Feilong Wang 8219bdbe6c Add oslo.cache to distil.conf
Change-Id: I5ff4bc88c8ea37e65d6a3564358c90f3bf29e03f
2017-08-09 14:03:52 +12:00
Feilong Wang f7321d9723 Fix object storage mapping
The product category mapping is missing the object storage mapping
relationship. This patch fixes it.

Change-Id: I0a320e57845443307797076ba9ecef2f373648fa
2017-08-08 00:10:23 +12:00
Feilong Wang 53e785a77f Remove useless config options
Change-Id: I1310ba71cace0dc633ccf4787a66de69db89858e
2017-08-08 00:03:13 +12:00
Jenkins a9b9a83e73 Merge "Stop using deprecated 'message' attribute in Exception" 2017-08-07 04:23:16 +00:00
Lingxian Kong 8130227ba5 Fix ut for project order
Change-Id: Ia24baa80c19b24924f1cda92ae31d9a48086bbd5
2017-08-07 14:52:06 +12:00
Lingxian Kong d0f142d1e8 Fix getting context info when doing policy check
Use 'to_policy_values' method to get context information for policy
checking to avoid exception when using older version of oslo.context,
e.g. in oslo.context==2.2.0, the property 'user_id' doesn't exist in
RequestContext.

Change-Id: I736d008365e28a2826646c1677f739a0a7fbb518
2017-08-07 12:24:32 +12:00
Jenkins e2dbdd4b50 Merge "Add 'collect_end_time' param for distil-collector command" 2017-08-04 01:50:05 +00:00
Feilong Wang 153986f38a Ensure using UTC for /quotations
Change-Id: Iebad7d45f82d35935aa0d93118d26695ec59a184
2017-08-03 23:25:00 +00:00
Feilong Wang 19e1a8ccb5 Cache invoices
All the data of invoices are static, so it would be nice to cache it
to get better performance.

Change-Id: Idb9fb970350ddb9bc1dacedd177301ad84913e4c
2017-08-02 06:49:51 +12:00
Jenkins 7b264d3a30 Merge "Add doc for Distil" 2017-08-01 18:47:30 +00:00
Feilong Wang 7e47ebe512 Improve cache about get products
For most of the cases of Distil API, the request comes
from billing panel. Billing panel sends 1 API call for /invoices and
several API calls for /quotations against different regions. So it's
not efficient to specify the region for get_products method because
it won't help cache the products based on the parameters.

Change-Id: I2f7e2ce8c3f43e79b9e9084903fca1bc4f44f82a
2017-08-02 05:20:20 +12:00
rajat29 81c91f6701 Stop using deprecated 'message' attribute in Exception
The 'message' attribute has been deprecated and removed
from Python3.
For more details, please check:
https://www.python.org/dev/peps/pep-0352/

Change-Id: I6514be276561525ca17d8bc6e43b8c7312aa5b76
2017-08-01 16:38:17 +05:30
Feilong Wang 251904a219 Add doc for Distil
Change-Id: Iaa76ddb67ae44b6e641e8083925ea1a281031b32
2017-07-31 16:48:30 +12:00
Lingxian Kong 68650cfbdc Add 'collect_end_time' param for distil-collector command
This change give us a convenient way to do usage collection
catch up to specific date. By default the end time when collection
happends is now() and the collection service will keep running
infinitely.

This patch adds a command line param called 'collect_end_time'.

If we start distil-collector manually with 'collect_end_time' param
specified, the service should be stopped automatically after all
projects usage collection is up-to-date.

Change-Id: I0d0aebcf3dfeeb987155bb8d92f2aee1918ceac8
2017-07-31 13:18:50 +12:00
Lingxian Kong d906c733a2 Support project order for collection
The project ids returned from Keystone is in ascending order which may
lead to some projects will never get updated if some unexcepted error
happens during collection.

This patch adds a config option to define the prefered collection
order, currently, 'ascending', 'descending' and 'random' are supported.

Change-Id: Ife97e73fe2ae4533ef4baf1f935e46579902719e
2017-07-11 16:56:55 +12:00
Jenkins 07db108fad Merge "Add return value for collect_usage()" 2017-07-09 21:44:28 +00:00
Lingxian Kong fb02058975 Add return value for collect_usage()
When some exception happened in collect_usage() when doing collection
for tenant in either time window, correct exception message should be
logged, and tenant collection should not be considered successful.

This patch mainly changes the log message.

Change-Id: I2c6784708c32030b0d32bb0696b194a0be0f8a91
2017-07-06 03:12:41 +00:00
Jenkins 15a3dc745a Merge "Replace assertEquals with assertEqual" 2017-07-06 02:45:40 +00:00
Jenkins 6b2d5b6d07 Merge "Remove unused None from dict.get()" 2017-07-06 02:44:55 +00:00
Jenkins 2a5b403a8b Merge "Remove usage of parameter enforce_type" 2017-07-06 02:35:09 +00:00
Jenkins 864040f862 Merge "Trivial fix for odoo driver" 2017-07-06 02:33:59 +00:00
Jenkins 010ebf5aa9 Merge "Support odoo in health check" 2017-07-05 05:14:40 +00:00
Lingxian Kong ed3659f1c4 Trivial fix for odoo driver
- Fix display result of decimal floating point arithmetic.
- Use 'rate' to represent product unit price, the same with what users
  see from invoice and quotation.

Change-Id: I500ff41b2cfc7cb67d4e8570bfae34aadbd45b12
2017-07-04 14:50:02 +12:00
sudhir_agarwal 9f8cd55df4 Remove unused None from dict.get()
Since the default value is None when can't get a key from a dict,
So there is no need to use dict.get('key', None).

Change-Id: Ia2024152e6f01ce6d46bae74095351477637c908
2017-06-29 12:19:54 +05:30
Feilong Wang f8be0c0710 Support odoo in health check
Co-Authored-By: Amelia Cordwell <ameliacordwell@catalyst.net.nz>
Change-Id: I010bdb444a22bbd7a30ed42054b819a9f520666a
2017-06-28 17:06:03 +12:00
Feilong Wang dceb974059 Improve performance of getting products
Instead of calling odoo API 3 times, we're moving out the products
calling out of the loop of regions to improve the performance.

Change-Id: I9536d034ffe67caac2d4350f2e830528f5da5c34
2017-06-28 13:56:07 +12:00
Lingxian Kong 00638fa410 Fix policy check for distil
To keep consistent with other projects and enable 'admin_or_owner' rule
in policy.json, this patch adds neccessary fields for policy check
target and use correct method to get context dictionary.

To be clear, the rule in policy.json 'project_id:%(project_id)s' comes
from Nova originally, the policy module will get project_id from
request URL to Nova service andn compare with project_id in the user
credential. For other projects which don't contain project_id in URL,
just get it from user credential to make the rule work properly.

Change-Id: I5979f2c5204e373cc4a84b1f6997845aabc891cb
2017-06-21 13:53:25 +12:00
Fei Long Wang 41593343a4 Open API to tenant users
Currently, only admin user can consume the billing REST
API which means tenant user can't monitor/audit their usage/cost
via API. This patch opens the API by making the project id as
optional for admin user and getting the project id from context
for non-admin user.

Change-Id: I497348dfae882892826ec8bcd2303195e4fe2b31
2017-06-20 12:10:33 +12:00
Van Hung Pham 8cefb6c4d6 Remove usage of parameter enforce_type
Oslo.config deprecated parameter enforce_type and change its
default value to True in Ifa552de0a994e40388cbc9f7dbaa55700ca276b0.
Remove the usage of it to avoid DeprecationWarning: "Using the
'enforce_type' argument is deprecated in version '4.0' and will be
removed in version '5.0': The argument enforce_type has changed its
default value to True and then will be removed completely."

Change-Id: I642a341e7532e4b0fdd0719c5cac6933842a4fa4
Related--Bug: #1517839
2017-06-19 15:47:43 +07:00
Fei Long Wang bf19284348 Add /credits API
Support /credits API so that project users can track their current
credit by API. And the credits info can be also shown on the
distil panel.

Change-Id: I5b44d8b05b551c5db3416c00b7caf472c3350be8
2017-06-19 16:55:33 +12:00
Van Hung Pham 4c3f070eeb Replace assertEquals with assertEqual
The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Also in Python 3, a deprecated warning is raised when using assertEquals
therefore we should use assertEqual instead.

Change-Id: I7410c0290403484aec621363661b9e12836a407a
2017-06-16 10:45:08 +07:00
Jenkins 1223668db8 Merge "Fix getting host name from instances" 2017-06-16 00:12:38 +00:00
Jenkins c4b9a6da40 Merge "Improve get_health API" 2017-06-15 23:59:16 +00:00
Jenkins a9179ef609 Merge "Add unit tests for api module" 2017-06-15 23:54:48 +00:00
Jenkins 6e2648020b Merge "Reword Readme" 2017-06-15 23:42:13 +00:00
Jenkins 62b46fd58f Merge "Replaces yaml.load() with yaml.safe_load()" 2017-06-15 22:52:58 +00:00