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

puppetlabs-powershell : Conflict with puppetlabs-dsc module

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • None
    • powershell
    • None
    • MODULES Bug Template
    • Windows
    • Customer Feedback
    • Needs Assessment

    Description

      Basic Info
      Module Version: 2.1.1
      Puppet Version: 4.8.2
      OS Name/Version: Microsoft Windows NT 10.0.14393.0 (Windows Server 2016 Standard)

      When puppetlabs-powershell and puppetlabs-dsc modules are enabled some manifests with exec resource and powershell provider fail to run.

      puppetlabs-dsc Module Version: 1.3.0

      After investigation we found that this issue is caused by the conflict of "init_ps.ps1" file.
      Both modules have a file with the same name:

      puppetlabs-dsc/lib/puppet_x/templates/init_ps.ps1
      puppetlabs-powershell/lib/puppet_x/templates/init_ps.ps1
      

      It looks that sync mechanism picks one file "randomly". If the file comes from powershell module all is good, if the file comes from dcs module we get an error.

      Desired Behavior:

      Resource with powershell provider apply the changes.

      Code example:

          exec { 'Set PowerShell execution policy unrestricted':
            command  => 'Set-ExecutionPolicy Unrestricted',
            unless   => 'if ((Get-ExecutionPolicy -Scope LocalMachine) -eq "Unrestricted") { exit 0 } else { exit 1 }',
            provider => powershell
          }
      

      Info: Applying configuration version '1500970896'
      Debug: 2017-07-25 10:21:36 +0200 C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass is running as pid: 594
      Debug: 2017-07-25 10:21:37 +0200 PowerShell initialization complete for pid: 5948
      

      Actual Behavior:

      Resources with powershell provider fail.

      Info: Applying configuration version '1500986149'
      Debug: 2017-07-25 14:35:49 +0200 C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass is runni
       as pid: 4280
      Debug: 2017-07-25 14:35:50 +0200 PowerShell initialization complete for pid: 4280
      Debug: Waited 0.0 total seconds.
      Debug: STDERR: #<EOFError: end of file reached
      Debug: STDERR: C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/puppetlabs/powershell/powershell_manager.rb:314:in `sysread
      Debug: STDERR: C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/puppetlabs/powershell/powershell_manager.rb:314:in `block in read_streams
      Debug: PowerShellManager exiting...
      Debug: 2017-07-25 14:35:50 +0200 C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass is runni
       as pid: 3700
      Debug: 2017-07-25 14:35:51 +0200 PowerShell initialization complete for pid: 3700
      Debug: Waited 0.0 total seconds.
      Debug: STDERR: #<EOFError: end of file reached
      Debug: STDERR: C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/puppetlabs/powershell/powershell_manager.rb:314:in `sysread
      Debug: STDERR: C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/puppetlabs/powershell/powershell_manager.rb:314:in `block in read_streams
      Error: Set-ExecutionPolicy Unrestricted returned -1 instead of one of [0]
      Error: /Stage[main]/Main/Exec[Set PowerShell execution policy unrestricted]/returns: change from notrun to 0 failed: Set-ExecutionPolicy Unrestricted returned
      1 instead of one of [0]
      Debug: Class[Main]: Resource is being skipped, unscheduling all events
      Debug: Stage[main]: Resource is being skipped, unscheduling all events
      Debug: Finishing transaction 57081900
      Debug: Storing state
      Debug: 2017-07-25 14:35:51 +0200 PIPE> Invoke-Expression : A parameter cannot be found that matches parameter name 'ExecEnvironmentVariables'.
      At C:\ProgramData\PuppetLabs\puppet\cache\lib\puppet_x\templates\init_ps.ps1:766 char:21
      +           $result = Invoke-Expression $response.Code
      +                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Invoke-Expression], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeExpressionCommand
      

      Please take a moment and attach any relevant log output and/or manifests. This will help us immensely when troubleshooting the issue.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sebuko Sebastian Bukowiec
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support