Uploaded image for project: 'Puppet Task Runner'
  1. Puppet Task Runner
  2. BOLT-1344

run_command inserting a BOM in command

    Details

    • Template:
    • Team:
      Bolt
    • Method Found:
      Manual Test
    • QA Risk Assessment:
      Needs Assessment

      Description

      Puppet Version:
      bolt 1.20.0
      puppet litmus 0.2.0

      OS Name/Version:
      Test runner - Mac OSX 10.14.4
      System under test - Windows 2016, vm pooler win-2016-x86_64

      Describe your issue in as much detail as possible...
      When running a "run_shell" method via Litmus, which calls out to Bot's "run_command" a Byte Order Mark (BOM, represented by hex value U+FEFF) is being inserted into my command rendering the output on the system under test not runnable.

      Desired Behavior:
      When "run_command" is given a string it does not insert undesired BOM into the string.

      Actual Behavior:
      "run_command" inserts BOM into my string that gets written to file as a string with a leading "?" like so:

      ?try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{"DestinationPath"="C:/test/test.txt";"Contents"="catcat"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }
      

      Steps to repro:
      Execute "run_command" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb:229 with the string "command" equal to

      "Set-Content -Path C:/temp/temp.ps1 -Value 'try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{\"DestinationPath\"=\"C:/test/test.txt\";\"Contents\"=\"catcat\"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }' -Encoding ASCII"
      

      Note "description" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb @ line 154 is correct.

      However by "results @object" at .bundle/gems/ruby/2.3.0/gems/bolt-1.20.0/lib/bolt/executor.rb @ line 156 the string now has an added BOM before "try":

      "Set-Content -Path C:/temp/temp.ps1 -Value '<U+FEFF>try { if (Invoke-DscResource -Name File -Method Test -ModuleName C:/ProgramData/PuppetLabs/code/environments/production/modules/dsc/lib/puppet_x/dsc_resources/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 -Verbose -Property @{\"DestinationPath\"=\"C:/test/test.txt\";\"Contents\"=\"catcat\"}) { exit 0 } else { exit 1 } } catch { Write-Host $_.Exception.Message; exit 1 }' -Encoding ASCII"
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              erick Erick Banks
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support