Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1793

Facter incorrectly outputs backslash characters in default output

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      Server 2012R2
      Puppet Agent 4.10.8
      Facter 3.6.7

    • Template:
    • Team:
      Platform OS
    • Method Found:
      Inspection
    • QA Risk Assessment:
      Needs Assessment

      Description

      When using a simple custom fact of

      Facter.add(:sqlserver_instances) do
        setcode do
         {"sqlserver_instances" => {
            "SQL_2012" => {},
            "SQL_2014"=> {},
            "SQL_2016"=> {
              "MSSQLSERVER" => {
                "name" => "MSSQLSERVER",
                "version_friendly" => "SQL_2016",
                "version" => "13.1.4001.0",
                "reg_root" => "Software\\Microsoft\\Microsoft SQL Server\\MSSQL13.MSSQLSERVER",
                "features" => [
                  "SQLEngine"
                ]
              }
            }
          }}
        end
      end
      

      Running facter outputs text which does not seem to have the correct backslash escaping

       
      Change FACTERLIB
       
      PS C:\source\sqlserver> facter sqlserver_instances                                                      
      {                                                                                                       
        sqlserver_instances => {                                                                              
          SQL_2012 => {},                                                                                     
          SQL_2014 => {},                                                                                     
          SQL_2016 => {                                                                                       
            MSSQLSERVER => {                                                                                  
              name => "MSSQLSERVER",                                                                          
              version_friendly => "SQL_2016",                                                                 
              version => "13.1.4001.0",                                                                       
              reg_root => "Software\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER",                 <----- These backslashes should be escaped.     
              features => [                                                                                   
                "SQLEngine"                                                                                   
              ]                                                                                               
            }                                                                                                 
          }                                                                                                   
        }                                                                                                     
      }                                                                                                       
      

      Using Puppet Facts
       
         "sqlserver_instances": {
            "sqlserver_instances": {
              "SQL_2012": {
       
              },
              "SQL_2014": {
       
              },
              "SQL_2016": {
                "MSSQLSERVER": {
                  "name": "MSSQLSERVER",
                  "version_friendly": "SQL_2016",
                  "version": "13.1.4001.0",
                  "reg_root": "Software\\Microsoft\\Microsoft SQL Server\\MSSQL13.MSSQLSERVER",
                  "features": [
                    "SQLEngine"
                  ]
                }
              }
            }
          },
      

      Outputing in YAML format
       
      sqlserver_instances:
        sqlserver_instances:
          SQL_2012:
            {}
          SQL_2014:
            {}
          SQL_2016:
            MSSQLSERVER:
              name: MSSQLSERVER
              version_friendly: SQL_2016
              version: 13.1.4001.0
              reg_root: Software\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER
              features:
                - SQLEngine
      PS C:\source\sqlserver>
      

      It is expected that the hash output from facter is ruby-ish so the backslashes should be escaped correctly

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              glenn.sarti Glenn Sarti
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Zendesk Support