summaryrefslogtreecommitdiff
path: root/ceilometerclient/common
Commit message (Collapse)AuthorAgeFilesLines
* remove py24 compatible codeZhiQiang Fan2016-01-081-7/+0
| | | | Change-Id: If62986b3ba913776ee6b9328a10e358e0e14e7cd
* Merge "Catch missing 404 exceptions in client"Jenkins2015-06-031-1/+5
|\
| * Catch missing 404 exceptions in clientJuan Antonio Osorio Robles2015-05-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever an entity wasn't found, the ceilometerclient would issue a NotFound exception. Which is fine, except that it's not the exception that was being expected in the client at all. This exception was defined in the apiclient in the openstack/common directory. So, instead this exception is now being caught in the manager, and now the appropriate exception is being raised. There were some functions where, if the entity was not to be found, a 404 exception would be raised, which was never caught by the client since it was expecting the function to return None, instead of raising. This CR fixes that. Closes-Bug: #1451833 Change-Id: I47b34af2df9c85f86ba1f7f4d7b2951f8d27f96c
* | Drop use of 'oslo' namespace packageDoug Hellmann2015-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Oslo libraries have moved all of their code out of the 'oslo' namespace package into per-library packages. The namespace package was retained during kilo for backwards compatibility, but will be removed by the liberty-2 milestone. This change removes the use of the namespace package, replacing it with the new package names. The patches in the libraries will be put on hold until application patches have landed, or L2, whichever comes first. At that point, new versions of the libraries without namespace packages will be released as a major version update. Please merge this patch, or an equivalent, before L2 to avoid problems with those library releases. Blueprint: remove-namespace-packages https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages Change-Id: I1f539cf9f5d6f48e10cac381c13eeb5fa314abd4
* | Use oslo_utils instead of deprecated oslo.utilsDina Belova2015-05-111-2/+2
|/ | | | Change-Id: Ie4c55f33d18294924701032031cf78539ee3b23b
* Support unicode for alarmZhiQiang Fan2015-02-061-2/+2
| | | | | | | | | | | | | | We're using ceilometer.common.utils.print_dict() for displaying alarm, but assume only contain ascii characters, which will cause UnicodeEncodeError when alarm's name or description has unicode characters. The oslo-incubator.cliutils.print_dict() is more friendly to unicode, but it has no sort option, and has different line wrap strategy. Since the upstream improvement can be low progress, this patch adds unicode support based on current code. Change-Id: Ia58d5813c6f80cb8b44bf7636e1efc0cdd6e6d5b Closes-Bug: #1412300
* Add Sample API supportZhiQiang Fan2015-02-051-1/+2
| | | | | | | | | | Sample API has been implemented in Ceilometer for a long time, but CLI is lack of such support, this patch implements Sample CLI. Implements blueprint cli-samples-api Change-Id: I67152c636526dad3ec27e06058ff73ad969ae2b9 DocImpact
* Allow all pep8 checksDina Belova2015-01-122-7/+12
| | | | | | | Fix H405 pep8 issue. H904 issue check was ignored, although there were no places in client code violating this rule. Change-Id: If3b84eb8abb03511d7f77cabfa2955f472a60f23
* Add client property for common.base.ManagerZhiQiang Fan2014-12-191-0/+5
| | | | | | | | | | The latest oslo-incubator.apiclient code assumes resource manager has property named client, but ceilometerclient has named that property to api, which will cause problem when we sync with oslo-incubator. This patch simply uses client as an alias of api. Change-Id: I90c5ff10309ff7ad3fb634274e16c26ec8e6a1a2
* Alarm TimeConstraint display incorrectRohit Jaiswal2014-11-251-4/+6
| | | | | | | Added test case for print_dict function Change-Id: I3ab8a4e25f946b409ede2a598a5b9cf8593a044e Closes-Bug: #1395110
* switch to oslo.utilsgordon chung2014-09-291-12/+11
| | | | | | | oslo.utils is released and corresponding code in oslo-incubator has been removed. Change-Id: Ic3a13380809a8b00c979e5ac405b4084f486a31d
* Verify alarm found before modifyingEric Pendergrass2014-08-291-1/+5
| | | | | | | | | | | | | | | | | | | Current behavior is to retrieve alarm by id and conduct operations on the object. If the tenant doesn't own the alarm or isn't admin, the user will receive the message: 'NoneType' object has no attribute 'to_dict' Above message doesn't provide any useful diagnostic information and indicates a programming error since an unexpected None-type is encountered and not handled. This change verifies the alarm is found before using the object. If alarm not found it prints the same message for a not found Alarm as other PUT operations like alarm-state-set: Alarm not found: <alarm_id>. This message is more useful for diagnosis and gets rid of the uncaught None-type error. Change-Id: I66abcd4498b24ac7cadcf29fe3ced3fcda08458c Closes-Bug: #1348387
* Use HTTPClient from common Oslo codeekudryashova2014-07-312-317/+4
| | | | | | | | | In the process of unification of the clients code we should reuse common functionality from Oslo. bp common-client-library-2 Change-Id: I0e027c33ee42b6de032d33269caeea33e7837f40
* Don't expose X-Auth-Token in ceilometer CLIZhi Kun Liu2014-07-181-1/+13
| | | | | | | | | | | Ceilometer CLI exposes X-Auth-Token in debug mode. This patch replaces X-Auth-Token's value with '{SHA1}<sha1oftoken>'. Some credentials are exposed by keystoneclient as ceilometerclient uses keystoneclient to authenticate, it will be fixed in bug: 100414. Change-Id: Ia6364314e4b4d26301f974582c0c2ba34b054c86 Partial-Bug: #1327019
* Fix hacking rules: H302,H305,H307,H402ZhiQiang Fan2014-06-112-5/+6
| | | | | | | | | | Currently, OpenStack Proposal Bot tries to update requirements with global requirements, while the upgraded hacking has introduced some new rules which are not fully handled by current code. This patch fixes some simple rules which are quite straight-forward. Change-Id: If8334f69fb1ad34fbbd6ad898e0e92eb3f81e95a
* Merge "fixed several pep8 issues"Jenkins2014-05-291-1/+1
|\
| * fixed several pep8 issuesChristian Berendt2014-05-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | * E122 continuation line missing indentation or outdented * E126 continuation line over-indented for hanging indent * E128 continuation line under-indented for visual indent * E265 block comment should start with '# ' Tested with pep8 version 1.5.6 (2014-04-14). Change-Id: Iaea72c74d3678061b0ac837eb8fe8c85a883bb4a
* | Fix exception handling of CLIliu-sheng2014-05-231-3/+3
|/ | | | | | | | | | | Because exc.Unauthorized exception has been removed for commit "Remove out-dated exceptions"(https://review.openstack.org/#/c/93852/). but it still in use in ceilometerclient.shell.CeilometerShell#main(). This patch replace exc.Unauthorized with exc.HTTPUnauthorized. And other three places of exc.NotFound are in use too. Change-Id: I3e010db20cb6f6636126cceed5c62a9817213739 Closes-bug: #1321649
* Adds alarm time constraint support to ceilometer CLIUros Jovanovic2014-03-261-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time constraints can be specified for create and update families of commands with the following format: --time-constraint name=constraint1;start='0 11 * * *';duration=300 This switch can be specified multiple times in the case of multiple time constraints. With update commands, time constraints are updated by name, e.g. --time-constraint name=constraint1;duration=500 updates the constraint 'constraint1' with a new duration 500. Time constraints can be removed with update commands using the switch --remove-time-constraint=constraint1,constraint2 . Example of display outputs: > ceilometer alarm-list +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ | Alarm ID | Name | State | Enabled | Continuous | Alarm condition | Time constraints | +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ | 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 | test2 | insufficient data | True | False | cpu == 50.0 during 1 x 60s | cons1 at 0 11 * * * for 300s, cons2 at 0 23 * * * for 600s | +--------------------------------------+-------+-------------------+---------+------------+----------------------------+--------------------------------------------------------------+ > ceilometer alarm-show -a +---------------------------+-----------------------------------------------------------------------+ | Property | Value | +---------------------------+-----------------------------------------------------------------------+ | alarm_actions | [] | | alarm_id | 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 | | comparison_operator | eq | | description | Alarm when cpu is eq a avg of 50.0 over 60 seconds | | enabled | True | | evaluation_periods | 1 | | exclude_outliers | False | | insufficient_data_actions | [] | | meter_name | cpu | | name | test2 | | ok_actions | [] | | period | 60 | | project_id | 962f75ad22c24cbf99d40d7b82718505 | | query | | | repeat_actions | False | | state | insufficient data | | statistic | avg | | threshold | 50.0 | | time_constraints | [{name: cons1, | | | description: Time constraint at 0 11 * * * lasting for 300 seconds, | | | start: 0 11 * * *, | | | duration: 300}, | | | {name: cons2, | | | description: Time constraint at 0 23 * * * lasting for 600 seconds, | | | start: 0 23 * * *, | | | duration: 600}] | | type | threshold | | user_id | 76f335df8e2f4c7e9e8185e26ea85759 | +---------------------------+-----------------------------------------------------------------------+ > ceilometer alarm-history -a 2ead776d-2fc7-47a2-b0bb-0f88dcefa457 +----------+----------------------------+--------------------------------------------------------------------------------+ | Type | Timestamp | Detail | +----------+----------------------------+--------------------------------------------------------------------------------+ | creation | 2014-03-06T07:41:35.362050 | name: test2 | | | | description: Alarm when cpu is eq a avg of 50.0 over 60 seconds | | | | type: threshold | | | | rule: cpu == 50.0 during 1 x 60s | | | | time_constraints: cons1 at 0 11 * * * for 300s, cons2 at 0 23 * * * for 600s | +----------+----------------------------+--------------------------------------------------------------------------------+ Change-Id: I3953276537b4526e46e5e6d229d6fa154f8ab0fc Closes-Bug: #1288246
* py3kcompat: remove in python-ceilometerclientJia Dong2014-02-211-4/+4
| | | | | | | | | Everything is already in six>=1.4.0 and we already depend on such a version. There's no reason to keep this file. So remove py3kcompat from python-ceilometerclient. Change-Id: Ide6876e7a60377cb3843816d1d9ab2c589bc8f1b Closes-Bug: #1280033
* Ensure url sent to proxy don't have redundant /Mehdi Abaakouk2014-02-131-1/+2
| | | | | | | | | | | When a proxy is set, the url requested to the proxy have a double // after the domain, but for ceilometer this kind of url is not valid. So, this patch ensures the url have only one / Closes-bug: #1274981 Change-Id: Id6fc5cf7ab7a3866bc23af7102785a9cede593fe
* Python 3: fix format_nested_list_of_dict()Cyril Roelandt2014-02-101-1/+1
| | | | | | | | In this function, we mean to add actual values, not a map object. In Python 2, map() did not return a map object, so this worked as expected, but not in Python3. Change-Id: Icc6467b7846d62c189765fdfd9dce1e30db7eb55
* Merge "Update client to display data type of traits"Jenkins2014-01-281-6/+8
|\
| * Update client to display data type of traitsJohn Herndon2014-01-241-6/+8
| | | | | | | | | | | | fixes bug 1268032 Change-Id: I47dfd3208fb3f7e5e5e2b33bd9b00c688d8283cd
* | Using common methods from oslo cliutilsJia Dong2014-01-241-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | There are some common methods in cliutils we can use in ceilometerclient: arg, env, unauthenticated, isunauthenticated. + Replaces utils.env to add alias env from cliutils. + Removes unused methods in utils: env To use methods from clituils. partially implements blueprint common-client-library-2 Change-Id: I295cc80635ed15c91e2832acb315e9deede09516
* | Using common method 'bool_from_string' from oslo strutilsllg82122014-01-221-4/+0
|/ | | | | | | | | Using common method 'bool_from_string' from oslo strutils to replace utils.string_to_bool. partially implements blueprint common-client-library-2 Change-Id: I101eb89174ac229aa1025bc4aea8b1c0c5594705
* Support the Event APIJohn Herndon2014-01-101-0/+15
| | | | | | | | | | | | This patch adds support for the currently available Event API, including events, event types, and traits. Add an optional data type to the query, ex: ceilometer list-events -q 'hostname=string::localhost" bp extend-client-operations Change-Id: Icea9bd67f8ee4ff2bf9da9ff6894218689580eb3
* Merge "Use Resource() class from common Oslo code"Jenkins2014-01-101-51/+2
|\
| * Use Resource() class from common Oslo codeekudryashova2014-01-081-51/+2
| | | | | | | | | | | | | | | | In the process of unification of the clients code we should reuse common functionality from Oslo. Resource() class from ceilometer duplicates Oslo funclionality, so we replace it with inheritance Change-Id: I4e4b83252cdc87e8484d15e351cd5dab08f3ed8a
* | Fix the ceilometerlient log curl request incorrectlyls11752013-12-201-1/+1
|/ | | | | | | | | | | | Have installed ceilometer on Ubuntu 12.04 (LTS) and added the keystone endpoint with the url (publicurl,internalurl and adminurl)like:http://192.168.83.7:8777/refer to the "OpenStack Installation Guide for Ubuntu 12.04 (LTS)". When using "ceilometer --debug meter-list",the ceilometerclient log request url with a double slash after 8777. Change-Id: I467704b1fe1d38fe0f0e928bd6f6efe3d8925845 Closes-bug: #1262498
* Python 3: use six.moves.zip() rather than itertools.izip()Cyril Roelandt2013-12-191-2/+1
| | | | | | This ensures compatibility with both Python 2 and Python 3. Change-Id: Id9838b7517f939e5ee3e3a8c37ae5ec2e9b1d18b
* Display message on HTTP 400Thomas Herve2013-12-161-1/+1
| | | | | | | | This patch parses the faultstring given by the server on 400 errors if available. Change-Id: Ieae2f0b39fed2c45f276d6c931bebfebab9f696e Closes-Bug: bug #1260394
* Merge "Add HTTP proxy support to ceilometer client"1.0.8Jenkins2013-12-021-3/+21
|\
| * Add HTTP proxy support to ceilometer clientIlya Tyaptin2013-11-281-3/+21
| | | | | | | | | | | | | | | | | | | | There is a need for HTTP Proxy support in Ceilometer client It's used in the case when Ceilometer API is not directly available Proxy url is taken from environment variables http_proxy or https_proxy Implements: blueprint proxy-support Change-Id: I839d704a7fa16521292205166d7cbea56497842b
* | Enable pep8 E711/E712/E721/H302 checkingLianhao Lu2013-11-221-4/+3
|/ | | | Change-Id: I229f1c15b46284fae94d4c786765baa18da0055f
* Ceilometer UnicodeEncodeError when update or show alarm fixChenZheng2013-10-301-0/+3
| | | | | | | | | | Fix display bug in ceilometer alarm-update ceilometer alarm-show when encounter a alarm with not unicode attributes. Change-Id: I0af0f1d6b8393c7117eb5b56fba3d5e1f4935ff1 Closes-bug: #1245317
* Fix order of sample listfujioka yuuichi2013-10-281-13/+15
| | | | | | | | | | | Samples of "ceilometer sample-list" are sorted by Resource ID and Volume. Expected order is Timestamp. This pache fixes this problem. Change-Id: I338014e5868b2176a3afd549e13d0dd6118b3ac1 Closes-Bug: #1227495
* Fix cacert argument to HTTPS connectionKieran Spear2013-10-241-1/+1
| | | | | | | | | | This fixes a typo that broke the client for HTTPS URLs. Added a basic test to cover this case. Coverage is very low in common/http.py. Change-Id: Ic440f20f463c3b8558a7639f1015096a01496cf8 Closes-bug: 1244091
* align the order of parameters for urlencode()Kui Shi2013-10-151-1/+1
| | | | | | | | | | | | | | | | | In Python 3.3, hash randomization is enabled by default. It causes the iteration order of dicts and sets to be unpredictable and differ across Python runs. In the test case, the fixed expecting string will not match the test result, it is relying on the dict order. This change transforms the input dict to a sequence of two-element list, with fixed order, and update the related expecitng string / fixture in test cases. Partial Implement: blueprint py33-support Change-Id: I6dccde9e584be8335a6375f5fbad5c5cbd7b9b6d
* replace basetring/xrangeKui Shi2013-10-141-1/+1
| | | | | | | | | basetring --> six.string_types xrange --> six.moves.xrange Partial Implement: blueprint py33-support Change-Id: Iedc2cd66ec65c0e4685e56a3bfbf8e9d38fd0072
* replace dict.keys() with list(dict)Kui Shi2013-10-141-1/+1
| | | | | | Partial Implement: blueprint py33-support Change-Id: I774e5a25d25ef19ffc217910987f2c9b68d13cd3
* Use six.iteritems() for dictKui Shi2013-10-142-3/+5
| | | | | | | | | Fix the error: AttributeError: 'dict' object has no attribute 'iteritems' Partial Implement: blueprint py33-support Change-Id: I5dff17d1df01d6583f882f818434804d65726c51
* Translate print statement to print functionKui Shi2013-10-141-3/+4
| | | | | | | | | Use "from __future__ import print_function" docs.python.org/3/howto/pyporting.html#from-future-import-print-function Partial Implement: blueprint py33-support Change-Id: I92fc07257851795a9972c8273d3278c8679d6628
* Fix module importing issues for Python 3Kui Shi2013-10-141-10/+6
| | | | | | | | | Copy py3kcompat from oslo for urlparse Substitute StringIO / httplib with six Partial Implement: blueprint py33-support Change-Id: Ic8da2ca53b4217ef13f15be094437f1f4e643001
* Merge "Added support to --os-cacert"Jenkins2013-10-031-8/+8
|\
| * Added support to --os-cacertStefano Zilli2013-10-011-8/+8
| | | | | | | | | | | | Closes-Bug: #1224343 Change-Id: Ib0549d4496c47900c81cc970b99bcff25cad0040
* | Allow to update an alarm partiallyMehdi Abaakouk2013-10-011-0/+9
|/ | | | | | | | | | | | | The patch allow to only modify a part of an alarm instead of force to set the full alarm description. This permit to an application that have been written code around alarm with ceilometerclient 1.0.4 and ceilometer pre havana-3. To update alarm without any change with this and ceilometer >= havana-3 (ie: heat). Fixes bug #1231303 Change-Id: I20250131d05d20bfadbca450dfe6b8237f4b7183
* Help messages: specify which options are requiredCyril Roelandt2013-09-251-0/+7
| | | | | | Closes-Bug: #1223283 Change-Id: I080fa73bd45a1f9f442dbcdfa65fdc24e30521da
* Improve the CM shell client alarm visualisationMehdi Abaakouk2013-09-251-2/+4
| | | | | | | | | | | | | | | | | | | This change aim to get a better alarm representation in shell. In alarm-list: * it add a short sentence to describe the alarm rule * it remove project_id/user_id because it always show the same id for all alarm for end-user In alarm-show, it show alarm rule attributes as alarm properties instead of a unparsable json in the rule property. example of short sentence for column 'Alarm condition': * combinated states (AND) of 8babd6a2-c457-42d0-9eb5-cdfb3cb50203, d0e11a94-8f59-48a9-8f6d-b0d68aaac8d0 * cpu_util >= 50.0 during 1 x 60s Change-Id: If4df2dc08f9f4cb7796fd98308c7d62e311d1138
* Merge "Replace OpenStack LLC with OpenStack Foundation"Jenkins2013-09-233-3/+3
|\