Index: openacs-4/packages/acs-bootstrap-installer/installer.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer.tcl,v diff -u -r1.24.2.4 -r1.24.2.5 --- openacs-4/packages/acs-bootstrap-installer/installer.tcl 23 Jul 2014 21:24:48 -0000 1.24.2.4 +++ openacs-4/packages/acs-bootstrap-installer/installer.tcl 9 Aug 2014 08:06:26 -0000 1.24.2.5 @@ -266,7 +266,7 @@ ]} { set system_file "$system_file.tcl" } - apm_source "$::acs::rootdir/www/SYSTEM/$system_file" + apm_source $::acs::rootdir/www/SYSTEM/$system_file return "filter_return" } @@ -286,22 +286,25 @@ your URL and try again. " } + + array set errors {} + # Engage a mutex for double-click protection. ns_mutex lock [nsv_get acs_installer mutex] if { [catch { # Source the page and then unlock the mutex. - apm_source $path + apm_source $path errors ns_mutex unlock [nsv_get acs_installer mutex] } error] } { # In case of an error, don't forget to unlock the mutex. ns_mutex unlock [nsv_get acs_installer mutex] global errorInfo - install_return 500 "Error" "The following error occurred in an installation script: - -
[ns_quotehtml $errorInfo]
-" - + install_return 500 "Error" "The following error occurred in an installation script:\n\ +
[ns_quotehtml $errorInfo]
\n" } + if {[array size errors] > 0} { + install_return 500 "Error" [install_load_errors_formatted errors] + } return "filter_return" } @@ -346,6 +349,24 @@ } } +ad_proc -private install_load_errors_formatted {errorVarName} { + Report errors from load operations via ns_write + + @param errorVarName variable name of the associative array keeping the error infos +} { + upvar $errorVarName errors + + set result "" + if {[array size errors] > 0} { + append result "
\n"
+	foreach {key value} [array get errors] {
+	    append result "$key:\n[ad_quotehtml $value]\n"
+	}
+	append result "
\n" + } + return $result +} + ad_proc -private install_do_data_model_install {} { Installs the kernel datamodel. } { @@ -388,11 +409,19 @@ # Some APM procedures use util_memoize, so initialize the cache # before starting APM install - apm_source [acs_package_root_dir acs-tcl]/tcl/20-memoize-init.tcl - apm_source [acs_package_root_dir acs-tcl]/tcl/database-init.tcl + array set errors {} + apm_source [acs_package_root_dir acs-tcl]/tcl/20-memoize-init.tcl errors + apm_source [acs_package_root_dir acs-tcl]/tcl/database-init.tcl errors - apm_version_enable -callback apm_ns_write_callback [apm_package_install -callback apm_ns_write_callback "[file join $::acs::rootdir packages acs-kernel acs-kernel.info]"] + if {[array size errors] > 0} { + ns_write "Errors during initial load:\n" + ns_write [install_load_errors_formatted errors] + } + apm_version_enable -callback apm_ns_write_callback \ + [apm_package_install -callback apm_ns_write_callback \ + [file join $::acs::rootdir packages acs-kernel acs-kernel.info]] + ns_write "

Loading package .info files.

" # Preload all the .info files so the next page is snappy. @@ -422,14 +451,15 @@ } ns_write "Installing OpenACS Core Services" + array set errors {} # Load the acs-tcl init files that might be needed when installing, instantiating and mounting packages # We shouldn't source request-processor-init.tcl as it might interfere with the installer request handler foreach { init_file } { utilities-init.tcl site-nodes-init.tcl } { ns_log Notice "Loading acs-tcl init file $init_file" - apm_source "[acs_package_root_dir acs-tcl]/tcl/$init_file" + apm_source "[acs_package_root_dir acs-tcl]/tcl/$init_file" errors } - apm_bootstrap_load_libraries -procs acs-subsite + apm_bootstrap_load_libraries -procs acs-subsite errors apm_bootstrap_load_queries acs-subsite install_redefine_ad_conn @@ -438,9 +468,20 @@ set dependencies_satisfied_p [lindex $dependency_results 0] set pkg_list [lindex $dependency_results 1] - if { !$dependencies_satisfied_p } { - ns_write "

At least one core package has an unsatisifed dependency. No packages have been installed. Here's what the APM has computed:

$pkg_list
" - return + if { !$dependencies_satisfied_p } { + ns_write "

At least one core package has an unsatisifed dependency.\ + No packages have been installed missing: [lindex $dependency_results 2]. \ + Here's what the APM has computed:" + + ns_write "\n

\n" + ns_write [install_load_errors_formatted errors] + + return } apm_packages_full_install -callback apm_ns_write_callback $pkg_list