Inedo / inedox-windows

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

PSDsc WindowsFeature works as Plan, but not as Configuration Plan #48

Closed pcamelio closed 6 years ago

pcamelio commented 6 years ago

Hello

I have done this as Plan and as Configuration Plan in a Server Role

# AD Powershell
{
    PSDsc WindowsFeature
    (
        Otter_ConfigurationKey: hasRSATADPowerShell,
        Name: RSAT-AD-PowerShell,
        Ensure: Present
    );
}

As Job it is working fine, whereas as Configuraiton Plan I have the followinf error message


Collecting configuration...
Invoke-DscResource -Name $Name -Method Get -Property $Property -ModuleName $ModuleName
Importing Name...
Importing Property...
Importing ModuleName...
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] Commencer l’exécution de la fonctionnalité Get pour la fonctionnalité RSAT-AD-PowerShell.
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] Interrogation de la fonctionnalité RSAT-AD-PowerShell à l’aide de l’applet de commande Get-WindowsFeature du Gestionnaire de serveur.
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] La méthode du fournisseur GetServerComponentsAsync a démarré : RSAT-AD-PowerShell
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] L’appel de la méthode du fournisseur GetServerComponentsAsync a réussi.
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] Terminer l’exécution de la fonctionnalité Get pour la fonctionnalité RSAT-AD-PowerShell.
Invoke-DscResource -Name $Name -Method Test -Property $Property -ModuleName $ModuleName
Importing Name...
Importing Property...
Importing ModuleName...
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] Commencer l’exécution de la fonctionnalité Test pour la fonctionnalité RSAT-AD-PowerShell.
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] Interrogation de la fonctionnalité RSAT-AD-PowerShell à l’aide de l’applet de commande Get-WindowsFeature du Gestionnaire de serveur.
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] La méthode du fournisseur GetServerComponentsAsync a démarré : RSAT-AD-PowerShell
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] L’appel de la méthode du fournisseur GetServerComponentsAsync a réussi.
[VM-089]:                            [[WindowsFeature]DirectResourceAccess] Terminer l’exécution de la fonctionnalité Test pour la fonctionnalité RSAT-AD-PowerShell.
Unhandled exception: System.InvalidOperationException: The Name property of the DSC resource was not found and the operation is missing a "Otter_ConfigurationKey" property whose value is the name of the DSC resource property (or properties) to uniquely identify this configuration.
   at Inedo.Extensions.Windows.Configurations.DSC.DscConfiguration.ExtractConfigurationKey() in C:\projects\inedox-windows\Windows\InedoExtension\Configurations\DSC\DscConfiguration.cs:line 122
   at Inedo.Extensibility.Configurations.PersistedConfiguration.PersistInternalAsync(ConfigurationPersistenceContext context)
   at Inedo.Otter.Service.PlanExecuter.OtterPlanExecuter.<PerformCollection>d__48.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Inedo.Otter.Service.PlanExecuter.OtterPlanExecuter.<Inedo-ExecutionEngine-Executer-IExecutionHostEnvironment-ExecuteActionAsync>d__53.MoveNext()
gdivis commented 6 years ago

Thanks - we'll look into this and let you know if we have any issues reproducing it. We did just release 1.0.6 of this extension with a few DSC fixes, so you may want to test again with that version just to make sure it hasn't already been fixed.

pcamelio commented 6 years ago

I updated to 1.0.6 and the bug is still there :(

gdivis commented 6 years ago

Thanks for testing - we'll take a look at it.

gdivis commented 6 years ago

This should work if you remove the Otter_ConfigurationKey: hasRSATADPowerShell property - from what I've seen there is no hasRSATADPowerShell property returned by DSC for the WindowsFeature type.

By default, it will use the Name property of the returned object if Otter_ConfigurationKey is not specified, which in this case should work. I've tested this and it seems to work for me, but I do get this error when I try to specify that configuration key.

pcamelio commented 6 years ago

Hi It is working fine without Otter_ConfigurationKey I thought that Otter_ConfigurationKey was mandatory J

Thank you