Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #7794: rudder-upgrade edits the wrong ncf.conf file causing transitory invalid promises during upgrades #870

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rudder-webapp/SOURCES/rudder-init
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ cf-agent -f failsafe.cf &>> "$TMP_LOG"
# Run all server-specific bundles (except propagatePromises, because they're aren't any yet)
cf-agent -b propagatePromises,install_rsyslogd,root_component_check &>> "$TMP_LOG"

# The previous run will create /var/rudder/configuration-repository/ncf/ncf.conf but it still needs copying to /var/rudder/ncf/local/ncf.conf
if [ -f /var/rudder/configuration-repository/ncf/ncf.conf ]; then
cp -f /var/rudder/configuration-repository/ncf/ncf.conf /var/rudder/ncf/local/
fi

## Then, restart jetty
${JETTY_INIT} restart >> "${TMP_LOG}" 2>&1 || echo "WARNING: Jetty failed to start, maybe there is not enough RAM or swap on the machine. Skipping..."

Expand Down
25 changes: 16 additions & 9 deletions rudder-webapp/SOURCES/rudder-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,26 @@ upgrade_ncf() {
fi
fi

# Make sure that ncf uses the right logger bundles (_logger_default and logger_rudder)
STEP="Make sure that ncf uses the right logger bundles (_logger_default and logger_rudder)"
if [ -f ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf ]; then
# Make sure that ncf uses the right logger bundles (_logger_default and logger_rudder)
STEP="Make sure that ncf uses the right logger bundles (_logger_default and logger_rudder)"

if ! grep -Eq "^loggers=.*logger_rudder.*" ${RUDDER_VAR}/ncf/common/ncf.conf; then
sed -i "s%^loggers=\(.*\)%loggers=\1,logger_rudder%" ${RUDDER_VAR}/ncf/common/ncf.conf
fi
if ! grep -Eq "^loggers=.*logger_rudder.*" ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf; then
sed -i "s%^loggers=\(.*\)%loggers=\1,logger_rudder%" ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf
fi

# Make sure that ncf uses the right CFEngine port (5309)
STEP="Make sure that ncf uses the right CFEngine port (5309)"
# Make sure that ncf uses the right CFEngine port (5309)
STEP="Make sure that ncf uses the right CFEngine port (5309)"

if ! grep -Eq "^cfengine_port=5309" ${RUDDER_VAR}/ncf/common/ncf.conf; then
sed -i "s%^cfengine_port=.*%cfengine_port=5309%" ${RUDDER_VAR}/ncf/common/ncf.conf
if ! cat ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf | perl -p0e "s/\n/%%%%%/g" | egrep -q "classes.community_edition[^%]*%%%%%cfengine_port=5309"; then
cat ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf | perl -p0e "s/\n/%%%%%/g" | sed "s/\(classes.community_edition[^%]*%%%%%cfengine_port=\)[0-9]\+/\15309/" | perl -p0e "s/%%%%%/\n/g" > ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf.new
mv ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf.new ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf
fi

# Anticipate the copy from ${CONFIGURATION_REPOSITORY}/ncf to ${RUDDER_VAR}/ncf/local
cp -f ${CONFIGURATION_REPOSITORY}/ncf/ncf.conf ${RUDDER_VAR}/ncf/local/
fi

}

################################################################################
Expand Down