Forum OpenACS Development: upgrade acs-templating 5.1.5 to 5.5.1

I am trying to upgrade acs-templating from version 5.1.5 to version 5.5.1 and i got an SQL error saying there's no such parameter called XinhaDefaultPlugins

I believe it is missing one script that creates the parameter XinhaDefaultPlugins and its related stuff.

Moreover, I can not run scripts to upgrade, unless I do the amends before.

What would be the best thing to do?

1. Manually create the parameter then run the upgrade script
(but I don't know id there's something more to create)
or
2. Uninstall package acs-templating 5.1.5 then install acs-templating 5.5.1 (Is delete acs-tempating package's script a cleaned uninstalling process?)

Please see log below:

[21/Apr/2010:20:08:44][19820.3058224016][-default:2-] Error: apm_package_install: Error installing Templating version 5.5.1: Database operation "0or1row" failed
(exception ERROR, "ERROR:  -20000: The specified package 170 AND/OR parameter XinhaDefaultPlugins do not exist in the system
")
pqerror was: "ERROR:  -20000: The specified package 170 AND/OR parameter XinhaDefaultPlugins do not exist in the system
"
(Status of PQexec call: PGRES_FATAL_ERROR)
SQL:
            select apm__set_value(
                '170',
                'XinhaDefaultPlugins',
                NULL
            );

Database operation "0or1row" failed (exception ERROR, "ERROR: -20000: The specified package 170 AND/OR parameter XinhaDefaultPlugins do not exist in the system ") pqerror was: "ERROR: -20000: The specified package 170 AND/OR parameter XinhaDefaultPlugins do not exist in the system " (Status of PQexec call: PGRES_FATAL_ERROR) SQL: select apm__set_value( '170', 'XinhaDefaultPlugins', NULL ); while executing "ns_pg_bind 0or1row nsdb0 { select apm__set_value( :package_id, :parameter, :value ..." ("uplevel" body line 1) invoked from within "uplevel $ulevel [list ns_pg_bind $type $db $sql]" invoked from within "db_exec 0or1row $db $full_statement_name $sql" ("uplevel" body line 8) invoked from within "uplevel 1 $code_block " invoked from within "db_with_handle -dbn $dbn db { # plsql calls that are simple selects bypass the plpgsql # mechanism for creating anonymous fun..." (procedure "db_exec_plsql" line 57) invoked from within "db_exec_plsql set_parameter_value {}" (procedure "parameter::set_value" line 7) invoked from within "parameter::set_value -package_id $package_id_templating -parameter "XinhaDefaultPlugins" -value $plugins " ("uplevel" body line 7) invoked from within "uplevel $chunks($key)" (procedure "apm_upgrade_logic" line 19) invoked from within "apm_upgrade_logic -from_version_name $from_version_name -to_version_name $to_version_name -spec { 4.6.4 5.0d1 { db_tran..." (procedure "template::apm::before_upgrade" line 3) invoked from within "template::apm::before_upgrade -from_version_name 5.1.5 -to_version_name 5.5.1" ("eval" body line 1) invoked from within "eval $command" (procedure "apm_invoke_callback_proc" line 37) invoked from within "apm_invoke_callback_proc -proc_name $callbacks(before-upgrade) -version_id $version_id -type before-upgrade -arg_list [list from_version_name $upg..." ("uplevel" body line 46) invoked from within "uplevel $body " [21/Apr/2010:20:08:44][19820.3058224016][-default:2-] Error:

Failed to install Templating, version 5.5.1. The following error was generated: Database operation "0or1row" failed (exception ERROR, "ERROR: -20000: The specified package 170 AND/OR parameter XinhaDefaultPlugins do not exist in the system ") pqerror was: "ERROR: -20000: The specified package 170 AND/OR parameter XinhaDefaultPlugins do not exist in the system " (Status of PQexec call: PGRES_FATAL_ERROR) SQL: select apm__set_value( '170', 'XinhaDefaultPlugins', NULL );

NOTE: If the error comes from a sql script you may try to source it manually. When you are done with that you should revisit the APM and try again but remember to leave the manually souced sql scipts unchecked on the previous page.

[21/Apr/2010:20:08:44][19820.3058224016][-default:2-] Notice: Querying '
		select 1 from dual
		where exists
	        	( select 1
                	from acs_object_party_privilege_map ppm
	  		where ppm.object_id = '18261' and ppm.party_id = '624' and ppm.privilege = 'admin' );'
[21/Apr/2010:20:08:44][19820.3058224016][-default:2-] Notice: dbinit: sql(localhost::projop): '
		select 1 from dual
		where exists
	        	( select 1
                	from acs_object_party_privilege_map ppm
	  		where ppm.object_id = '18261' and ppm.party_id = '624' and ppm.privilege = 'admin' )
        '
[21/Apr/2010:20:08:44][19820.3058224016][-default:2-] Debug: db_exec: timing 0 seconds nsdb0 0or1row dbqd.acs-tcl.tcl.acs-permissions-procs.permission::permission_p_not_cached.select_permission_p
Collapse
Posted by Dave Bauer on
Parameters are created in the INFO file.
Upgrade scripts should not create parameters.

Can you find the code that is actually setting the value? Is it set explicitly in the upgrade script or set implicitly but the upgrade process from the info file?

Collapse
Posted by Dave Bauer on
XinhaDefaultPlugins in in the 5.5.0 info file (at least). So I am not sure what script is running before the info file params are added.
Collapse
Posted by Iuri Sampaio on
To double check I just downloaded acs-templateting 5.5 from cvs and i got the same error.

I see XinhaDefaultPlugins as a parameter in the info file

Weird!
There is no "upgrade" directory neither any files in /acs-templating/sql/postgresql/

Following error.log to find the code that is setting the values...
I can't see what is causing the error and i can't find the following queries in the source code of acs-templating:

[21/Apr/2010:22:08:12][9311.3058281360][-default:3-] Notice: Querying '
select apm_parameter_values.attr_value
from apm_parameters, apm_parameter_values
where apm_parameter_values.package_id = '170'
and apm_parameter_values.parameter_id = apm_parameters.parameter_id
and apm_parameters.parameter_name = 'XinhaDefaultPlugins';'

Neither
SQL:
select apm__set_value(
'170',
'XinhaDefaultPlugins',
NULL
);

Collapse
Posted by Iuri Sampaio on
i understand now those queries are in acs-tcl.
I will spend more time debugging it, then i paste the results
Collapse
Posted by Gustaf Neumann on
The following change causes the problem since it assumes, that the parameter exists at the time the update script is executed (upgrade of acs-templating from 5.5.1d1 to 5.5.1d2)

http://fisheye.openacs.org/changelog/OpenACS?cs=oacs-5-5:victorg:20090724141231

The parameter was introduced in 5.2. Going straight from 5.1.* to 5.5.d2+ seems to cause the trouble, since apparently, the parameter would be created by the upgrade logic at some time after the callback.

2 ways to install:
a) upgrade first to some earlier version and then to 5.5.1
b) change acs-templating/tcl/apm-callback-procs.tcl to check, whether the parameter exists (easiest to check if $plugins after the parameter get is non-empty).

(b) should be done anyhow, but it would not help for people using the tar file.

Hope this helps
-gustaf neumann

Collapse
Posted by Victor Guerra on
Dear Iuri,

I just fixed upgrade script on branches oacs-5-5 and oacs-5-6 ( it will make it to HEAD as soon has all the fixes on the branch oacs-5-6 are merged to HEAD ).

Problem was that, as Gustaf mentioned before, the script was assuming the existence of this parameter.

So please, just do a cvs checkout from the oacs-5-5 branch.

Collapse
Posted by Iuri Sampaio on
Hi victor,

i did that already. I created the parameter manually by myself.
I was afraid there were more stuff to do aside creating the parameter.

Anyway, i read your scripts to check i i forgot anything plus to learn how your approach of things. Thank you so much!