Wrong default arguments are passed to Monasca Alarm definition resource

Bug #1587778 reported by Sirushti Murugesan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Sirushti Murugesan

Bug Description

While creating a Monasca Alarm Definition resource via Heat using the template https://github.com/openstack/heat-templates/blob/master/hot/monasca/autoscaling.yaml , the following error is thrown. This is because, according to https://github.com/openstack/monasca-api/blob/master/docs/monasca-api-spec.md#create-alarm-definition, the API only accepts lists and not a NoneType.

HTTP/1.1 422 Unprocessable Entity
Server: gunicorn/19.5.0
Date: Tue, 24 May 2016 06:36:49 GMT
Connection: keep-alive
content-type: application/json; charset=UTF-8
content-length: 144
vary: Accept

{
    "title": "Unprocessable Entity",
    "description": "Not a list: <type 'NoneType'> for dictionary value @ data[u'undetermined_actions']"
}
 from (pid=27629) log_http_response /usr/local/lib/python2.7/dist-packages/monascaclient/common/http.py:168
2016-05-24 06:36:49.103 ERROR monascaclient.exc [req-eb508451-c162-49e8-93c8-9a2dc113e02e None mini-mon] exception: {
    "title": "Unprocessable Entity",
    "description": "Not a list: <type 'NoneType'> for dictionary value @ data[u'undetermined_actions']"
}
2016-05-24 06:36:49.104 INFO heat.engine.resource [req-eb508451-c162-49e8-93c8-9a2dc113e02e None mini-mon] CREATE: MonascaAlarmDefinition "cpu_alarm_low" Stack "kk" [f728bdd1-050a-4d5a-a462-a01bf73574df]
2016-05-24 06:36:49.104 TRACE heat.engine.resource Traceback (most recent call last):
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/opt/stack/new/heat/heat/engine/resource.py", line 701, in _action_recorder
2016-05-24 06:36:49.104 TRACE heat.engine.resource yield
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/opt/stack/new/heat/heat/engine/resource.py", line 773, in _do_action
2016-05-24 06:36:49.104 TRACE heat.engine.resource yield self.action_handler_task(action, args=handler_args)
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/opt/stack/new/heat/heat/engine/scheduler.py", line 297, in wrapper
2016-05-24 06:36:49.104 TRACE heat.engine.resource step = next(subtask)
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/opt/stack/new/heat/heat/engine/resource.py", line 744, in action_handler_task
2016-05-24 06:36:49.104 TRACE heat.engine.resource handler_data = handler(*args)
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/opt/stack/new/heat/heat/engine/resources/openstack/monasca/alarm_definition.py", line 152, in handle_create
2016-05-24 06:36:49.104 TRACE heat.engine.resource alarm = self.client().alarm_definitions.create(**args)
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/monascaclient/v2_0/alarm_definitions.py", line 36, in create
2016-05-24 06:36:49.104 TRACE heat.engine.resource headers=newheaders)
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/monascaclient/common/http.py", line 301, in json_request
2016-05-24 06:36:49.104 TRACE heat.engine.resource resp = self._http_request(url, method, **kwargs)
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/monascaclient/common/http.py", line 226, in _http_request
2016-05-24 06:36:49.104 TRACE heat.engine.resource self._check_status_code(resp, method, **kwargs)
2016-05-24 06:36:49.104 TRACE heat.engine.resource File "/usr/local/lib/python2.7/dist-packages/monascaclient/common/http.py", line 239, in _check_status_code
2016-05-24 06:36:49.104 TRACE heat.engine.resource raise exc.from_response(resp)
2016-05-24 06:36:49.104 TRACE heat.engine.resource HTTPUnProcessable: Not a list: <type 'NoneType'> for dictionary value @ data[u'undetermined_actions']
2016-05-24 06:36:49.104 TRACE heat.engine.resource
2016-05-24 06:36:49.161 INFO heat.engine.stack [req-eb508451-c162-49e8-93c8-9a2dc113e02e None mini-mon] Stack CREATE FAILED (kk): Resource CREATE failed: HTTPUnProcessable: resources.cpu_alarm_high: Not a list: <type 'NoneType'> for dictionary value @ data[u'undetermined_actions']

Changed in heat:
assignee: nobody → Sirushti Murugesan (sirushtim)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/325146

Changed in heat:
status: New → In Progress
Changed in heat:
importance: Undecided → Medium
milestone: none → newton-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/325146
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=2195998d0708832f87dd560b84844de1c3b04551
Submitter: Jenkins
Branch: master

commit 2195998d0708832f87dd560b84844de1c3b04551
Author: Sirushti Murugesan <email address hidden>
Date: Fri Jun 3 14:06:21 2016 +0530

    Monasca: Don't pass keyword arguments of value None

    Monasca's API throws an unprocessable Entity error when None is passed as a
    value for any key in the list of arguments. This patch adds default arguments
    of an empty list to all the properties of type LIST before passing it on to the
    Monasca API.

    Change-Id: Ia6938585061fafbc6aca6a61ca1ca5b4f02198bb
    Closes-Bug: #1587778

Changed in heat:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/heat 7.0.0.0b2

This issue was fixed in the openstack/heat 7.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.