OpenNebula / one

The open source Cloud & Edge Computing Platform bringing real freedom to your Enterprise Cloud 🚀
http://opennebula.io
Apache License 2.0
1.19k stars 472 forks source link

Add disable action Hooks #5544

Open harsxv opened 2 years ago

harsxv commented 2 years ago

Description Onehook lock action didn't works.

To Reproduce

$ onehook show 171
HOOK 171 INFORMATION                                                            
ID                : 171                 
NAME              : HA_Host_Error       
TYPE              : state               
LOCK              : Use                 

EXECUTION LOG
   ID       TIMESTAMP    RC EXECUTION
   57     08/02 02:51     0 SUCCESS
... more and more
   74     09/12 11:36     0 SUCCESS
   75     09/21 13:34     0 SUCCESS             <-- last execution          

I need to set this hook didn't run, so I lock with this:

$ onehook lock 171 --use

Expected behavior Hooks shouldn't run, I guess.

   * lock <hookid>
        Locks a Hook with differents levels for lock any actions with this Hook,
        show and monitoring never will be locked.
        Valid states are: All.
        Levels:
        [Use]: locks Admin, Manage and Use actions.
        [Manage]: locks Manage and Use actions.
        [Admin]: locks only Admin actions.
        valid options: admin, all, manage, use

But this hooks triggered and run again.

$ onehook show 171
HOOK 171 INFORMATION                                                            
ID                : 171                 
NAME              : HA_Host_Error       
TYPE              : state               
LOCK              : Use                 

HOOK TEMPLATE                                                                   
ARGUMENTS="$TEMPLATE -m -p 0"
COMMAND="ft/host_error.rb"
NAME="HA_host_error"
REMOTE="NO"
RESOURCE="HOST"
STATE="ERROR"
TYPE="state"

EXECUTION LOG
   ID       TIMESTAMP    RC EXECUTION
   57     08/02 02:51     0 SUCCESS
... more and more
   75     09/21 13:34     0 SUCCESS 
   76     09/22 16:18     0 SUCCESS <-- triggered

Details

Progress Status

rsmontero commented 2 years ago

Hi @harsxv

This is the expected behavior, lock is to prevent you from accidentally deleting the hook. Maybe you are looking for a "disable" operations that suspends the execution of a hook.

It is probably a good idea I'll use this issue to implement this in a future release.

Cheers and thanks for the feedback

harsxv commented 2 years ago

This is the expected behavior, lock is to prevent you from accidentally deleting the hook. Maybe you are looking for a "disable" operations that suspends the execution of a hook.

Yes correct, I'm looking for a "disable" operations to suspends the hooks, instead delete it immidiately. I hope many feature will be released on a next future release. Thank for your response and fabulous work @rsmontero and team.