chef 17.1.35 → 17.2.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/lib/chef/action_collection.rb +6 -26
  4. data/lib/chef/application.rb +1 -1
  5. data/lib/chef/application/base.rb +15 -0
  6. data/lib/chef/client.rb +6 -0
  7. data/lib/chef/cookbook_version.rb +26 -4
  8. data/lib/chef/data_bag.rb +2 -1
  9. data/lib/chef/data_bag_item.rb +2 -1
  10. data/lib/chef/data_collector.rb +0 -1
  11. data/lib/chef/data_collector/run_end_message.rb +1 -1
  12. data/lib/chef/deprecated.rb +4 -0
  13. data/lib/chef/event_dispatch/base.rb +2 -1
  14. data/lib/chef/exceptions.rb +3 -0
  15. data/lib/chef/handler.rb +46 -8
  16. data/lib/chef/handler/slow_report.rb +66 -0
  17. data/lib/chef/node.rb +20 -19
  18. data/lib/chef/provider/support/zypper_repo.erb +4 -2
  19. data/lib/chef/provider/zypper_repository.rb +27 -31
  20. data/lib/chef/resource/alternatives.rb +5 -5
  21. data/lib/chef/resource/apt_preference.rb +2 -2
  22. data/lib/chef/resource/apt_repository.rb +2 -2
  23. data/lib/chef/resource/apt_update.rb +4 -4
  24. data/lib/chef/resource/build_essential.rb +1 -1
  25. data/lib/chef/resource/chef_client_config.rb +3 -3
  26. data/lib/chef/resource/chef_client_cron.rb +2 -2
  27. data/lib/chef/resource/chef_client_launchd.rb +2 -2
  28. data/lib/chef/resource/chef_client_scheduled_task.rb +14 -14
  29. data/lib/chef/resource/chef_client_systemd_timer.rb +2 -2
  30. data/lib/chef/resource/chef_handler.rb +2 -2
  31. data/lib/chef/resource/chef_sleep.rb +1 -1
  32. data/lib/chef/resource/chocolatey_feature.rb +2 -2
  33. data/lib/chef/resource/chocolatey_source.rb +1 -1
  34. data/lib/chef/resource/cron/cron_d.rb +4 -6
  35. data/lib/chef/resource/cron_access.rb +1 -1
  36. data/lib/chef/resource/dmg_package.rb +1 -1
  37. data/lib/chef/resource/group.rb +4 -4
  38. data/lib/chef/resource/homebrew_cask.rb +17 -6
  39. data/lib/chef/resource/homebrew_package.rb +1 -1
  40. data/lib/chef/resource/homebrew_tap.rb +4 -3
  41. data/lib/chef/resource/homebrew_update.rb +2 -2
  42. data/lib/chef/resource/hostname.rb +49 -7
  43. data/lib/chef/resource/inspec_waiver_file_entry.rb +6 -5
  44. data/lib/chef/resource/kernel_module.rb +6 -6
  45. data/lib/chef/resource/locale.rb +1 -1
  46. data/lib/chef/resource/macos_userdefaults.rb +2 -2
  47. data/lib/chef/resource/ohai_hint.rb +2 -6
  48. data/lib/chef/resource/openbsd_package.rb +17 -0
  49. data/lib/chef/resource/openssl_dhparam.rb +1 -2
  50. data/lib/chef/resource/openssl_ec_private_key.rb +1 -3
  51. data/lib/chef/resource/openssl_ec_public_key.rb +1 -3
  52. data/lib/chef/resource/openssl_rsa_private_key.rb +1 -3
  53. data/lib/chef/resource/openssl_rsa_public_key.rb +1 -3
  54. data/lib/chef/resource/openssl_x509_certificate.rb +1 -4
  55. data/lib/chef/resource/openssl_x509_crl.rb +1 -3
  56. data/lib/chef/resource/openssl_x509_request.rb +1 -3
  57. data/lib/chef/resource/osx_profile.rb +3 -3
  58. data/lib/chef/resource/plist.rb +1 -1
  59. data/lib/chef/resource/powershell_package_source.rb +2 -4
  60. data/lib/chef/resource/reboot.rb +38 -9
  61. data/lib/chef/resource/remote_directory.rb +2 -2
  62. data/lib/chef/resource/rhsm_errata.rb +0 -2
  63. data/lib/chef/resource/rhsm_errata_level.rb +1 -5
  64. data/lib/chef/resource/rhsm_repo.rb +15 -0
  65. data/lib/chef/resource/ssh_known_hosts_entry.rb +4 -7
  66. data/lib/chef/resource/sudo.rb +2 -6
  67. data/lib/chef/resource/swap_file.rb +2 -6
  68. data/lib/chef/resource/sysctl.rb +2 -2
  69. data/lib/chef/resource/timezone.rb +1 -1
  70. data/lib/chef/resource/user_ulimit.rb +2 -2
  71. data/lib/chef/resource/windows_ad_join.rb +2 -2
  72. data/lib/chef/resource/windows_audit_policy.rb +2 -2
  73. data/lib/chef/resource/windows_auto_run.rb +2 -2
  74. data/lib/chef/resource/windows_certificate.rb +1 -1
  75. data/lib/chef/resource/windows_dfs_folder.rb +2 -2
  76. data/lib/chef/resource/windows_dfs_namespace.rb +2 -2
  77. data/lib/chef/resource/windows_dns_record.rb +2 -2
  78. data/lib/chef/resource/windows_dns_zone.rb +2 -2
  79. data/lib/chef/resource/windows_feature.rb +3 -3
  80. data/lib/chef/resource/windows_feature_dism.rb +3 -5
  81. data/lib/chef/resource/windows_feature_powershell.rb +3 -3
  82. data/lib/chef/resource/windows_firewall_profile.rb +2 -2
  83. data/lib/chef/resource/windows_firewall_rule.rb +20 -6
  84. data/lib/chef/resource/windows_font.rb +1 -1
  85. data/lib/chef/resource/windows_pagefile.rb +103 -64
  86. data/lib/chef/resource/windows_path.rb +2 -2
  87. data/lib/chef/resource/windows_printer.rb +5 -20
  88. data/lib/chef/resource/windows_printer_port.rb +48 -65
  89. data/lib/chef/resource/windows_security_policy.rb +2 -2
  90. data/lib/chef/resource/windows_share.rb +2 -2
  91. data/lib/chef/resource/windows_shortcut.rb +1 -1
  92. data/lib/chef/resource/windows_task.rb +1 -1
  93. data/lib/chef/resource/windows_uac.rb +3 -5
  94. data/lib/chef/resource/windows_user_privilege.rb +2 -2
  95. data/lib/chef/resource/windows_workgroup.rb +2 -2
  96. data/lib/chef/resource/yum_package.rb +10 -10
  97. data/lib/chef/resource/zypper_package.rb +4 -4
  98. data/lib/chef/resource/zypper_repository.rb +28 -8
  99. data/lib/chef/resource_reporter.rb +0 -1
  100. data/lib/chef/version.rb +1 -1
  101. data/spec/functional/resource/windows_hostname_spec.rb +91 -0
  102. data/spec/functional/resource/windows_pagefile_spec.rb +98 -0
  103. data/spec/unit/cookbook_version_spec.rb +52 -0
  104. data/spec/unit/data_bag_item_spec.rb +2 -2
  105. data/spec/unit/data_bag_spec.rb +1 -1
  106. data/spec/unit/data_collector_spec.rb +47 -1
  107. data/spec/unit/handler_spec.rb +8 -2
  108. data/spec/unit/provider/zypper_repository_spec.rb +3 -10
  109. data/spec/unit/resource/windows_firewall_rule_spec.rb +12 -7
  110. data/spec/unit/resource/windows_pagefile_spec.rb +4 -9
  111. data/spec/unit/resource/zypper_repository_spec.rb +1 -1
  112. metadata +9 -6
@@ -64,7 +64,7 @@ class Chef
64
64
  end
65
65
  end
66
66
 
67
- action :add, description: "Add an item to the system path" do
67
+ action :add, description: "Add an item to the system path." do
68
68
  # The windows Env provider does not correctly expand variables in
69
69
  # the PATH environment variable. Ruby expects these to be expanded.
70
70
  #
@@ -76,7 +76,7 @@ class Chef
76
76
  end
77
77
  end
78
78
 
79
- action :remove, description: "Remove an item from the system path" do
79
+ action :remove, description: "Remove an item from the system path." do
80
80
  # The windows Env provider does not correctly expand variables in
81
81
  # the PATH environment variable. Ruby expects these to be expanded.
82
82
  #
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Doug Ireton (<doug@1strategy.com>)
3
3
  # Copyright:: 2012-2018, Nordstrom, Inc.
4
+ # Copyright:: Chef Software, Inc.
4
5
  #
5
6
  # Licensed under the Apache License, Version 2.0 (the "License");
6
7
  # you may not use this file except in compliance with the License.
@@ -90,9 +91,7 @@ class Chef
90
91
  name new_resource.name
91
92
  end
92
93
 
93
- action :create, description: "Create a new printer and printer port, if one doesn't already" do
94
- description "Create a new printer and a printer port if one doesn't already exist."
95
-
94
+ action :create, description: "Create a new printer and printer port, if one doesn't already." do
96
95
  if printer_exists?
97
96
  Chef::Log.info "#{@new_resource} already exists - nothing to do."
98
97
  else
@@ -103,20 +102,16 @@ class Chef
103
102
  end
104
103
 
105
104
  action :delete, description: "Delete an existing printer. Note that this resource does not delete the associated printer port." do
106
- description "Delete an existing printer. Note this does not delete the associated printer port."
107
-
108
105
  if printer_exists?
109
- converge_by("Delete #{@new_resource}") do
110
- delete_printer
106
+ converge_by("Delete #{new_resource.device_id}") do
107
+ powershell_exec!("Remove-Printer -Name '#{new_resource.device_id}'")
111
108
  end
112
109
  else
113
- Chef::Log.info "#{@current_resource} doesn't exist - can't delete."
110
+ Chef::Log.info "#{new_resource.device_id} doesn't exist - can't delete."
114
111
  end
115
112
  end
116
113
 
117
114
  action_class do
118
- private
119
-
120
115
  # does the printer exist
121
116
  #
122
117
  # @param [String] name the name of the printer
@@ -136,7 +131,6 @@ class Chef
136
131
 
137
132
  declare_resource(:powershell_script, "Creating printer: #{new_resource.device_id}") do
138
133
  code <<-EOH
139
-
140
134
  Set-WmiInstance -class Win32_Printer `
141
135
  -EnableAllPrivileges `
142
136
  -Argument @{ DeviceID = "#{new_resource.device_id}";
@@ -151,15 +145,6 @@ class Chef
151
145
  EOH
152
146
  end
153
147
  end
154
-
155
- def delete_printer
156
- declare_resource(:powershell_script, "Deleting printer: #{new_resource.device_id}") do
157
- code <<-EOH
158
- $printer = Get-WMIObject -class Win32_Printer -EnableAllPrivileges -Filter "name = '#{new_resource.device_id}'"
159
- $printer.Delete()
160
- EOH
161
- end
162
- end
163
148
  end
164
149
  end
165
150
  end
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Doug Ireton <doug@1strategy.com>
3
3
  # Copyright:: 2012-2018, Nordstrom, Inc.
4
+ # Copyright:: Chef Software, Inc.
4
5
  #
5
6
  # Licensed under the Apache License, Version 2.0 (the "License");
6
7
  # you may not use this file except in compliance with the License.
@@ -68,14 +69,17 @@ class Chef
68
69
  }
69
70
 
70
71
  property :port_name, String,
71
- description: "The port name."
72
+ description: "The port name.",
73
+ default: lazy { |x| "IP_#{x.ipv4_address}" },
74
+ default_description: "The resource block name or the ipv4_address prepended with IP_."
72
75
 
73
76
  property :port_number, Integer,
74
- description: "The port number.",
77
+ description: "The TCP port number.",
75
78
  default: 9100
76
79
 
77
80
  property :port_description, String,
78
- description: "The description of the port."
81
+ desired_state: false,
82
+ deprecated: true
79
83
 
80
84
  property :snmp_enabled, [TrueClass, FalseClass],
81
85
  description: "Determines if SNMP is enabled on the port.",
@@ -86,79 +90,58 @@ class Chef
86
90
  validation_message: "port_protocol must be either 1 for RAW or 2 for LPR!",
87
91
  default: 1, equal_to: [1, 2]
88
92
 
89
- PORTS_REG_KEY = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\\'.freeze unless defined?(PORTS_REG_KEY)
90
-
91
- # @todo Set @current_resource port properties from registry
92
93
  load_current_value do |new_resource|
93
- name new_resource.name
94
- ipv4_address new_resource.ipv4_address
95
- port_name new_resource.port_name || "IP_#{new_resource.ipv4_address}"
96
- end
97
-
98
- action :create, description: "Create the printer port, if one doesn't already exist" do
99
- description "Create the new printer port if it does not already exist."
100
-
101
- if port_exists?
102
- Chef::Log.info "#{@new_resource} already exists - nothing to do."
103
- else
104
- converge_by("Create #{@new_resource}") do
105
- create_printer_port
106
- end
107
- end
108
- end
94
+ port_data = powershell_exec(%Q{Get-WmiObject -Class Win32_TCPIPPrinterPort -Filter "Name='#{new_resource.port_name}'"}).result
109
95
 
110
- action :delete, description: "Delete an existing printer port" do
111
- description "Delete an existing printer port."
112
-
113
- if port_exists?
114
- converge_by("Delete #{@new_resource}") do
115
- delete_printer_port
116
- end
96
+ if port_data.empty?
97
+ current_value_does_not_exist!
117
98
  else
118
- Chef::Log.info "#{@current_resource} doesn't exist - can't delete."
99
+ ipv4_address port_data["HostAddress"]
100
+ port_name port_data["Name"]
101
+ snmp_enabled port_data["SNMPEnabled"]
102
+ port_protocol port_data["Protocol"]
103
+ port_number port_data["PortNumber"]
119
104
  end
120
105
  end
121
106
 
122
- action_class do
123
- private
124
-
125
- def port_exists?
126
- name = new_resource.port_name || "IP_#{new_resource.ipv4_address}"
127
- port_reg_key = PORTS_REG_KEY + name
128
-
129
- logger.trace "Checking to see if this reg key exists: '#{port_reg_key}'"
130
- registry_key_exists?(port_reg_key)
131
- end
132
-
133
- def create_printer_port
134
- port_name = new_resource.port_name || "IP_#{new_resource.ipv4_address}"
135
-
136
- # create the printer port using PowerShell
137
- declare_resource(:powershell_script, "Creating printer port #{new_resource.port_name}") do
138
- code <<-EOH
139
-
140
- Set-WmiInstance -class Win32_TCPIPPrinterPort `
141
- -EnableAllPrivileges `
142
- -Argument @{ HostAddress = "#{new_resource.ipv4_address}";
143
- Name = "#{port_name}";
144
- Description = "#{new_resource.port_description}";
145
- PortNumber = "#{new_resource.port_number}";
146
- Protocol = "#{new_resource.port_protocol}";
147
- SNMPEnabled = "$#{new_resource.snmp_enabled}";
148
- }
107
+ action :create, description: "Create or update the printer port." do
108
+ converge_if_changed do
109
+ if current_resource
110
+ # update the printer port using PowerShell
111
+ powershell_exec! <<-EOH
112
+ Get-WmiObject Win32_TCPIPPrinterPort -EnableAllPrivileges -filter "Name='#{new_resource.port_name}'" |
113
+ ForEach-Object{
114
+ $_.HostAddress='#{new_resource.ipv4_address}'
115
+ $_.PortNumber='#{new_resource.port_number}'
116
+ $_.Protocol='#{new_resource.port_protocol}'
117
+ $_.SNMPEnabled='$#{new_resource.snmp_enabled}'
118
+ $_.Put()
119
+ }
120
+ EOH
121
+ else
122
+ # create the printer port using PowerShell
123
+ powershell_exec! <<-EOH
124
+ Set-WmiInstance -class Win32_TCPIPPrinterPort `
125
+ -EnableAllPrivileges `
126
+ -Argument @{ HostAddress = "#{new_resource.ipv4_address}";
127
+ Name = "#{new_resource.port_name}";
128
+ PortNumber = "#{new_resource.port_number}";
129
+ Protocol = "#{new_resource.port_protocol}";
130
+ SNMPEnabled = "$#{new_resource.snmp_enabled}";
131
+ }
149
132
  EOH
150
133
  end
151
- end
152
134
 
153
- def delete_printer_port
154
- port_name = new_resource.port_name || "IP_#{new_resource.ipv4_address}"
135
+ end
136
+ end
155
137
 
156
- declare_resource(:powershell_script, "Deleting printer port: #{new_resource.port_name}") do
157
- code <<-EOH
158
- $port = Get-WMIObject -class Win32_TCPIPPrinterPort -EnableAllPrivileges -Filter "name = '#{port_name}'"
159
- $port.Delete()
160
- EOH
138
+ action :delete, description: "Delete an existing printer port." do
139
+ if current_resource
140
+ converge_by("Delete #{new_resource.port_name}") do
141
+ powershell_exec!("Remove-PrinterPort -Name #{new_resource.port_name}")
161
142
  end
143
+ else
144
+ Chef::Log.info "#{new_resource.port_name} doesn't exist - can't delete."
162
145
  end
163
146
  end
164
147
  end
@@ -90,8 +90,8 @@ class Chef
90
90
  current_state = load_security_options
91
91
 
92
92
  if new_resource.secoption == "ResetLockoutCount"
93
- if new_resource.secvalue.to_i > 30
94
- raise Chef::Exceptions::ValidationFailed, "The \"ResetLockoutCount\" value cannot be greater than 30 minutes"
93
+ if new_resource.secvalue.to_i > current_state["LockoutDuration"].to_i
94
+ raise Chef::Exceptions::ValidationFailed, "The \"ResetLockoutCount\" value cannot be greater than the value currently set for \"LockoutDuration\""
95
95
  end
96
96
  end
97
97
  if (new_resource.secoption == "ResetLockoutCount" || new_resource.secoption == "LockoutDuration") && current_state["LockoutBadCount"] == "0"
@@ -192,7 +192,7 @@ class Chef
192
192
  name
193
193
  end
194
194
 
195
- action :create, description: "Create or modify a Windows share" do
195
+ action :create, description: "Create or modify a Windows share." do
196
196
  # we do this here instead of requiring the property because :delete doesn't need path set
197
197
  raise "No path property set" unless new_resource.path
198
198
 
@@ -216,7 +216,7 @@ class Chef
216
216
  end
217
217
  end
218
218
 
219
- action :delete, description: "Delete an existing Windows share" do
219
+ action :delete, description: "Delete an existing Windows share." do
220
220
  if current_resource.nil?
221
221
  Chef::Log.debug("#{new_resource.share_name} does not exist - nothing to do")
222
222
  else
@@ -69,7 +69,7 @@ class Chef
69
69
  iconlocation(link.IconLocation)
70
70
  end
71
71
 
72
- action :create, description: "Create or modify a Windows shortcut" do
72
+ action :create, description: "Create or modify a Windows shortcut." do
73
73
  converge_if_changed do
74
74
  converge_by "creating shortcut #{new_resource.shortcut_name}" do
75
75
  link = WIN32OLE.new("WScript.Shell").CreateShortcut(new_resource.shortcut_name)
@@ -49,7 +49,7 @@ class Chef
49
49
 
50
50
  **Create a scheduled task to run every 2 days**:
51
51
 
52
- ``` ruby
52
+ ```ruby
53
53
  windows_task 'chef-client' do
54
54
  command 'chef-client'
55
55
  run_level :highest
@@ -29,7 +29,7 @@ class Chef
29
29
  examples <<~DOC
30
30
  **Disable UAC prompts for the admin**:
31
31
 
32
- ``` ruby
32
+ ```ruby
33
33
  windows_uac 'Disable UAC prompts for the admin' do
34
34
  enable_uac true
35
35
  prompt_on_secure_desktop false
@@ -39,7 +39,7 @@ class Chef
39
39
 
40
40
  **Disable UAC entirely**:
41
41
 
42
- ``` ruby
42
+ ```ruby
43
43
  windows_uac 'Disable UAC entirely' do
44
44
  enable_uac false
45
45
  end
@@ -72,9 +72,7 @@ class Chef
72
72
  equal_to: %i{auto_deny secure_prompt_for_creds prompt_for_creds},
73
73
  default: :prompt_for_creds
74
74
 
75
- action :configure, description: "Configures UAC by setting registry keys at `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System`" do
76
- description 'Configures UAC by setting registry keys at \'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\''
77
-
75
+ action :configure, description: "Configures UAC by setting registry keys at `HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System`." do
78
76
  registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' do
79
77
  values [{ name: "EnableLUA", type: :dword, data: bool_to_reg(new_resource.enable_uac) },
80
78
  { name: "ValidateAdminCodeSignatures", type: :dword, data: bool_to_reg(new_resource.require_signed_binaries) },
@@ -147,7 +147,7 @@ class Chef
147
147
  end
148
148
  end
149
149
 
150
- action :add, description: "Add a user privilege" do
150
+ action :add, description: "Add a user privilege." do
151
151
  ([*new_resource.privilege] - [*current_resource.privilege]).each do |user_right|
152
152
  converge_by("adding user '#{new_resource.principal}' privilege #{user_right}") do
153
153
  Chef::ReservedNames::Win32::Security.add_account_right(new_resource.principal, user_right)
@@ -155,7 +155,7 @@ class Chef
155
155
  end
156
156
  end
157
157
 
158
- action :set, description: "Set the privileges that are listed in the `privilege` property for only the users listed in the `users` property" do
158
+ action :set, description: "Set the privileges that are listed in the `privilege` property for only the users listed in the `users` property." do
159
159
  if new_resource.users.nil? || new_resource.users.empty?
160
160
  raise Chef::Exceptions::ValidationFailed, "Users are required property with set action."
161
161
  end
@@ -30,13 +30,13 @@ class Chef
30
30
  examples <<~DOC
31
31
  **Join a workgroup**:
32
32
 
33
- ``` ruby
33
+ ```ruby
34
34
  windows_workgroup 'myworkgroup'
35
35
  ```
36
36
 
37
37
  **Join a workgroup using a specific user**:
38
38
 
39
- ``` ruby
39
+ ```ruby
40
40
  windows_workgroup 'myworkgroup' do
41
41
  user 'Administrator'
42
42
  password 'passw0rd'
@@ -35,32 +35,32 @@ class Chef
35
35
  examples <<~DOC
36
36
  **Install an exact version**:
37
37
 
38
- ``` ruby
38
+ ```ruby
39
39
  yum_package 'netpbm = 10.35.58-8.el8'
40
40
  ```
41
41
 
42
42
  **Install a minimum version**:
43
43
 
44
- ``` ruby
44
+ ```ruby
45
45
  yum_package 'netpbm >= 10.35.58-8.el8'
46
46
  ```
47
47
 
48
48
  **Install a minimum version using the default action**:
49
49
 
50
- ``` ruby
50
+ ```ruby
51
51
  yum_package 'netpbm'
52
52
  ```
53
53
 
54
54
  **Install a version without worrying about the exact release**:
55
55
 
56
- ``` ruby
56
+ ```ruby
57
57
  yum_package 'netpbm-10.35*'
58
58
  ```
59
59
 
60
60
 
61
61
  **To install a package**:
62
62
 
63
- ``` ruby
63
+ ```ruby
64
64
  yum_package 'netpbm' do
65
65
  action :install
66
66
  end
@@ -68,13 +68,13 @@ class Chef
68
68
 
69
69
  **To install a partial minimum version**:
70
70
 
71
- ``` ruby
71
+ ```ruby
72
72
  yum_package 'netpbm >= 10'
73
73
  ```
74
74
 
75
75
  **To install a specific architecture**:
76
76
 
77
- ``` ruby
77
+ ```ruby
78
78
  yum_package 'netpbm' do
79
79
  arch 'i386'
80
80
  end
@@ -82,13 +82,13 @@ class Chef
82
82
 
83
83
  or:
84
84
 
85
- ``` ruby
85
+ ```ruby
86
86
  yum_package 'netpbm.x86_64'
87
87
  ```
88
88
 
89
89
  **To install a specific version-release**
90
90
 
91
- ``` ruby
91
+ ```ruby
92
92
  yum_package 'netpbm' do
93
93
  version '10.35.58-8.el8'
94
94
  end
@@ -101,7 +101,7 @@ class Chef
101
101
  to dump the in-memory Yum cache, and then use the repository immediately
102
102
  to ensure that the correct package is installed:
103
103
 
104
- ``` ruby
104
+ ```ruby
105
105
  cookbook_file '/etc/yum.repos.d/custom.repo' do
106
106
  source 'custom'
107
107
  mode '0755'
@@ -30,7 +30,7 @@ class Chef
30
30
  examples <<~DOC
31
31
  **Install a package using package manager:**
32
32
 
33
- ``` ruby
33
+ ```ruby
34
34
  zypper_package 'name of package' do
35
35
  action :install
36
36
  end
@@ -38,7 +38,7 @@ class Chef
38
38
 
39
39
  **Install a package using local file:**
40
40
 
41
- ``` ruby
41
+ ```ruby
42
42
  zypper_package 'jwhois' do
43
43
  action :install
44
44
  source '/path/to/jwhois.rpm'
@@ -47,10 +47,10 @@ class Chef
47
47
 
48
48
  **Install without using recommend packages as a dependency:**
49
49
 
50
- ``` ruby
50
+ ```ruby
51
51
  package 'apache2' do
52
52
  options '--no-recommends'
53
- end
53
+ end
54
54
  ```
55
55
  DOC
56
56