diff --git a/setup/so-functions b/setup/so-functions index 8352d0430..e67edab41 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -2096,6 +2096,10 @@ reinstall_init() { # Backup /opt/so since we'll be rebuilding this directory during setup backup_dir /opt/so "$date_string" + # We need to restore these files during a reinstall so python3-influxdb state doesn't try to patch again + restore_file "/opt/so_old_$date_string/state/influxdb_continuous_query.py.patched" "/opt/so/state/" + restore_file "/opt/so_old_$date_string/state/influxdb_retention_policy.py.patched" "/opt/so/state/" + restore_file "/opt/so_old_$date_string/state/influxdbmod.py.patched" "/opt/so/state/" # Backup directories in /nsm to prevent app errors backup_dir /nsm/mysql "$date_string" @@ -2129,6 +2133,16 @@ reset_proxy() { fi } +restore_file() { + src=$1 + dst=$2 + if [ -f "$src" ]; then + [ ! -d "$dst" ] && mkdir -v -p "$dst" + echo "Restoring $src to $dst." >> "$setup_log" 2>&1 + cp -v "$src" "$dst" + fi +} + backup_dir() { dir=$1 backup_suffix=$2