Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

Trouble using cim_instance_array to set MSFT_KeyValuePair parameters #1

Open
Happycoil opened this issue May 11, 2017 · 0 comments
Open

Comments

@Happycoil
Copy link

Hi, here's a repro of yesterday's MSFT_KeyValuePair issues:

https://github.com/Happycoil/cim_bug_repro/blob/master/recipes/default.rb

I'm trying to use this parameter to set the AllowClobber switch: https://github.com/OneGet/oneget/blob/master/src/Microsoft.PackageManagement.DscResources/MSFT_PackageManagement/MSFT_PackageManagement.psm1#L341

This is the error from the repro:

         * dsc_resource[install some module] action run
           
           ================================================================================
           Error executing action `run` on resource 'dsc_resource[install some module]'
           ================================================================================
           
           Chef::Exceptions::PowershellCmdletException
           -------------------------------------------
           Powershell Cmdlet failed: Convert property 'value' value from type 'BOOLEAN' to type 'STRING' failed
       
            At line:5, char:2
       
            Buffer:
       
           r";
       
        value = True;
       
           };^
       
           insta
       
        + CategoryInfo          : SyntaxError: (root/Microsoft/...gurationManager:String) [], CimException
       
        + FullyQualifiedErrorId : MiClientApiError_Failed
       
        + PSComputerName        : localhost

Setting the value to a string obviously doesn't work:

           Chef::Exceptions::PowershellCmdletException
           -------------------------------------------
           Powershell Cmdlet failed: Cannot convert 'System.String' to the type 'System.Management.Automation.SwitchParameter' required by parameter 
       
           'AllowClobber'. 
       
        + CategoryInfo          : InvalidArgument: (:) [], CimException
       
        + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackage
       
        + PSComputerName        : localhost
       
            
       
           The PowerShell DSC resource '[PackageManagement]DirectResourceAccess' with SourceInfo '' threw one or more 
       
           non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel 
       
           called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
       
        + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
       
        + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
       
        + PSComputerName        : localhost

Just passing a hash like one would when using the resource in a DSC config doesn't work either.

Any ideas?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant