OS::Monasca::Notification is broken in Heat Newton

Bug #1646633 reported by Franciraldo Cavalcante
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Rabi Mishra
Newton
Fix Committed
Undecided
Rabi Mishra

Bug Description

Trying to create a Heat/Newton stack that uses OS::Monasca::Notification, I receive the error message:

{
    "code": 400,
    "error": {
        "message": "Address \"\" doesn't have required URL scheme",
        "traceback": null,
        "type": "StackValidationFailed"
    },
    "explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.",
    "title": "Bad Request"
}

This used to work on Heat/Mitaka.

I could track where the Heat server is making this validation, and it complains that the address string passed to OS::Monasca::Notification is empty. Well, this will be the case when you define the notification as an OS::Heat::ScalingPolicy, if you're trying to use Monasca alarms to autoscale! On Validation scope this string will be empty.

This commit introduced the problematic validation:
https://github.com/openstack/heat/commit/e3cc29c4e20bcbfc5597ace7b17fce924b6c6801

Here is an excerpt of how we're using OS::Monasca::Notification:
...
  scale_up_policy:
    type: OS::Heat::ScalingPolicy
    properties:
      adjustment_type: change_in_capacity
      auto_scaling_group_id: { get_resource: group }
      cooldown: 60
      scaling_adjustment: 1

  scale_down_policy:
    type: OS::Heat::ScalingPolicy
    properties:
      adjustment_type: change_in_capacity
      auto_scaling_group_id: { get_resource: group }
      cooldown: 60
      scaling_adjustment: -1

  # -- Monasca --
  up_notification:
    type: OS::Monasca::Notification
    properties:
      type: webhook
      address: {get_attr: [scale_up_policy, alarm_url]}

  down_notification:
    type: OS::Monasca::Notification
    properties:
      type: webhook
      address: {get_attr: [scale_down_policy, alarm_url]}
...

Revision history for this message
Franciraldo Cavalcante (c-franciraldo-cavalcante) wrote :

A complete Heat template example that would display the problems with this validation method can be found here:
https://github.com/openstack/heat-templates/blob/master/hot/monasca/autoscaling.yaml

Revision history for this message
Rabi Mishra (rabi) wrote :

Yeah, we did not take care of the case of using get_attr when adding those validations. We end up with these validation issues, when adding more and more validations. I've pushed a adhoc fix for it. We plan to avoid these issues with validation place holders in the future and we're working on it.

Changed in heat:
importance: Undecided → Medium
Rabi Mishra (rabi)
Changed in heat:
milestone: none → ocata-2
assignee: nobody → Rabi Mishra (rabi)
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/405821

Changed in heat:
status: New → In Progress
Revision history for this message
Franciraldo Cavalcante (c-franciraldo-cavalcante) wrote :

Hi Rabi, thanks for looking into this issue. your fix is what we need. But we need it back ported to Newton.

Revision history for this message
Rabi Mishra (rabi) wrote :

Yeah, the fix can be backported once it lands on master.

tags: added: newton-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/405821
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=636b6c73b4d7c16ffe3806e8605aeb58790afde7
Submitter: Jenkins
Branch: master

commit 636b6c73b4d7c16ffe3806e8605aeb58790afde7
Author: rabi <email address hidden>
Date: Fri Dec 2 09:35:40 2016 +0530

    Don't validate address when using get_attr

    We added bunch of validations for address property of monasca
    notification resource. However, this would not work when we
    use 'get_attr' with another resource(yet to be created), that
    returns None.

    Change-Id: Ic457ce343916e6a664dcfb497b42eaf47036b8b3
    Closes-Bug: #1646633

Changed in heat:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/407366

Rabi Mishra (rabi)
tags: removed: newton-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (stable/newton)

Reviewed: https://review.openstack.org/407366
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=509976b5889f2edb2ddfb499668dd7bc155969b3
Submitter: Jenkins
Branch: stable/newton

commit 509976b5889f2edb2ddfb499668dd7bc155969b3
Author: rabi <email address hidden>
Date: Fri Dec 2 09:35:40 2016 +0530

    Don't validate address when using get_attr

    We added bunch of validations for address property of monasca
    notification resource. However, this would not work when we
    use 'get_attr' with another resource(yet to be created), that
    returns None.

    Change-Id: Ic457ce343916e6a664dcfb497b42eaf47036b8b3
    Closes-Bug: #1646633
    (cherry picked from commit 636b6c73b4d7c16ffe3806e8605aeb58790afde7)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 8.0.0.0b2

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 7.0.2

This issue was fixed in the openstack/heat 7.0.2 release.

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.