Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
Description
Basic Info
Module Version: Reproduced with 1.0.0 and 1.1.0 (dsc_lite) and 1.2.0 and 1.7.0 (dsc)
Puppet Version: Reproduced on 5.5.7 and 6.1.0
OS Name/Version: Windows Server 2016 (vmpooler 20180912)
Steps to Reproduce:
- Get a win-2016-x86_64 vm on vmpooler
- Install a modern Puppet agent on the VM
- Open PowerShell
- Install the dsc or dsc_lite module: puppet module install dsc_lite
- Set the $env:lib environment variable to something invalid: $env:lib = "C:\invalidpath";
- Create any valid dsc resource and save it to a .pp file (example below)
- Apply any valid dsc or dsc_windowsfeature resource: puppet apply --debug test.pp
Desired Behavior:
When running Puppet code that invokes dsc or dsc_lite and the LIB environment variable contains invalid paths, it fails with a useful error message.
Actual Behavior:
Puppet fails while compiling C# code within init_ps.ps1 with a cryptic no implicit conversion of nil into String message.
PS C:\Users\Administrator> puppet apply .\test.pp
|
Notice: Compiled catalog for skgy0pz2oeoiz3b.delivery.puppetlabs.net in environment production in 0.15 seconds
|
Error: /Stage[main]/Main/Dsc[iis]: Could not evaluate: no implicit conversion of nil into String
|
Notice: Applied catalog in 0.57 seconds
|
test.pp contains any valid dsc resource. In this specific case, it's this example from the dsc_lite module docs:
dsc {'iis':
|
resource_name => 'WindowsFeature',
|
module => 'PSDesiredStateConfiguration',
|
properties => {
|
ensure => 'present',
|
name => 'Web-Server',
|
}
|
}
|
or this example from the dsc module docs:
dsc_windowsfeature {'IIS':
|
dsc_ensure => 'present',
|
dsc_name => 'Web-Server',
|
}
|
Debug output with dsc_lite:
Debug: 2018-10-23 23:11:37 +0000 C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass is running as pid: 1940
|
Debug: 2018-10-23 23:11:38 +0000 PowerShell initialization complete for pid: 1940
|
Debug: Waited 0.0 total seconds.
|
Debug: 2018-10-23 23:11:38 +0000 PIPE> Add-Type : (0) : Warning as Error: Invalid search path 'C:\invalidpath' specified in 'LIB environment variable' -- 'The system cannot find the path specified. '
|
(1) : using System;
|
At C:\ProgramData\PuppetLabs\code\environments\production\modules\dsc_lite\lib\puppet_x\puppetlabs\dsc_lite\templates\init_ps.ps1:325 char:1
|
+ Add-Type -TypeDefinition $hostSource -Language CSharp
|
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
|
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
|
|
Add-Type : Cannot add type. Compilation errors occurred.
|
At C:\ProgramData\PuppetLabs\code\environments\production\modules\dsc_lite\lib\puppet_x\puppetlabs\dsc_lite\templates\init_ps.ps1:325 char:1
|
+ Add-Type -TypeDefinition $hostSource -Language CSharp
|
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
+ CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
|
+ FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
|
|
|
Debug: Dsc Resource returned:
|
Error: /Stage[main]/Main/Dsc[iis]: Could not evaluate: no implicit conversion of nil into String
|
Debug: Class[Main]: Resource is being skipped, unscheduling all events
|
Debug: Stage[main]: Resource is being skipped, unscheduling all events
|
Debug: Finishing transaction 45046860
|
Debug: Storing state
|
Debug: Pruned old state cache entries in 0.00 seconds
|
Debug: 2018-10-23 23:11:38 +0000 PIPE> New-Object : Cannot find type [Puppet.PuppetPSHost]: verify that the assembly containing this type is loaded.
|
At C:\ProgramData\PuppetLabs\code\environments\production\modules\dsc_lite\lib\puppet_x\puppetlabs\dsc_lite\templates\init_ps.ps1:403 char:28
|
+ $global:puppetPSHost = New-Object Puppet.PuppetPSHost
|
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
|
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
|
$env:lib:
PS C:\Users\Administrator> $env:lib
|
C:\invalidpath
|
|
PS C:\Users\Administrator> ls C:\invalidpath
|
ls : Cannot find path 'C:\invalidpath' because it does not exist.
|
At line:1 char:1
|
+ ls C:\invalidpath
|
+ ~~~~~~~~~~~~~~~~~
|
+ CategoryInfo : ObjectNotFound: (C:\invalidpath:String) [Get-ChildItem], ItemNotFoundException
|
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
|
Attachments
Issue Links
- relates to
-
MODULES-9800 dsc_lite : Runs fail with invalid path for ENV['lib']
-
- Resolved
-
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...