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 #11153: sysconfig/apache2 modifications get removed #1509

Conversation

amousset
Copy link
Member

if ! grep -qE "^. /etc/sysconfig/rudder-relay-apache$" /etc/sysconfig/apache2; then
nextline=$(grep -A1 -E "^. /etc/sysconfig/rudder-relay-apache$" /etc/sysconfig/apache2 | tail -n1)
if [ "${nextline}" = "" ]; then
# No include currently
echo -e '# This sources the modules/defines needed by Rudder\n. /etc/sysconfig/rudder-relay-apache' >> /etc/sysconfig/apache2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don' we do 2 lines instead of one for each echo ? this makes it completely unreadable

Copy link
Member

@VinceMacBuche VinceMacBuche Feb 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo -e '# This sources the modules/defines needed by Rudder' >> /etc/sysconfig/apache2
echo -e '. /etc/sysconfig/rudder-relay-apache' >> /etc/sysconfig/apache2

instead of

echo -e '# This sources the modules/defines needed by Rudder\n. /etc/sysconfig/rudder-relay-apache' >> /etc/sysconfig/apache2

echo -e '# This line is necessary for fillup not to remove any lines above. See #11153\nAPACHE_RUDDER_RELAY_CUSTOMIZED="true"' >> /etc/sysconfig/apache2
elif [ "${nextline}" != "# This line is necessary for fillup not to remove any lines above. See #11153" ]; then
# Old include without comment
sed -i 's|. /etc/sysconfig/rudder-relay-apache|. /etc/sysconfig/rudder-relay-apache\n# This line is necessary for fillup not to remove any lines above. See #11153\nAPACHE_RUDDER_RELAY_CUSTOMIZED="true"|' /etc/sysconfig/apache2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whye not the same echo as above ? and a complex sed ... because you need to have the line just below ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we want to insert the line just after the Rudder include.and keep a consistent file across versions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok!

@amousset amousset force-pushed the bug_11153/sysconfig_apache2_modifications_get_removed branch from 89683f6 to 3f0b905 Compare February 20, 2018 10:51
@amousset
Copy link
Member Author

PR rebased

@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 3f0b905 into Normation:branches/rudder/4.1 Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants