for script in ${upgrade_scripts}
do
echo "Processing $script file..."
- "${script}" -N -B --host="${db_host}" ${db_port_full_parameter-} \
- --database="${db_name}" --user="${db_user}" \
- --password="${db_password}" ${extra_arguments}
+ run_command \
+ "${script}" -N -B --host="${db_host}" ${db_port_full_parameter-} \
+ --database="${db_name}" --user="${db_user}" \
+ --password="${db_password}" ${extra_arguments}
+ if test "${EXIT_CODE}" != 0; then
+ if test -n "${OUTPUT}"; then
+ printf '%s\n' "${OUTPUT}"
+ fi
+ log_error "Could not execute script: ${script}"
+ exit "${EXIT_CODE}"
+ fi
done
version=$(checked_mysql_version)
for script in ${upgrade_scripts}
do
echo "Processing $script file..."
- "${script}" --set ON_ERROR_STOP=1 -A -t \
- -h "${db_host}" ${db_port_full_parameter-} -q -U "${db_user}" \
- -d "${db_name}" ${extra_arguments}
+ run_command \
+ "${script}" --set ON_ERROR_STOP=1 -A -t \
+ -h "${db_host}" ${db_port_full_parameter-} -q -U "${db_user}" \
+ -d "${db_name}" ${extra_arguments}
+ if test "${EXIT_CODE}" != 0; then
+ if test -n "${OUTPUT}"; then
+ printf '%s\n' "${OUTPUT}"
+ fi
+ log_error "Could not execute script: ${script}"
+ exit "${EXIT_CODE}"
+ fi
done
version=$(checked_pgsql_version)
run_statement "insert options" "$qry"
- # Ok, we have a 6.0 database with hosts and options. Let's upgrade it to 7.0
+ # Ok, we have a 6.0 schema with hosts and options. Let's upgrade it to 7.0
# For versions higher than 7.0 some new constraints fail to be added
# with the not empty tables, for instance the 9.1 -> 9.2 upgrade script
# can raise a MySQL error 1452 for fk_dhcp4_options_subnet constraint.
mysql_upgrade_schema_to_version 7.0
- # Version should be new 7.0
+ # Version should now be 7.0.
version=$("${kea_admin}" db-version mysql -u "${db_user}" -p "${db_password}" -n "${db_name}" -d "${db_scripts_dir}")
assert_str_eq "7.0" "${version}" "Expected kea-admin to return %s, returned value was %s"
run_statement "insert options" "$qry"
- # We have a 4.0 database with hosts and options. Let's upgrade it to 6.2.
+ # We have a 4.0 schema with hosts and options. Let's upgrade it to 6.2.
# For versions higher than 6.2 some new constraints fail to be added
# with the not empty tables, for instance the 6.2 -> 7.0 upgrade script
# can raise a key constraing violation for fk_dhcp6_options_subnet.
pgsql_upgrade_schema_to_version 6.2
- # Version should be new 6.2
+ # Version should now be 6.2.
version=$("${kea_admin}" db-version pgsql -u "${db_user}" -p "${db_password}" -n "${db_name}" -d "${db_scripts_dir}")
assert_str_eq "6.2" "${version}" "Expected kea-admin to return %s, returned value was %s"