https://issues.rudder.io/https://issues.rudder.io/themes/rudder7/favicon/favicon.ico?17096450182013-02-25T08:15:29ZIssue TrackerRudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=155322013-02-25T08:15:29ZJonathan CLARKEjonathan.clarke@normation.com
<ul></ul><p>This sounds like a reasonable request, and would make profit of one of CFEngine's more powerful features in file editing.</p>
<p>What are the exact parameters you need to add to the existing Technique? I assume just "Insert this text after a line matching this regex"? Or something else. Let's discuss the spec here before attempting any implementation.</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=155462013-02-25T10:29:49ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Discussion</i></li></ul><p>Jonathan CLARKE wrote:</p>
<blockquote>
<p>This sounds like a reasonable request, and would make profit of one of CFEngine's more powerful features in file editing.</p>
<p>What are the exact parameters you need to add to the existing Technique? I assume just "Insert this text after a line matching this regex"? Or something else. Let's discuss the spec here before attempting any implementation.</p>
</blockquote>
In my opinion, it should be two parameters to be added.
<ul>
<li><em>Insert this text after a line matching this regex</em> to be sure to add the configuration property in the right location</li>
<li><em>Add as one entire block</em> ? This could be usefull if an order is expected in the add of content.</li>
</ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=155832013-02-27T08:45:31ZJonathan CLARKEjonathan.clarke@normation.com
<ul></ul><p>Nicolas PERRON wrote:</p>
<blockquote>
<p>Jonathan CLARKE wrote:</p>
<blockquote>
<p>This sounds like a reasonable request, and would make profit of one of CFEngine's more powerful features in file editing.</p>
<p>What are the exact parameters you need to add to the existing Technique? I assume just "Insert this text after a line matching this regex"? Or something else. Let's discuss the spec here before attempting any implementation.</p>
</blockquote>
In my opinion, it should be two parameters to be added.
<ul>
<li><em>Insert this text after a line matching this regex</em> to be sure to add the configuration property in the right location</li>
</ul>
</blockquote>
<p>Sounds great.</p>
<blockquote>
<ul>
<li><em>Add as one entire block</em> ? This could be usefull if an order is expected in the add of content.</li>
</ul>
</blockquote>
<p>This sounds to me like a separate feature: you seem to be implying that lines are not inserted in order currently. If so, that's a bug and should be filed in a separate ticket. Or is that not the case? If so, please clarify.</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=156822013-03-13T14:38:00ZNicolas PERRONnicolas.perron@normation.com
<ul></ul><p>Jonathan CLARKE wrote:</p>
<blockquote>
<p>Nicolas PERRON wrote:</p>
<blockquote>
<p>Jonathan CLARKE wrote:</p>
<blockquote>
<p>This sounds like a reasonable request, and would make profit of one of CFEngine's more powerful features in file editing.</p>
<p>What are the exact parameters you need to add to the existing Technique? I assume just "Insert this text after a line matching this regex"? Or something else. Let's discuss the spec here before attempting any implementation.</p>
</blockquote>
In my opinion, it should be two parameters to be added.
<ul>
<li><em>Insert this text after a line matching this regex</em> to be sure to add the configuration property in the right location</li>
</ul>
</blockquote>
<p>Sounds great.</p>
</blockquote>
<p>Ok, then is this a new feature (user story to create) or this bug answer the problem ?</p>
<blockquote>
<blockquote>
<ul>
<li><em>Add as one entire block</em> ? This could be usefull if an order is expected in the add of content.</li>
</ul>
</blockquote>
<p>This sounds to me like a separate feature: you seem to be implying that lines are not inserted in order currently. If so, that's a bug and should be filed in a separate ticket. Or is that not the case? If so, please clarify.</p>
</blockquote>
<p>I'm not sure of this but I will test it. It seems to me that if just one line of the block defined is missing, it will be added to the end of the file which will not respect the initial order.</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=156852013-03-13T15:09:14ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Assignee</strong> set to <i>Jonathan CLARKE</i></li></ul><p>Nicolas PERRON wrote:</p>
<blockquote>
<p>Jonathan CLARKE wrote:</p>
<blockquote>
<p>Nicolas PERRON wrote:</p>
<blockquote>
<p>Jonathan CLARKE wrote:</p>
<p>[...]</p>
</blockquote>
<blockquote>
<ul>
<li><em>Add as one entire block</em> ? This could be usefull if an order is expected in the add of content.</li>
</ul>
</blockquote>
<p>This sounds to me like a separate feature: you seem to be implying that lines are not inserted in order currently. If so, that's a bug and should be filed in a separate ticket. Or is that not the case? If so, please clarify.</p>
</blockquote>
<p>I'm not sure of this but I will test it. It seems to me that if just one line of the block defined is missing, it will be added to the end of the file which will not respect the initial order.</p>
</blockquote>
<p>In fact, If I define A Directive that the file <strong>/tmp/bug_3293.txt</strong> should contain this:<br /><pre>
This is the line 1
This is the line 2
This is the line 3
This is the line 4
This is the line 5
This is the line 6
This is the line 7
</pre></p>
<p>If the file does not exist, all would be fine.</p>
<p>If the file contains:<br /><pre>
#This is the starting comment
This is the line 2
#Some comments there
This is the line 4
This is the line 5
#Other comments appears
This is the line 7
#This is the ending comment
</pre></p>
<p>The result will be:<br /><pre>
#This is the starting comment
This is the line 2
#Some comments there
This is the line 4
This is the line 5
#Other comments appears
This is the line 7
#This is the ending comment
This is the line 1
This is the line 3
This is the line 6
</pre></p>
<p>The result is that lines has been added in order but still are not conform to the block defined in the Directive.</p>
<p>I suppose This is not really a bug but a new feature. What's your opinion, Jon ?</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=160742013-04-02T14:14:07ZMatthieu CERDAmatthieu.cerda@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.3.11</i> to <i>2.3.12</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=173902013-05-02T09:55:45ZMatthieu CERDAmatthieu.cerda@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.3.12</i> to <i>2.3.13</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=179542013-06-05T09:55:45ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.3.13</i> to <i>84</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=182142013-06-14T15:31:33ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>84</i> to <i>2.4.7</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=188892013-07-24T07:29:17ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Status</strong> changed from <i>Discussion</i> to <i>8</i></li><li><strong>Assignee</strong> changed from <i>Jonathan CLARKE</i> to <i>Nicolas PERRON</i></li><li><strong>Target version</strong> changed from <i>2.4.7</i> to <i>2.6.3</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=191222013-07-25T17:21:26ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.6.3</i> to <i>2.6.4</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=195932013-08-19T15:32:40ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Status</strong> changed from <i>8</i> to <i>Discussion</i></li><li><strong>Assignee</strong> changed from <i>Nicolas PERRON</i> to <i>Matthieu CERDA</i></li></ul><p>I don't know how to deal with that issue:</p>
<ul>
<li>There is a "bug" in all versions of this Technique:<br /><pre>
bundle edit_line set_arbitrary_file_content(content, enforce)
{
classes:
"preserve_file_content" expression => strcmp("true", "$(enforce)");
insert_lines:
preserve_file_content::
"$(content)"
insert_type => "preserve_block";
!preserve_file_content::
"$(content)";
}
</pre></li>
</ul>
<p>If the file has to be enforced, it is considered has preserved and then if the content is a block content, it will be preserve. If the file is not enforced, it will be not considered as preserved and then the content will be process for each line....</p>
<p>The use of preserve block will lead to a non convergent promise which will lead itself to a file containing at each run more lines</p>
<ul>
<li>If I try to preserve the block content, like said above, the content will be added at each run. Then, a solution could be to remove each line before to add the content we want but this will lead to a non convergent promise and the reporting will always considered as "repaired" instead of "success".</li>
</ul>
<p>With these informations, I don't know how to do the work. Any idea ?</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=197422013-08-27T11:05:19ZMatthieu CERDAmatthieu.cerda@normation.com
<ul><li><strong>Assignee</strong> changed from <i>Matthieu CERDA</i> to <i>Nicolas PERRON</i></li></ul><p>I think for block edition, a template would be more adapted, but a template is unusable in this case. We are hitting the limits of what we can do here...</p>
<p>Maybe it would be a job to be done in another technique, a templating one ?</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=201192013-08-30T18:23:19ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.6.4</i> to <i>2.6.5</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=203432013-09-06T08:30:43ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.6.5</i> to <i>2.6.6</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=210042013-10-02T17:52:36ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.6.6</i> to <i>2.6.7</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=212732013-10-06T10:15:57ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.6.7</i> to <i>2.6.8</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=215212013-10-08T16:35:32ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.6.8</i> to <i>2.6.9</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=225792013-11-18T18:15:07ZNicolas PERRONnicolas.perron@normation.com
<ul><li><strong>Target version</strong> changed from <i>2.6.9</i> to <i>2.6.10</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=227222013-11-22T13:39:36ZNicolas CHARLESnicolas.charles@rudder.io
<ul><li><strong>Status</strong> changed from <i>Discussion</i> to <i>8</i></li><li><strong>Assignee</strong> changed from <i>Nicolas PERRON</i> to <i>Nicolas CHARLES</i></li></ul><p>i'm taking over the ticket</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=227352013-11-22T16:56:05ZNicolas CHARLESnicolas.charles@rudder.io
<ul></ul><p>Ha. Preserve block is broken in CFEngine<br /><a class="external" href="https://cfengine.com/dev/issues/2315">https://cfengine.com/dev/issues/2315</a></p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=227362013-11-23T20:36:55ZNicolas CHARLESnicolas.charles@rudder.io
<ul></ul><p>after mch tries and tinkering, i cannot get cfengine to manage a block section, with order.<br />I guess the easier way would be to use a module, that would :<br />- check if the section is there (by header)<br />- if it is there, check the content (multiline regexp?)<br />- if it is invalid, replace it</p>
<p>it could look like that<br /><a class="external" href="http://stackoverflow.com/questions/10092328/bash-how-to-check-and-insert-a-string-within-a-block-in-a-file">http://stackoverflow.com/questions/10092328/bash-how-to-check-and-insert-a-string-within-a-block-in-a-file</a></p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=230542013-12-15T19:34:12ZNicolas CHARLESnicolas.charles@rudder.io
<ul><li><strong>Category</strong> set to <i>Techniques</i></li><li><strong>Status</strong> changed from <i>8</i> to <i>Pending technical review</i></li><li><strong>Assignee</strong> changed from <i>Nicolas CHARLES</i> to <i>Jonathan CLARKE</i></li><li><strong>Target version</strong> changed from <i>2.6.10</i> to <i>2.4.13</i></li><li><strong>Pull Request</strong> set to <i>https://github.com/Normation/rudder-techniques/pull/256</i></li></ul><p>Pr is there<br /><a class="external" href="https://github.com/Normation/rudder-techniques/pull/256">https://github.com/Normation/rudder-techniques/pull/256</a></p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=231552013-12-16T16:12:52ZNicolas CHARLESnicolas.charles@rudder.io
<ul></ul><p>PR updated !</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=231742013-12-16T16:51:52ZNicolas CHARLESnicolas.charles@rudder.io
<ul><li><strong>Status</strong> changed from <i>Pending technical review</i> to <i>Pending release</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset commit:6761c7297a9dc424bfea8577e5bee681d68bf3c9.</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=231762013-12-16T17:07:49ZNicolas CHARLESnicolas.charles@rudder.io
<ul><li><strong>Status</strong> changed from <i>Pending release</i> to <i>In progress</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=231772013-12-16T17:11:02ZNicolas CHARLESnicolas.charles@rudder.io
<ul><li><strong>Pull Request</strong> changed from <i>https://github.com/Normation/rudder-techniques/pull/256</i> to <i>https://github.com/Normation/rudder-techniques/pull/258</i></li></ul><p>New PR: <a class="external" href="https://github.com/Normation/rudder-techniques/pull/258">https://github.com/Normation/rudder-techniques/pull/258</a></p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=231852013-12-17T08:20:37ZNicolas CHARLESnicolas.charles@rudder.io
<ul><li><strong>Status</strong> changed from <i>In progress</i> to <i>Pending release</i></li></ul><p>Applied in changeset commit:3b3fae6b9a7d7ce422cf156f03598e88a0259e57.</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=234632014-01-08T11:22:33ZVincent MEMBRÉvme@rudder.io
<ul><li><strong>Status</strong> changed from <i>Pending release</i> to <i>Discussion</i></li></ul><p>bunlde edit_line rudder_ensure_section_content has not been added in stdlib in last pull request, since this issue has not been release, I'm making another one to add it again it</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=234642014-01-08T12:04:42ZVincent MEMBRÉvme@rudder.io
<ul><li><strong>Status</strong> changed from <i>Discussion</i> to <i>Pending technical review</i></li><li><strong>Pull Request</strong> changed from <i>https://github.com/Normation/rudder-techniques/pull/258</i> to <i>https://github.com/Normation/rudder-techniques/pull/264</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=234972014-01-10T09:11:21ZVincent MEMBRÉvme@rudder.io
<ul><li><strong>Status</strong> changed from <i>Pending technical review</i> to <i>Pending release</i></li></ul><p>Applied in changeset commit:eaa87aa59a3d45177c1ccbab3a152d3a12eb5463.</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=234982014-01-10T09:11:21ZNicolas CHARLESnicolas.charles@rudder.io
<ul></ul><p>Applied in changeset commit:bdafec55df1a897d6b029aae5adefab3cf4ff1bc.</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=236632014-01-15T14:02:36ZVincent MEMBRÉvme@rudder.io
<ul><li><strong>Target version</strong> changed from <i>2.4.13</i> to <i>2.6.10</i></li></ul><p>Since we will not make any more releases of 2.4 version, moving all those issues to 2.6</p> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=237762014-01-15T16:39:30ZVincent MEMBRÉvme@rudder.io
<ul><li><strong>Subject</strong> changed from <i>(ex PT/ Technique) Enforce a file content: This is not possible to add a block content or at a specified location of the file.</i> to <i>It is not possible to add a block content or at a specified location of a file using 'Enfore file content' Technique</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=238052014-01-16T11:08:47ZVincent MEMBRÉvme@rudder.io
<ul><li><strong>Subject</strong> changed from <i>It is not possible to add a block content or at a specified location of a file using 'Enfore file content' Technique</i> to <i>It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Technique</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=238152014-01-16T15:35:21ZVincent MEMBRÉvme@rudder.io
<ul><li><strong>Status</strong> changed from <i>Pending release</i> to <i>Released</i></li></ul><p>This bug has been fixed in Rudder 2.6.10 which was released today.<br />Check out: </p>
<ul>
<li>The release announcement: <a class="external" href="http://www.rudder-project.org/pipermail/rudder-announce/2014-January/000070.html">http://www.rudder-project.org/pipermail/rudder-announce/2014-January/000070.html</a></li>
<li>The full ChangeLog: <a class="external" href="http://www.rudder-project.org/foswiki/bin/view/System/Documentation:ChangeLog26">http://www.rudder-project.org/foswiki/bin/view/System/Documentation:ChangeLog26</a></li>
<li>Download information: <a class="external" href="https://www.rudder-project.org/site/get-rudder/downloads/">https://www.rudder-project.org/site/get-rudder/downloads/</a></li>
</ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=384582015-03-11T11:15:28ZBenoît PECCATTEbenoit.peccatte@rudder.io
<ul><li><strong>Project</strong> changed from <i>24</i> to <i>Rudder</i></li><li><strong>Category</strong> changed from <i>Techniques</i> to <i>Techniques</i></li></ul> Rudder - Bug #3293: It is not possible to add a block content or at a specified location of a file using 'Enforce file content' Techniquehttps://issues.rudder.io/issues/3293?journal_id=485542015-12-01T14:53:33ZBenoît PECCATTEbenoit.peccatte@rudder.io
<ul><li><strong>Target version</strong> changed from <i>2.6.10</i> to <i>2.4.12</i></li></ul>