summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-11-11 17:10:26 -0800
committerGitHub <noreply@github.com>2020-11-11 17:10:26 -0800
commitd919b75ab7b67726cd7f28817d77f4a26b0de303 (patch)
tree698b5efe1cd888847ceca1553e2e0d72b2489d0b
parent0e5209c379276008064661c2754887bdeff9cf01 (diff)
parent0f11d8dbd353d588ff8d1c8bbf759ee353ca33c2 (diff)
downloadchef-d919b75ab7b67726cd7f28817d77f4a26b0de303.tar.gz
Merge pull request #10632 from chef/reg_example
fix chefstyle violations
-rw-r--r--lib/chef/resource/registry_key.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
index a15406ef46..ac8bb170ee 100644
--- a/lib/chef/resource/registry_key.rb
+++ b/lib/chef/resource/registry_key.rb
@@ -30,7 +30,7 @@ class Chef
examples <<~DOC
**Create a registry key**
```ruby
- registry_key 'HKEY_LOCAL_MACHINE\path-to-key\Policies\System' do
+ registry_key 'HKEY_LOCAL_MACHINE\\path-to-key\\Policies\\System' do
values [{
name: 'EnableLUA',
type: :dword,
@@ -39,7 +39,7 @@ class Chef
action :create
end
```
-
+
**Create a registry key with binary data: "\x01\x02\x03"**:
```ruby
registry_key 'HKEY_CURRENT_USER\\ChefTest' do
@@ -67,7 +67,7 @@ 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>},
@@ -79,7 +79,7 @@ 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'},
]
@@ -89,7 +89,7 @@ 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,
@@ -103,14 +103,13 @@ class Chef
**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
```
Note: Be careful when using the :delete_key action with the recursive attribute. This will delete the registry key, all of its values and all of the names, types, and data associated with them. This cannot be undone by Chef Infra Client.
-
DOC
state_attrs :values