0
down vote
favorite
I am trying to write a recipe which should be able to create/update a key in windows registry.
The issue is, the key does not get created until the whole scripts gets completed. I need to use the new value of the created/updated key in the later section of the recipe.
Below is the recipe code I am trying to execute.
require ‘win32/registry’
KEY_PATH= “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Test\Parameters”
registry_key KEY_PATH do
values [{
:name => “Readyforshutdown”,
:type => :dword,
:data => 1
}]
action :create
end
puts 'registry created’
puts 'sleeping '
sleep 30
The output I get is, the registry_key “Readyforshutdown” gets created/updated only after the “sleep 30” also gets executed.
What do I need to do so that I can see the registry_key “Readyforshutdown” gets new value as soon as I get "registry created’ message and not after “sleep 30” (which is end of my script).