Chef - Assert registry key exists

479 Views Asked by At

After Chef spins up my Windows box, I use the following Inspec test to assert a registry key exists:

describe registry_key('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client') do
    it { should exist }
end

The test fails with "expected Registry Key to exist"

When I log onto the box I can clearly see the key does exist in that location. What could be the problem? Do I need to wait for a period of time after everything is up and running before performing the check?

1

There are 1 best solutions below

0
On

InSpec code is still Ruby. Try cancelling the backslashes.

describe registry_key('HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\SSL 2.0\\Client') do
  it { should exist }
end