fix: clean old config on agent reinstall

install script now removes old .env and config.json
prevents conflicts during reinstall/upgrade

addresses .env conflict errors reported in testing
This commit is contained in:
Fimeg
2025-11-02 13:32:53 -05:00
parent 0062e2acab
commit c1ad4283b0

View File

@@ -174,6 +174,18 @@ register_agent() {
# Create config directory
mkdir -p /etc/aggregator
# Clean up old configuration files (prevents conflicts during reinstall/upgrade)
if [ -f /etc/aggregator/.env ]; then
echo "Removing old .env file..."
rm -f /etc/aggregator/.env
echo "✓ Old .env file removed"
fi
if [ -f /etc/aggregator/config.json ]; then
echo "Removing old config.json file..."
rm -f /etc/aggregator/config.json
echo "✓ Old config.json file removed"
fi
# Set SELinux context for config directory if SELinux is enabled
if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" != "Disabled" ]; then
echo "Setting SELinux context for config directory..."