summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-11-11 17:35:00 -0800
committerGitHub <noreply@github.com>2020-11-11 17:35:00 -0800
commit45ba1ed17a33da986480aa1adad26f8cfdfe1869 (patch)
tree84f173aea8fb7cf4123c646bfe5069377e9c5361 /lib
parente2c1f68c41957a680c35892fa4b50c6bb4332173 (diff)
parent4d471fb960ab2130a856e4b36ab7ce23df5bb563 (diff)
downloadchef-45ba1ed17a33da986480aa1adad26f8cfdfe1869.tar.gz
Merge pull request #10634 from chef/doc_failures
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/resource/registry_key.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
index ac8bb170ee..6c17146fcb 100644
--- a/lib/chef/resource/registry_key.rb
+++ b/lib/chef/resource/registry_key.rb
@@ -27,8 +27,9 @@ class Chef
provides(:registry_key) { true }
description "Use the **registry_key** resource to create and delete registry keys in Microsoft Windows."
- examples <<~DOC
+ examples <<~'DOC'
**Create a registry key**
+
```ruby
registry_key 'HKEY_LOCAL_MACHINE\\path-to-key\\Policies\\System' do
values [{
@@ -41,8 +42,9 @@ class Chef
```
**Create a registry key with binary data: "\x01\x02\x03"**:
+
```ruby
- registry_key 'HKEY_CURRENT_USER\\ChefTest' do
+ registry_key 'HKEY_CURRENT_USER\ChefTest' do
values [{
:name => "test",
:type => :binary,
@@ -57,7 +59,7 @@ class Chef
In 64-bit versions of Microsoft Windows, HKEY_LOCAL_MACHINE\SOFTWARE\Example is a re-directed key. In the following examples, because HKEY_LOCAL_MACHINE\SOFTWARE\Example is a 32-bit key, the output will be “Found 32-bit key” if they are run on a version of Microsoft Windows that is 64-bit:
```ruby
- registry_key "HKEY_LOCAL_MACHINE\\SOFTWARE\\Example" do
+ registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\Example' do
architecture :i386
recursive true
action :create
@@ -65,9 +67,10 @@ class Chef
```
**Set proxy settings to be the same as those used by Chef Infra Client**
+
```ruby
proxy = URI.parse(Chef::Config[:http_proxy])
- registry_key 'HKCU\\Software\\Microsoft\\path\\to\\key\\Internet Settings' do
+ registry_key 'HKCU\Software\Microsoft\path\to\key\Internet Settings' do
values [{name: 'ProxyEnable', type: :reg_dword, data: 1},
{name: 'ProxyServer', data: "#{proxy.host}:#{proxy.port}"},
{name: 'ProxyOverride', type: :reg_string, data: <local>},
@@ -77,9 +80,10 @@ class Chef
```
**Set the name of a registry key to "(Default)"**
+
```ruby
registry_key 'Set (Default) value' do
- key 'HKLM\\Software\\Test\\Key\\Path'
+ key 'HKLM\Software\Test\Key\Path'
values [
{name: '', type: :string, data: 'test'},
]
@@ -88,8 +92,9 @@ class Chef
```
**Delete a registry key value**
+
```ruby
- registry_key 'HKEY_LOCAL_MACHINE\\SOFTWARE\\path\\to\\key\\AU' do
+ registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\path\to\key\AU' do
values [{
name: 'NoAutoRebootWithLoggedOnUsers',
type: :dword,
@@ -102,8 +107,9 @@ class Chef
Note: If data: is not specified, you get an error: Missing data key in RegistryKey values hash
**Delete a registry key and its subkeys, recursively**
+
```ruby
- registry_key 'HKCU\\SOFTWARE\\Policies\\path\\to\\key\\Themes' do
+ registry_key 'HKCU\SOFTWARE\Policies\path\to\key\Themes' do
recursive true
action :delete_key
end