TT#142950 ngcpcfg: Make commit action update config file permissions

We need to make sure the permissions for any config file are set
correctly, otherwise on the next build action these will be updated,
which might cause spurious commits just for these updates, that can
end up generating rebase conflicts.

Change-Id: I7c0f4cf13593da0d696ba25097b202e0b7a33674
mr10.1
Guillem Jover 4 years ago
parent 93e84e054f
commit ff5b523483

@ -31,6 +31,23 @@ if [ -x "${NGCPCTL_MAIN}/.git/hooks/pre-commit" ] ; then
"${NGCPCTL_MAIN}/.git/hooks/pre-commit"
fi
# Apply configured file ownership and permissions
for f in ${NGCPCTL_CONFIG:-} ${HA_CONFIG:-} ${PAIR_CONFIG:-} ${HOST_CONFIG:-} ${LOCAL_CONFIG:-} "${EXTRA_CONFIG_FILES[@]}" ; do
if [ ! -f "${f}" ]; then
continue
fi
chown "${CONFIG_USER}":"${CONFIG_GROUP}" "${f}"
chmod "${CONFIG_CHMOD}" "${f}"
done
if [ -f "${NETWORK_CONFIG:-}" ]; then
chown "${NETWORK_CONFIG_USER}":"${NETWORK_CONFIG_GROUP}" "${NETWORK_CONFIG}"
chmod "${NETWORK_CONFIG_CHMOD}" "${NETWORK_CONFIG}"
fi
if [ -f "${CONSTANTS_CONFIG:-}" ]; then
chown "${CONSTANTS_CONFIG_USER}":"${CONSTANTS_CONFIG_GROUP}" "${CONSTANTS_CONFIG}"
chmod "${CONSTANTS_CONFIG_CHMOD}" "${CONSTANTS_CONFIG}"
fi
cd "$NGCPCTL_MAIN"
if [ -z "${NO_DB_SYNC:-}" ] ; then

Loading…
Cancel
Save