[CPANEL-29847] Pkgacct::Restore hook not working?
I can't seem to get the Pkgacct::Restore hook to execute anything. Is this hook working?
Adding a script to execute at post stage for this event:
[font='Courier New'>/usr/local/cpanel/bin/manage_hooks add script /var/cpanel/hooks/monitor_restore.php --manual --category=Pkgacct --event=Restore --stage=post
The logs don't even indicate anything:
[font='Courier New'>---debug_hooks---
msg: No hooks found for traversed context
context: PkgAcct::Restore
stage: post
Perhaps I'm doing something wrong. Or perhaps Pkgacct::Restore isn't actually being hooked?
I would expect the logs to at least say something. But No hooks found for traversed context would seem to indicate that either my add hook line is wrong or it's not picking up on any Pkgacct::Restore hooks
This is in cPanel 82.0.16
-
Hi, Sparek. Do you see that your hook successfully registered when running /usr/local/cpanel/bin/manage_hooks list
or in the Manage Hooks interface in WHM?0 -
Yes. [font='courier new'>Pkgacct: Restore: hook: /var/cpanel/hooks/monitor_restore.php stage: post escalateprivs: 0 id: fDarP6RT5mAeXQ8uN2AvEOQq weight: 200 exectype: script 0 -
I was able to reproduce the same problem on my 84 testing environment. We will be doing additional testing tomorrow and I'll get back with a solution or workaround. 0 -
Sparek, After further testing, I do have some GOOD news. The Hook needs to be registered under PkgAcct::Restore
, notPkgacct::Restore
. See the below output from debug mode:[2019-10-09 12:32:51 -0500] info [transfer_session] ---debug_hooks--- [2019-10-09 12:32:51 -0500] info [transfer_session] msg: Beginning execution of script hook. [2019-10-09 12:32:51 -0500] info [transfer_session] context: PkgAcct::Restore [2019-10-09 12:32:51 -0500] info [transfer_session] stage: post [2019-10-09 12:32:51 -0500] info [transfer_session] result: 0 [2019-10-09 12:32:51 -0500] info [transfer_session] point: main [2019-10-09 12:32:51 -0500] info [transfer_session] id: c6866781-a409-48ea-8106-50393bd5fbeb [2019-10-09 12:32:51 -0500] info [transfer_session] hook: /usr/local/cpanel/3rdparty/bin/PkgacctRestoreTest.php [2019-10-09 12:32:51 -0500] info [transfer_session] escalateprivs: 0 [2019-10-09 12:32:51 -0500] info [transfer_session] weight: 200
We've also filed an internal case to provide proper validation for hookable events when registering action code.0 -
Also for reference, the internal case I opened is - CPANEL-29847 - As usual we'll update here when it's resolved but do let us know if the change proposed by @cPanelTJ resolves the issue for you. Also, @sparek-3 did this function in previous versions of cPanel the way you have it configured now? 0 -
Indeed [font='courier new'>/usr/local/cpanel/bin/manage_hooks add script /var/cpanel/hooks/monitor_restore.php --manual --category=PkgAcct --event=Restore --stage=post does work. I'm not sure where I got Pkgacct from. Everything's pretty clear as day that this should be PkgAcct. Brain fart I guess. 0 -
Actually, @cPanelTJ and I were discussing it earlier and I think we both came to the conclusion that at the very least this should give you an error and it might be something contributing to frustrations using the hooks system. I am curious still if you had this added this way on any other servers previously (though it's sounding like you may not have) 0 -
No, I did not have any previous implementation of anything like this. So I can't speak to whether this used to work or what. 0
Please sign in to leave a comment.
Comments
8 comments