Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3321

config set adds a preceding newline to value if previous value was empty

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.7.1
    • Fix Version/s: PUP 5.4.0
    • Component/s: None
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Acceptance Criteria:
      Hide

      It should be possible to set a puppet setting to an empty value, and later continue to manage settings using "puppet config".

      Show
      It should be possible to set a puppet setting to an empty value, and later continue to manage settings using "puppet config".
    • Sub-team:
    • Team:
      Platform Core
    • Sprint:
      Platform Core KANBAN
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      Previously, if you tried to add a value to an existing setting that had no value using {{puppet config}}, it would place it on the following line in the conf file. Then when you would try to edit any other setting in the file with {{puppet config}} it would result in a ParseError and add even more extra blank lines to the setting. This solution strips any existing newline characters on the setting before attempting to set the value.
      Show
      Previously, if you tried to add a value to an existing setting that had no value using {{puppet config}}, it would place it on the following line in the conf file. Then when you would try to edit any other setting in the file with {{puppet config}} it would result in a ParseError and add even more extra blank lines to the setting. This solution strips any existing newline characters on the setting before attempting to set the value.
    • QA Risk Assessment:
      Manual

      Description

      Using `puppet config set` to set a value if the value was previously present, puts the value on a separate line and makes the config file unparsable.

      Steps to reproduce
      1. Either add a config entry by hand or with config set with no value
      2. Use `puppet config set` to set the entry with a value

      Result: The value is placed on a separate line.

      Example session showing the error:

      [root@centos6-64-ma environmentpath.6nQgZ4]# cat my.conf 
      [main]
          foo = bar
          bar = baz
      [root@centos6-64-ma environmentpath.6nQgZ4]# puppet config  set foo '' --section main --config my.conf 
      [root@centos6-64-ma environmentpath.6nQgZ4]# cat my.conf 
      [main]
          foo = 
          bar = baz
      [root@centos6-64-ma environmentpath.6nQgZ4]# puppet config  set foo 'bar' --section main --config my.conf 
      [root@centos6-64-ma environmentpath.6nQgZ4]# cat my.conf 
      [main]
          foo = 
      bar
          bar = baz
      [root@centos6-64-ma environmentpath.6nQgZ4]# puppet config  set foo 'foo' --section main --config my.conf 
      Error: Could not parse /tmp/environmentpath.6nQgZ4/my.conf: Could not match line bar
       at /tmp/environmentpath.6nQgZ4/my.conf:3
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kris.bosland Kris Bosland
                Reporter:
                john.duarte John Duarte
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support