Bug #2218
closedPT checkGenericFileContent version 2.1 is completely broken!
Added by Jonathan CLARKE almost 13 years ago. Updated over 9 years ago.
Description
The version 2.1 of this PT is set to be multi-instance, but the CFEngine String Template files are not.
As a result, we get a generated file with variable values all concatenated, similar to this:
"generic_file_content_path" string => "/etc/passwd/etc/group/etc/shadow";
Updated by Matthieu CERDA almost 13 years ago
- Status changed from New to Pending technical review
- % Done changed from 0 to 100
Applied in changeset commit:5564abd8d5a546e8a1ba121f15aff147cf7696fd.
Updated by Matthieu CERDA almost 13 years ago
Applied in changeset commit:fe8590b6eb6d7dc1e0418115b1ea9a0218289b55.
Updated by Matthieu CERDA almost 13 years ago
Applied in changeset commit:d9fdf12891620c4dde6c91c705cd2741e687f3d2.
Updated by Matthieu CERDA almost 13 years ago
Applied in changeset commit:ad0e3e490d1492598c45821e772ab5cdc4b64362.
Updated by Jonathan CLARKE almost 13 years ago
- Status changed from Pending technical review to 2
- Assignee set to Matthieu CERDA
- % Done changed from 100 to 80
The CFEngine template now looks fine, thanks Matthieu.
However I'm not so sure about the policy.xml file. Comparing versions 2.0 and 2.1, I get the following diff, in which I notice that:- The "File" section is no longer multivalues. Why not?
- Several sub-sections used to have a componentKey but no longer do. Why is this?
--- 2.0/policy.xml 2011-11-14 09:27:31.229575902 +0100 +++ 2.1/policy.xml 2012-02-01 17:53:42.524501477 +0100 @@ -37,11 +37,11 @@ <TRACKINGVARIABLE> <SAMESIZEAS>GENERIC_FILE_CONTENT_PATH</SAMESIZEAS> - </TRACKINGVARIABLE> - +</TRACKINGVARIABLE> + <SECTIONS> - <SECTION name="File to manage" multivalued="true"> - <SECTION name="File" multivalued="false" component="true" componentKey="GENERIC_FILE_CONTENT_PATH"> + <SECTION name="File to manage"> + <SECTION name="File" component="true"> <INPUT> <NAME>GENERIC_FILE_CONTENT_PATH</NAME> <DESCRIPTION>Path</DESCRIPTION> @@ -69,8 +69,55 @@ <DEFAULT>false</DEFAULT> </CONSTRAINT> </SELECT1> + <INPUT> + <NAME>GENERIC_FILE_CONTENT_DELETION_BOOLEAN</NAME> + <DESCRIPTION>Enable the deletion of lines using a regexp</DESCRIPTION> + <CONSTRAINT> + <TYPE>boolean</TYPE> + <DEFAULT>false</DEFAULT> + </CONSTRAINT> + </INPUT> + <INPUT> + <NAME>GENERIC_FILE_CONTENT_MODIFICATION_BOOLEAN</NAME> + <DESCRIPTION>Enable the replacement of lines using a regexp</DESCRIPTION> + <CONSTRAINT> + <TYPE>boolean</TYPE> + <DEFAULT>false</DEFAULT> + </CONSTRAINT> + </INPUT> </SECTION> - <SECTION name="Permission adjustment" multivalued="false" component="true" componentKey="GENERIC_FILE_CONTENT_PATH"> + <SECTION name="Line deletion regular expressions" component="true" componentKey="GENERIC_FILE_CONTENT_PATH"> + <INPUT> + <NAME>GENERIC_FILE_CONTENT_DELETION_REGEXP</NAME> + <DESCRIPTION>Regular expression</DESCRIPTION> + <LONGDESCRIPTION>Regular expression used to match a line to be deleted</LONGDESCRIPTION> + <CONSTRAINT> + <TYPE>string</TYPE> + <DEFAULT>deleteme.*</DEFAULT> + </CONSTRAINT> + </INPUT> + </SECTION> + <SECTION name="Line replacement regular expressions" component="true" componentKey="GENERIC_FILE_CONTENT_PATH"> + <INPUT> + <NAME>GENERIC_FILE_CONTENT_MODIFICATION_REGEXP</NAME> + <DESCRIPTION>Regular expression</DESCRIPTION> + <LONGDESCRIPTION>Regular expression used to match a line to be replaced</LONGDESCRIPTION> + <CONSTRAINT> + <TYPE>string</TYPE> + <DEFAULT>replaceme.*</DEFAULT> + </CONSTRAINT> + </INPUT> + <INPUT> + <NAME>GENERIC_FILE_CONTENT_MODIFICATION_DESTINATION</NAME> + <DESCRIPTION>String used as a replacement</DESCRIPTION> + <CONSTRAINT> + <TYPE>string</TYPE> + <DEFAULT></DEFAULT> + <MAYBEEMPTY>true</MAYBEEMPTY> + </CONSTRAINT> + </INPUT> + </SECTION> + <SECTION name="Permission adjustment" component="true"> <INPUT> <NAME>GENERIC_FILE_CONTENT_PERMISSION_ADJUSTMENT</NAME> <DESCRIPTION>Set explicit permissions to apply on the file</DESCRIPTION> @@ -99,7 +146,7 @@ </CONSTRAINT> </INPUT> </SECTION> - <SECTION name="Post-modification hook" multivalued="false" component="true" componentKey="GENERIC_FILE_CONTENT_PATH"> + <SECTION name="Post-modification hook" component="true"> <INPUT> <NAME>GENERIC_FILE_CONTENT_POST_HOOK_RUN</NAME> <DESCRIPTION>Should the command(s) below be run if any modifications are made on the path above?</DESCRIPTION> @@ -117,5 +164,4 @@ </SECTION> </SECTIONS> - </POLICY>
Updated by Matthieu CERDA almost 13 years ago
- Status changed from 2 to Pending technical review
- % Done changed from 80 to 100
Applied in changeset commit:ea8f29020bbe205615c751b180c5aaf5ece92288.
Updated by Matthieu CERDA almost 13 years ago
You were right, some old statements from the 2.0 were not ported to this version :) All hail the technical review !
Updated by Nicolas CHARLES over 12 years ago
- Status changed from Pending technical review to In progress
Something must have gone bad, the code seems valid in branch 2.4, but not in 2.3
(commit ea8f29020bbe205615c751b180c5aaf5ece92288 is not applied on the policy.xml file)
Could you have a look at this please Matthieu ?
Updated by Matthieu CERDA over 12 years ago
- Status changed from In progress to Discussion
- Assignee changed from Matthieu CERDA to Nicolas CHARLES
Can we please discuss this on #2417 ? I can not focus on the same discussion on two different but at a time :D
Updated by Matthieu CERDA over 12 years ago
- Status changed from Discussion to Pending technical review
Applied in changeset commit:b584a8c2a017f0914a74afbed734bea3385563ba.
Updated by Nicolas CHARLES over 12 years ago
- Status changed from Pending technical review to Released
The final correction seems valid, thank you Matthieu
Updated by Benoît PECCATTE over 9 years ago
- Project changed from 24 to Rudder
- Category changed from Policy Templates to Techniques