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

Edit reports every time, even when no change

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.0
    • Labels:
      None
    • Platform:
      Any

      Description

      Issue with "set_variable_values". If a value contains a comma, then "cf-agent -KI" reports every time, even though the edit is usually a no-op.

      Self-contained test below. Note that the value "V1,V2" contains a comma. Run "cf-agent -KI" a few times, noting that it reports every time, even though there is nothing to do. (For normal, expected, mostly-silent behaviour, simply remove the embedded comma.)

      <pre>

      1. CFE 3.6.0: demonstrate bug in reporting result of an edit.
        #
      2. "set_variable_values" attempts to maintain something like:
      3. KEY_A=V1
      4. in the file. Once set, this should normally be a no-op
      5. and "cf-agent -KI" should be silent on the matter.
        #
      6. But if the value contains a comma (","), such as :
      7. KEY_A=V1,V2
      8. it reports every time.

      body common control
      {
      bundlesequence =>

      { "editbug", }

      ;

      inputs =>

      { "/var/cfengine/share/CoreBase/masterfiles/lib/3.6/files.cf", }

      ;
      }

      bundle agent editbug

      { vars: any:: "filename" string => "/tmp/bugfile"; "kv_pairs[KEY_A]" string => "V1,V2"; files: cfengine_3:: "$(filename)" create => "true", edit_line => set_variable_values("$(this.bundle).kv_pairs"); }

      </pre>

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                davidlee David Lee
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel