Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-1615

field_edits are always repaired when values we set contains the value_separator character

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Unconfirmed
    • Priority: (None)
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      I'm trying to edit files like fstab, and setting the options in them.
      Fstab is tabulation separated, and options are comma separated

      Using body edit_filed col, that uses comma as a value_separator, the promises is always considered repaird, even if the agent didn't change anything
      It used to work perfectly in cfengine 3.2 -> 3.5.3, and is always repaired in 3.60 and 3.6.1
      Note that the resulting file is correct.

      <pre>
      bundle agent test {

      vars:
      "fstab[options]" string => "async,suid";
      "fstab[origin]" string => "text";

      files:
      "/tmp/fstab"
      edit_line => fstab_add_line("test.fstab"),
      create => "true",
      comment => "Editing the fstab file";
      }

      bundle edit_line fstab_add_line(data_array)
      {

      field_edits:

      "^${${data_array}[origin]}[ \t].*"
      edit_field => col("[ \t]+","2","${${data_array}[options]}","set"),
      classes => classes_generic("line_${index}");

      insert_lines:

      "${${data_array}[origin]} ${${data_array}[options]}"
      ifvarclass => "!line_${index}_repaired",
      classes => classes_generic("line_${index}");

      }
      </pre>

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ncharles Nicolas Charles
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: