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

Can't insert_lines if referencing a variable that contains an empty string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.10.0
    • Component/s: None
    • Labels:
    • Story Points:
      5
    • Steps to reproduce:
      Acceptance/unit test attached

      Description

      The new behavior is that now we don't insert a line (with insert_lines) if a variables value is an empty string =""= it is not inserted.

      So lets say we want to make sure a file has a couple of lines. The file is a KEY VALUE space separated format. But its acceptable for VALUE to not exist.

      KEY value
      AnotherKeyNoValue
      

      We would represent this in a classic array like this:

      bundle agent main
      {
          "config[KEY]" string => "value";
          "config[AnotherKeyNoValue]" string => "";
      }
      

      And we would use set_config_values or set_line_based from the stdlib to edit the file.

      Now instead of getting the expected results:

      KEY value
      AnotherKeyNoValue
      

      We get the following:

      KEY value
      

        Attachments

          Activity

            People

            • Assignee:
              a10038 jimis (Dimitrios Apostolou)
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel