patriksvensson / cupboard

A framework for provisioning local environments to a desired state, using the .NET SDK.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot create registry key without value

jetersen opened this issue · comments

There are some registry related things that depend on only having the key.

ie. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Network\NewNetworkWindowOff

Currently this is not possible:

context.Resource<RegistryValue>("Disable New Network Popup")
    .Path(@"HKLM:\System\CurrentControlSet\Control\Network\NewNetworkWindowOff")
    .Ensure(RegistryKeyState.Exist);

As value is checked before making sure the path exist:

if (string.IsNullOrWhiteSpace(resource.Value))
{
_logger.Error($"The registry value for resource '{resource.Name}' has not been set");
return ResourceState.Error;
}

RegistryKeyProvider is marked obsolete and yet also checks for value.

if (resource.Value == null)
{
_logger.Error($"The registry key value for resource '{resource.Name}' has not been set");
return ResourceState.Error;
}