using json instead of conf. started collect_current_configuration

This commit is contained in:
Gerhard Hoffmann 2022-06-06 19:05:45 +02:00
parent 2158f65c65
commit d8f36deca0

View File

@ -8,6 +8,26 @@ source ./read_config
source ./news_to_ismas
source ./news_from_ismas
trap collect_current_configuration EXIT
collect_current_configuration () {
local func="${FUNCNAME[0]}"
echo $func
return 0
for line in $(cat $UPDATE_CONF |\
jq -r .conf.szeged.zg[1].z[1].etc.psa_config)
do
conf_file="$(echo $line |
sed -E -ne 's/^[^{}]\s+\"(DC2C_[[:alnum:]]+)\".*$/\1/gp')"
if ! [ -z $conf_file ]; then
local v=$(cat "$psa_config_dir/${conf_file}.json" | jq -r .version)
echo "$conf_file.json version=$v"
fi
done
}
update_psa() {
if ! updates_available; then # check for false alarm
@ -67,28 +87,28 @@ update_psa() {
# dateinen zu ueberpruefen
local changed_files=$(changed_file_names)
local conf_ini_files=$(filter_conf_ini_files "$changed_files")
local json_ini_files=$(filter_json_ini_files "$changed_files")
update_psa_report_changed_file_names $changed_files # message to ISMAS
# check if *.conf and/or *.ini-files have to md5-sum as denoted
# in update.conf
if ! check_md5_for_changed_conf_and_ini_files "$conf_ini_files" ; then
if ! check_md5_for_changed_json_and_ini_files "$json_ini_files" ; then
local __r=$?
log_error "$func:${LINENO}: new customer files wrong"
revert_customer_repository
exit $__r
fi
if ! check_hardware_compatibility "$conf_ini_files" ; then
if ! check_hardware_compatibility "$json_ini_files" ; then
local __r=$?
log_error "$func:${LINENO}: conf/ini-files not fit for PSA"
log_error "$func:${LINENO}: json/ini-files not fit for PSA"
revert_customer_repository
exit $__r
fi
# copy *.conf and/or *.ini-files to their corresponding system-directories
if ! copy $conf_ini_files; then
if ! copy $json_ini_files; then
local __r=$?
log_error "$func:${LINENO}: copy operation failed"
revert_customer_repository
@ -148,6 +168,10 @@ update_psa() {
log_error "$func:${LINENO}: cleanup_previous_version failed"
fi
# TODO: nach (erfolgreichem) abschluss sollte man immer das aktuelle setting
# ans ISMAS schicken. ISMAS sollte immer wissen, was gerade auf dem
# Automaten steht.
update_psa_cleanup $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "cleanup after psa update"