Inedo / inedox-windows

Windows extension for Otter and BuildMaster.
BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

PSDsc broken from 1.7.4 to 2.1.2 #65

Closed pcamelio closed 5 years ago

pcamelio commented 5 years ago

Hello PSDsc seems to be broken in 2.12 in some cases while it works fine in 1.7.4 Exemple

            PSDsc SqlServerDsc::sqlscript
            (
                Otter_ConfigurationKey: isMaintenanceSQLPresent,
                ServerInstance: $ServerName\$InstanceSQL,
                SetFilePath: ${Dossier-Destination}\${Dossier-SQL}\${Set-SQL-Script},
                TestFilePath: ${Dossier-Destination}\${Dossier-SQL}\${Test-SQL-Script},
                GetFilePath: ${Dossier-Destination}\${Dossier-SQL}\${Get-SQL-Script},
                GetResult => $CustomVariable
            );

Work fine in 1.7.4 while in 2.1.2 returns the error message Unhandled exception: System.InvalidOperationException: The "Name" property of the DSC resource was not found. Use the "ConfigurationKey" argument for Ensure-DscResource or the "Otter_ConfigurationKey" argument for PSDsc to specify the property which uniquely identifies this resource on the server.

isMaintenanceSQLPresent is a name I set to the DSC. I made several try (unset Otter_ConfigurationKey, set value to sqlscript etc ...) unsuccessfully.

Ensure-DscResource is not working - same behaviour

I am stuck with the 1.7.4 version :( Regards

pcamelio commented 5 years ago

To complete the info after further test, I finally used one of the name of the DSCResource - GetFilePath - and the PSDsc works fine Here is the ressource I am using:

[vm-105]: PS C:\Users\adm-pc\Documents> Get-DscResource -Module SqlServerDsc -name SqlScript | Select-Object -ExpandProperty Properties

Name                 PropertyType   IsMandatory Values
----                 ------------   ----------- ------
GetFilePath          [string]              True {}    
ServerInstance       [string]              True {}    
SetFilePath          [string]              True {}    
TestFilePath         [string]              True {}    
Credential           [PSCredential]       False {}    
DependsOn            [string[]]           False {}    
PsDscRunAsCredential [PSCredential]       False {}    
QueryTimeout         [UInt32]             False {}    
Variable             [string[]]           False {} 

finally, I don't know now if it is the expected behavior and the 1.7.4 was buggy :(

gdivis commented 5 years ago

This looks correct to me. The Otter_ConfigurationKey value refers to the property of the DSC resource which is used to identify it. What is the isMaintenanceSQLPresent value?

pcamelio commented 5 years ago

Hi IsMaintenance SQLPresent was an arbitrary value. I misundertood Otter_Configurationkey. As it was working in 1.7.4 , I thought the migration in 2.xx broke the code while it is not. Thanks you for the reply Regards Philippe

apxltd commented 5 years ago

This has come up a few times. Suggestions on how to improve experience? Better error message?

pcamelio commented 5 years ago

French error message ;) Better error message would be good but more exemples in the documentation would be better I think.