Forum OpenACS Q&A: before-install callbacks not working

Hello Everyone,

I was wondering if anybody has tried using before-install callbacks.

I have been trying to use it but it seems that the before install callback is not being called at all.

I traced it to the apm_install_procs and the apm_procs inside acs-tcl.

It seems that before-install callbacks are invoked by a proc that queries them from a table which stores the callbacks for various packages.

The problem is that this table doesn't get populated with the callbacks for the package being installed until after SQL files have been loaded and just prior to after-install callbacks.

In apm_install_procs.tcl, the before-install callbacks are done here

*************
if { $upgrade_p } {
            # Run before-upgrade
            apm_invoke_callback_proc -version_id $version_id -type before-upgrade -arg_list [list from_version_name $upgrade_from_version_name to_version_name $version(name)]
        } else {
            # Run before-install
            apm_invoke_callback_proc -version_id $version_id -type before-install
        }
***********

Note that apm_invoke_callback_proc calls apm_get_callback_proc which queries the apm_package_callbacks table.

************************
set proc_name [apm_get_callback_proc \
                      -version_id $version_id \
                      -package_key $package_key \
                      -type $type]
***********************

The problem here is that the apm_package_callbacks table will not have the before-install callbacks yet because

************************
apm_package_install_callbacks -callback $callback $version(callbacks) $version_id
***********************

is not called until much later in package installation.

Has anybody enountered the same problem ? Any work arounds ?
Is this a bug ?

Best,

Hamilton

Collapse
Posted by Don Baccus on
Sounds like a bug, please file a bug report!
Collapse
Posted by Jun Yamog on
Ham,

Can you check also after_instantiate?  I tried it on acs-subsite, it does seem to work well.  Or maybe because I need a connection at that time.

This is why I had to use after_mount just like the existing one, so I just followed the existing one.  Thanks.

Collapse
Posted by Jeff Davis on
I fixed this on head (before-install and before-upgrade both did not
work, although afaict the after-instantiate should be fine).
Collapse
Posted by Hamilton Chua on
Thanks Jeff.