Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-3178

DSC - The "dsc_file" Resource Writes UTF-8 Files with BOM

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: dsc
    • Labels:
    • Environment:

      Agent: Windows Server 2012 R2 WMF 5 Production Preview (WIN_SUT)

    • Template:
    • Epic Link:
    • Team:
      Modules

      Description

      Add this to the README for the DSC module under known issues.

      Description

      If a user creates files with the "dsc_file" resource the resulting file on disk will be UTF-8 with BOM. This might be a problem for users that use tools that are not UTF-8 BOM aware.

      Note: Glenn Sarti discovered that this is by design for DSC.

      Attachments

      • None.

      Reproduction Steps

      1. Install Puppet Agent test build on WIN_SUT.
      2. Open a Puppet Console.
      3. Install module via PMT from the Module Forge:

        puppet module install puppetlabs-dsc --module_repository https://api-module-staging.puppetlabs.com --version 1.0.0-b20043-d9668ed2

      4. Execute the following Puppet apply command:

        puppet apply -e "dsc_file { 'test': dsc_ensure => 'present', dsc_type => 'File', dsc_destinationpath => 'c:\file.test', dsc_contents => 'meowmeow' }"

      5. Read the contents of "c:\file.test":

        type c:\file.test

      Expect

      The file contents should be "meowmeow".

      Actual

      The "type" command is not UTF-8 BOM aware so the output appears to have corruption:

      C:\>puppet module install puppetlabs-dsc --module_repository https://api-module-
      staging.puppetlabs.com --version 1.0.0-b20043-d9668ed2
      Notice: Preparing to install into C:/ProgramData/PuppetLabs/code/environments/pr
      oduction/modules ...
      Notice: Downloading from https://api-module-staging.puppetlabs.com ...
      Notice: Installing -- do not interrupt ...
      C:/ProgramData/PuppetLabs/code/environments/production/modules
      └─┬ puppetlabs-dsc (v1.0.0-b20043-d9668ed2)
        ├── puppetlabs-powershell (v1.0.6)
        ├── puppetlabs-reboot (v1.2.1)
        └── puppetlabs-stdlib (v4.10.0)
       
      C:\>puppet apply -e "dsc_file { 'test': dsc_ensure => 'present', dsc_type => 'Fi
      le', dsc_destinationpath => 'c:\file.test', dsc_contents => 'meowmeow' }"
      Notice: Compiled catalog for w2012r2.corp.puppetlabs.net in environment producti
      on in 0.09 seconds
      Notice: /Stage[main]/Main/Dsc_file[test]/ensure: created
      Notice: Applied catalog in 5.81 seconds
       
      C:\>type c:\file.test
      meowmeow
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jorie Jorie Tappa
              Reporter:
              ryan.gard Ryan Gard
              QA Contact:
              Erick Banks
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support