Raise ResourceActionNotSupported when clearing the hooks undefined

Bug #1472515 reported by huangtianhua on 2015-07-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
huangtianhua

Bug Description

1. create a stack set pre-create hook for a resource
2. to clear the hook pre-update(not pre-create), return null
   expected: raise a exception such as the resource has no the hook: pre-update to user
   actual: we can find Raise ResourceActionNotSupported: signal is not supported
           for resource in engine's log, but user do not know what happended
3. Also there are some checks for resource signal and raise exceptions if fail, but the exceptions are not show to user.

Changed in heat:
assignee: nobody → huangtianhua (huangtianhua)
description: updated
Changed in heat:
importance: Undecided → Medium
status: New → Triaged
Steve Baker (steve-stevebaker) wrote :

Could we also use this bug to handle the following situation?

Description of problem:
You can run the command "heat hook-clear" on any resource in the stack, even if there is no hook defined on it, and no error or warning message is returned.

How reproducible:
100%

Steps to Reproduce:
1. heat hook-clear --pre-create overcloud ControllerNodesPostDeployment
2. heat hook-clear --pre-create overcloud ControllerNodesPostDeployment

Actual results:
No error or warning

Expected results:
I should have gotten at least 1 error because I cleared the breakpoint twice. In this case, the breakpoint never existed in the first place so I was expecting 2 errors.

huangtianhua (huangtianhua) wrote :

Hi Steve Baker:
I'm planning move the checks including your mentioned to service.resource_signal.

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

Changed in heat:
status: Triaged → In Progress
Changed in heat:
milestone: none → liberty-3
Changed in heat:
milestone: liberty-3 → liberty-rc1

Reviewed: https://review.openstack.org/199918
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=18ded430d0e256ce5f9eec3ef61b5337596f914a
Submitter: Jenkins
Branch: master

commit 18ded430d0e256ce5f9eec3ef61b5337596f914a
Author: huangtianhua <email address hidden>
Date: Thu Jul 9 09:15:10 2015 +0800

    Return error message if validate fail when clearing hook

    There are some situations:
    1. User can run the command "heat hook-clear" on any
    resource in the stack, even if there is no hook
    defined on it, and no error or warning message is returned.
    2. User run the command "heat hook-clear" on resource
    to clear the hook which resource unset, and no error or
    warning message is returned.
    3. User run the command "heat hook-clear" on resource
    even if the resource's action is not support to signal, and
    no error or warning message is returned.
    4. User run the command "heat hook-clear" to clear invalid
    hooks, and no error or warnning message is returned.

    This patch will check the situations above before call
    resource.signal, and will return error messages to user.

    Change-Id: Ifb9befad864ebe1bb5f8b419b95d1b3a95530573
    Closes-Bug: #1472515

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2015-09-23
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2015-10-15
Changed in heat:
milestone: liberty-rc1 → 5.0.0

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

commit dcf2463f1f21ed6b011730eceb6977d1582c912f
Author: Zane Bitter <email address hidden>
Date: Fri Jul 7 18:44:13 2017 -0400

    Fix ResourceActionNotSupported errors in log

    In 37ef66970510972af54ce6835ec234f3e30a0a88 (in Kilo) we made signalling
    a resource asynchronous because things like e.g. scaling an autoscaling
    group were too slow to do synchronously (bug 1394095).

    However, for resources that don't have a handle_signal() method at all,
    this means that if a signal other than one handled by Heat (e.g. to
    clear a hook) is received then the user won't be notified of the error.
    There will instead be an error message in the logs warning of an
    unhandled exception in a thread.

    (Previously, similar problems occurred if the user was attempting to
    clear a hook and some error occurred. This has since been fixed as bug
    1472515, in Liberty.)

    If there's no handle_signal() method defined, then calling
    Resource.signal() is quick (i.e. it's only going to clear a hook, or
    raise an error). So handle this case synchronously. This ensures that
    any error is reported to the user and not in the log.

    Change-Id: I917b4c7d4ab2cde46148197a3a232d5dc70f63d7
    Related-Bug: #1472515

Reviewed: https://review.openstack.org/487653
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=d712b8c39634afc0e50fdb3f3672c0029815900d
Submitter: Jenkins
Branch: stable/ocata

commit d712b8c39634afc0e50fdb3f3672c0029815900d
Author: Zane Bitter <email address hidden>
Date: Fri Jul 7 18:44:13 2017 -0400

    Fix ResourceActionNotSupported errors in log

    In 37ef66970510972af54ce6835ec234f3e30a0a88 (in Kilo) we made signalling
    a resource asynchronous because things like e.g. scaling an autoscaling
    group were too slow to do synchronously (bug 1394095).

    However, for resources that don't have a handle_signal() method at all,
    this means that if a signal other than one handled by Heat (e.g. to
    clear a hook) is received then the user won't be notified of the error.
    There will instead be an error message in the logs warning of an
    unhandled exception in a thread.

    (Previously, similar problems occurred if the user was attempting to
    clear a hook and some error occurred. This has since been fixed as bug
    1472515, in Liberty.)

    If there's no handle_signal() method defined, then calling
    Resource.signal() is quick (i.e. it's only going to clear a hook, or
    raise an error). So handle this case synchronously. This ensures that
    any error is reported to the user and not in the log.

    Change-Id: I917b4c7d4ab2cde46148197a3a232d5dc70f63d7
    Related-Bug: #1472515
    (cherry picked from commit dcf2463f1f21ed6b011730eceb6977d1582c912f)

tags: added: in-stable-ocata
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers