Bug #2218
PT checkGenericFileContent version 2.1 is completely broken!
| Status: | Released | Start date: | 2012-01-30 | |
|---|---|---|---|---|
| Priority: | 1 | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | Policy Templates | |||
| Target version: | Rudder - 2.3.7 | |||
| Pull Request: |
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";
Related issues
Associated revisions
Fixes #2218: The PT checkGenericFileContent has been repaired (version 2.1)
Merge branch 'branches/rudder/2.3'
- branches/rudder/2.3:
Fixes #2218: The PT checkGenericFileContent has been repaired (version 2.1)
Fixes #2218: The PT checkGenericFileContent has been repaired (version 2.1)
Refs #2218: TRIVIAL, cosmetic refactoring (indentation)
Fixes #2218: There was some extra statements forgotten during the PT repairation
Fixes #2218: There was some extra statements forgotten during the PT repairation
History
#1
Updated by Matthieu CERDA over 1 year ago
- Status changed from New to Pending technical review
- % Done changed from 0 to 100
Applied in changeset 5564abd8d5a546e8a1ba121f15aff147cf7696fd.
#2
Updated by Matthieu CERDA over 1 year ago
Applied in changeset fe8590b6eb6d7dc1e0418115b1ea9a0218289b55.
#3
Updated by Matthieu CERDA over 1 year ago
Applied in changeset d9fdf12891620c4dde6c91c705cd2741e687f3d2.
#4
Updated by Matthieu CERDA over 1 year ago
Applied in changeset ad0e3e490d1492598c45821e772ab5cdc4b64362.
#5
Updated by Jonathan CLARKE over 1 year 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>
#6
Updated by Matthieu CERDA over 1 year ago
- Status changed from 2 to Pending technical review
- % Done changed from 80 to 100
Applied in changeset ea8f29020bbe205615c751b180c5aaf5ece92288.
#7
Updated by Matthieu CERDA over 1 year ago
You were right, some old statements from the 2.0 were not ported to this version :) All hail the technical review !
#8
Updated by Nicolas CHARLES about 1 year 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 ?
#9
Updated by Matthieu CERDA about 1 year 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
#10
Updated by Matthieu CERDA about 1 year ago
- Status changed from Discussion to Pending technical review
Applied in changeset b584a8c2a017f0914a74afbed734bea3385563ba.
#11
Updated by Nicolas CHARLES about 1 year ago
- Status changed from Pending technical review to Released
The final correction seems valid, thank you Matthieu