When a untranslated error message pass through the translation pecan
hook, the previous translated error is send to the client.
This patch fix that by reseting the "translatable_error" of the
translation pecan hook before each request.
Change-Id: Icee79cf09fd696655048c7c0cf8a3d6706e31701
Fixes: bug #1260398
This is a simple implementation of the new sample endpoint in the API.
It provides raw accesses to the samples collected by Ceilometer, without
imposing any kind of filtering on the meter name.
The fields are also correctly named this time.
Change-Id: I9e01a082c04e0462811befd98899e2f2d4a4dc82
Blueprint: sample-api
Refactor the API error handling to ensure error messages are translated.
Since wsme 0.5b6, the error message doesn't need to be converted to
unicode, wsme handles it for us.
Related bug #1200518
Change-Id: Iec396f045cd3afe817301f0d00917c42c7587b55
We inherit from wsme.esc.ClientSideError to handle unicode string in
error message.
Fixes bug #1200518
Change-Id: I54a185a436b0a65bef13f303d7e31911cada76d8
Add body parameter in PUT/POST alarm method.
Add boundary to the BoundedInt doc name.
Remove no more existing alarm_id in put/get_one wsexpose method.
Use state wsme enum instead of unicode string for alarm state get/put
even wsme validation won't work to have the documentation generated
correctly.
Update sphinxcontrib-pecanwsme to generate the documentation of get, put
and custom pecan method.
Change-Id: I9587f3d640cc768a3d788542d2af138411dcee60
This makes use of the mandatory option of WSME, that now works, to
remove some of our custom validation code. This is needed for new
versions of WSME that do more validation on their own.
Fixes-Bug: #1240741
Change-Id: Icb66d17066b515bebf3f3a326d84e18cbfce01ef
Signed-off-by: Julien Danjou <julien@danjou.info>
Previously when an admin created a combination alarm on
behalf of an non-admin identity, this had the effect of leaking
visibility onto alarms that would not normally
be visible to the non-admin tenant.
Now we validate all alarm ids with the project ID of the non-admin
identity that will ultimately own the alarm instead of the project ID
of the API caller.
Fixes bug #1237632
Change-Id: I5d1cf41c9182f09bc37b93deb14dda58f1d6dcd6
Fixes bug 1237567
Previously when an admin created a threshold-oriented alarm on
behalf of an non-admin identity, this had the effect of leaking
visibility onto statistics for resources that would not normally
be visible to the non-admin tenant.
Now we ensure that an additional implicit threshold rule query
constraint is added on the project ID of the non-admin indentity
that will ultimately own the alarm.
This is acheived by splitting the query validation from the
construction of the kwargs from the query. The addition of the
implicit query constraint to the threshold rule can then be
delayed to a later point in the dispatch path where the full
context of the alarm is known (so that we can check for the case
where the alarm is created by an admin on behalf of another tenant).
Change-Id: I1adae8c899112e7c3eb4e94f3f68262c84a98574
- We do return samples with their id.
- This header is not complete nor true, and does not serve anything
nowadays.
Change-Id: I4b797887fb9ae63b10d67e9b22a5b4d30d7bd829
When a user is not authorized to access to something is the API,
this one return 401 instead of 400 now.
Fixes bug #1232045
Change-Id: I7ef8ed1f7cd40a845bcf860561c2cb7da52fb9e9
This also checks for the error message that is returned, and fixes a
problem with the error encoding middleware that was doing double JSON
encoding.
Change-Id: Ieb39a991ddc9ecba0a7e71450a1e57ede18ccbe6
Fixes-Bug: #1218760
Fixes-Bug: #1208552
This change allow to get a disabled alarm.
To do this, it:
* add the ability to query the alarm-list API with the 'enabled' fields.
* change the default visibility of alarm-list API from enabled only to all.
Fixes bug #1231328
Change-Id: I80cd691696f7630d2ac9e9b2a69b5b0ae5ee7968
This patch add a new endpoint to the alarm API to change only the state
of an alarm. And modifies the evaluator base to use this new endpoint.
Implements blueprint alarming-logical-combination
Change-Id: I8bff74f0686ba17103ee63bcbdb0830c8273596f
This change add a new type of alarm in the API for creating
alarm that combine the state of other alarms.
Implements blueprint alarming-logical-combination
Change-Id: I3203ae6143f5e21b5160a9a04692e7a4c8e550b8
Just like Sample model, we should also add source field to
Meter model to identify where the meter comes from.
Change-Id: I2381d67f84692bfc7d167c2b0d90bfa32b845f00
Fixes: Bug #1225583
This updates the alarm API to match the latest discussion:
https://wiki.openstack.org/wiki/Ceilometer/blueprints/alarm-api
It allows creation of different kinds of alarm.
The current kind of alarm has been named 'threshold'.
It move the defaults values from the storage models to the API
with all tools provided by wsme to ensure mandatory field and default.
A behavior change, it is now mandatory to PUT a full alarm description
in a PUT call.
In the future a new endpoint can be added to allow to modify only one
field (example for state: /v2/alarms/<id>/state)
Implements blueprint alarming-logical-combination
Change-Id: Ib85636728d427cdb70ef530ff9ff20d2b75c5ed1
- fix tests to accept new (accurate) response codes
- wsme doesn't like us sending gettextutils.Message values. pass in
a regular string
Change-Id: Ie9e05edfd542ba1fe8c6fdbeed2daab12cf30caf
Fixes:Bug #1227264
add test case for _query_to_kwargs function in v2 api.
raise InvalidInput on invalid operator
Change-Id: Ia9e9b3905327d21e3c6f91aa0acd36f19f4f59b0
Partial-Bug: #1217129
Improve the error handling of the type-guesser for queries
against metadata fields, and add some test coverage for
specific cases that came out of the discussion of the
source of the bug.
Fixes bug #1221736
Change-Id: I27f84aa2538d2a69a3d7b7e93c36813df8d35204
Implements blueprint api-group-by
Add group by statistics in API v2 and group by statistics tests in
API v2 tests as a new class TestGroupByInstance
The tests use the same data and test cases as the groupby storage
tests in class StatisticsGroupByTest
The tests implemented are group by
1) single field, "user-id"
2) single field, "resource-id"
3) single field, "project-id"
4) single field, "source" (*)
5) single field with invalid/unknown field value
6) multiple fields
7) single field groupby with query filter
8) multiple field group by with multiple query filters
9) single field with start timestamp after all samples
10) single field with end timestamp before all samples
11) single field with start timestamp
12) single field with end timestamp
13) single field with start and end timestamps
14) single field with start and end timestamps and query filter
15) single field with start and end timestamps and period
16) single field with start and end timestamps, query filter, and period
(*) Group by source isn't supported in SQLAlchemy at this time, so
we have to put this test in its own class TestGroupBySource
Group by metadata fields is not implemented at this time.
Also adds a method _validate_groupby_fields() to process the groupby
part of the request, and tests for _validate_groupby_fields().
Change-Id: Ibce1978cfdf70ab068af43a548241546a85bd464
Allow alarm history retrieval to be constrained by
user, project, change type or timestamp.
Partially implements bp alarm-audit-api
Change-Id: Iba303b422a2893ed63375c79d9dc4b93711cf215
We already have a really poor naming convention the metering API, and we
decided to remove the counter term from everywhere. We can't fix the
metering API since we relesed it, so let's fix the alarming one before
it gets released and we have to handle a lot of complicated
compatibility. :-(
Change-Id: I3e3219d2eae0b72ad4a898630cacfd334e9390cc
The database model of Meter does not have a unique key while
Resource has resource_id and Alarm has alarm_id. This key
can be used to identify a meter object by one single value.
The value of meter_id is the combination of resource_id and
couneter_name with base64 encoding. The mainly useage of this
key is pagination query.
It is part of bp/paginate-db-search.
Implements blueprint paginate-db-search
Change-Id: I602d0a370921dcfb02b5bc17c909937c35874e23
The alarm scenario tests provide forward-looking coverage
which will be run as the storage backends' support for alarm
history lands.
A new config option alarm.record_history (defaulting to True)
guards the recording of alarm history.
Partially implements bp alarm-audit-api
Change-Id: I0c3bc348c86c7dc645cde3029a6fa76f9f767c37