chef 18.9.4 → 18.11.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +16 -12
  3. data/README.md +0 -1
  4. data/Rakefile +21 -5
  5. data/chef-universal-mingw-ucrt.gemspec +4 -2
  6. data/chef.gemspec +17 -14
  7. data/lib/chef/application/apply.rb +1 -1
  8. data/lib/chef/application/base.rb +4 -4
  9. data/lib/chef/application/exit_code.rb +1 -1
  10. data/lib/chef/chef_fs/command_line.rb +4 -4
  11. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +1 -1
  12. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +2 -3
  13. data/lib/chef/client.rb +2 -3
  14. data/lib/chef/compliance/fetcher/chef_server.rb +1 -1
  15. data/lib/chef/compliance/reporter/cli.rb +2 -2
  16. data/lib/chef/compliance/runner.rb +19 -1
  17. data/lib/chef/dsl/chef_vault.rb +1 -1
  18. data/lib/chef/dsl/rest_resource.rb +223 -16
  19. data/lib/chef/encrypted_data_bag_item/decryptor.rb +1 -5
  20. data/lib/chef/environment.rb +1 -1
  21. data/lib/chef/exceptions.rb +1 -1
  22. data/lib/chef/file_cache.rb +1 -5
  23. data/lib/chef/formatters/error_description.rb +8 -1
  24. data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +1 -1
  25. data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +1 -1
  26. data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +1 -1
  27. data/lib/chef/group.rb +1 -1
  28. data/lib/chef/handler/slow_report.rb +1 -1
  29. data/lib/chef/http/authenticator.rb +25 -12
  30. data/lib/chef/mixin/api_version_request_handling.rb +1 -1
  31. data/lib/chef/mixin/powershell_type_coercions.rb +2 -2
  32. data/lib/chef/mixin/securable.rb +2 -2
  33. data/lib/chef/mixin/template.rb +25 -3
  34. data/lib/chef/mixin/versioned_api.rb +1 -1
  35. data/lib/chef/monkey_patches/net-http.rb +8 -8
  36. data/lib/chef/monkey_patches/reline-windows.rb +116 -0
  37. data/lib/chef/property.rb +1 -1
  38. data/lib/chef/provider/cron.rb +1 -1
  39. data/lib/chef/provider/directory.rb +11 -0
  40. data/lib/chef/provider/dsc_resource.rb +2 -2
  41. data/lib/chef/provider/file/content.rb +3 -2
  42. data/lib/chef/provider/file.rb +1 -1
  43. data/lib/chef/provider/git.rb +1 -1
  44. data/lib/chef/provider/ifconfig/debian.rb +1 -1
  45. data/lib/chef/provider/ifconfig/redhat.rb +1 -1
  46. data/lib/chef/provider/mount/linux.rb +1 -1
  47. data/lib/chef/provider/mount/windows.rb +4 -4
  48. data/lib/chef/provider/package/chocolatey.rb +78 -19
  49. data/lib/chef/provider/package/dnf/dnf_helper.py +355 -65
  50. data/lib/chef/provider/package/dnf/python_helper.rb +7 -4
  51. data/lib/chef/provider/package/dnf.rb +25 -6
  52. data/lib/chef/provider/package/homebrew.rb +3 -3
  53. data/lib/chef/provider/package/rubygems.rb +25 -2
  54. data/lib/chef/provider/package/snap.rb +1 -1
  55. data/lib/chef/provider/package/windows/exe.rb +1 -1
  56. data/lib/chef/provider/package/windows/msi.rb +1 -1
  57. data/lib/chef/provider/package/yum/rpm_utils.rb +2 -2
  58. data/lib/chef/provider/package/yum.rb +1 -1
  59. data/lib/chef/provider/powershell_script.rb +84 -84
  60. data/lib/chef/provider/service/debian.rb +2 -4
  61. data/lib/chef/provider/user/dscl.rb +1 -1
  62. data/lib/chef/provider/user/mac.rb +1 -1
  63. data/lib/chef/provider/windows_script.rb +1 -1
  64. data/lib/chef/resource/_rest_resource.rb +9 -7
  65. data/lib/chef/resource/alternatives.rb +41 -41
  66. data/lib/chef/resource/apt_package.rb +31 -31
  67. data/lib/chef/resource/apt_preference.rb +22 -22
  68. data/lib/chef/resource/apt_repository.rb +2 -2
  69. data/lib/chef/resource/archive_file.rb +52 -18
  70. data/lib/chef/resource/bash.rb +129 -129
  71. data/lib/chef/resource/bff_package.rb +15 -15
  72. data/lib/chef/resource/breakpoint.rb +44 -44
  73. data/lib/chef/resource/cab_package.rb +22 -22
  74. data/lib/chef/resource/chef_client_config.rb +251 -89
  75. data/lib/chef/resource/chef_client_cron.rb +18 -18
  76. data/lib/chef/resource/chef_client_launchd.rb +1 -1
  77. data/lib/chef/resource/chef_client_scheduled_task.rb +31 -31
  78. data/lib/chef/resource/chef_client_systemd_timer.rb +16 -16
  79. data/lib/chef/resource/chef_client_trusted_certificate.rb +28 -28
  80. data/lib/chef/resource/chef_handler.rb +107 -107
  81. data/lib/chef/resource/chef_vault_secret.rb +1 -1
  82. data/lib/chef/resource/chocolatey_config.rb +14 -14
  83. data/lib/chef/resource/chocolatey_feature.rb +1 -1
  84. data/lib/chef/resource/chocolatey_installer.rb +60 -42
  85. data/lib/chef/resource/chocolatey_package.rb +1 -1
  86. data/lib/chef/resource/chocolatey_source.rb +15 -15
  87. data/lib/chef/resource/cron/_cron_shared.rb +0 -2
  88. data/lib/chef/resource/cron/cron.rb +70 -70
  89. data/lib/chef/resource/csh.rb +5 -5
  90. data/lib/chef/resource/directory.rb +6 -6
  91. data/lib/chef/resource/dpkg_package.rb +3 -3
  92. data/lib/chef/resource/group.rb +28 -28
  93. data/lib/chef/resource/habitat/habitat_package.rb +80 -80
  94. data/lib/chef/resource/habitat/habitat_sup.rb +93 -95
  95. data/lib/chef/resource/habitat/habitat_sup_systemd.rb +10 -10
  96. data/lib/chef/resource/habitat/habitat_sup_windows.rb +3 -3
  97. data/lib/chef/resource/habitat_config.rb +13 -13
  98. data/lib/chef/resource/habitat_install.rb +17 -17
  99. data/lib/chef/resource/habitat_service.rb +1 -1
  100. data/lib/chef/resource/habitat_user_toml.rb +12 -12
  101. data/lib/chef/resource/helpers/cron_validations.rb +2 -2
  102. data/lib/chef/resource/homebrew_cask.rb +1 -1
  103. data/lib/chef/resource/homebrew_package.rb +20 -20
  104. data/lib/chef/resource/homebrew_tap.rb +1 -1
  105. data/lib/chef/resource/hostname.rb +2 -2
  106. data/lib/chef/resource/http_request.rb +2 -2
  107. data/lib/chef/resource/ifconfig.rb +34 -34
  108. data/lib/chef/resource/inspec_input.rb +37 -37
  109. data/lib/chef/resource/inspec_waiver.rb +63 -63
  110. data/lib/chef/resource/inspec_waiver_file_entry.rb +25 -25
  111. data/lib/chef/resource/ksh.rb +5 -5
  112. data/lib/chef/resource/launchd.rb +2 -2
  113. data/lib/chef/resource/link.rb +8 -8
  114. data/lib/chef/resource/locale.rb +6 -6
  115. data/lib/chef/resource/log.rb +4 -4
  116. data/lib/chef/resource/mdadm.rb +36 -36
  117. data/lib/chef/resource/mount.rb +3 -3
  118. data/lib/chef/resource/msu_package.rb +1 -1
  119. data/lib/chef/resource/ohai.rb +32 -32
  120. data/lib/chef/resource/ohai_hint.rb +24 -24
  121. data/lib/chef/resource/openssl_ec_private_key.rb +2 -2
  122. data/lib/chef/resource/openssl_ec_public_key.rb +2 -2
  123. data/lib/chef/resource/openssl_rsa_private_key.rb +1 -1
  124. data/lib/chef/resource/openssl_rsa_public_key.rb +2 -2
  125. data/lib/chef/resource/openssl_x509_certificate.rb +1 -1
  126. data/lib/chef/resource/openssl_x509_crl.rb +15 -15
  127. data/lib/chef/resource/openssl_x509_request.rb +2 -2
  128. data/lib/chef/resource/osx_profile.rb +54 -54
  129. data/lib/chef/resource/package.rb +6 -6
  130. data/lib/chef/resource/perl.rb +5 -5
  131. data/lib/chef/resource/plist.rb +4 -4
  132. data/lib/chef/resource/powershell_package_source.rb +12 -12
  133. data/lib/chef/resource/python.rb +4 -4
  134. data/lib/chef/resource/reboot.rb +5 -5
  135. data/lib/chef/resource/registry_key.rb +81 -81
  136. data/lib/chef/resource/remote_file.rb +72 -72
  137. data/lib/chef/resource/resource_notification.rb +4 -4
  138. data/lib/chef/resource/rhsm_errata_level.rb +1 -1
  139. data/lib/chef/resource/rhsm_register.rb +2 -2
  140. data/lib/chef/resource/scm/git.rb +79 -79
  141. data/lib/chef/resource/scm/subversion.rb +9 -9
  142. data/lib/chef/resource/script.rb +3 -3
  143. data/lib/chef/resource/selinux_boolean.rb +12 -12
  144. data/lib/chef/resource/selinux_fcontext.rb +21 -21
  145. data/lib/chef/resource/selinux_install.rb +18 -18
  146. data/lib/chef/resource/selinux_login.rb +11 -11
  147. data/lib/chef/resource/selinux_module.rb +16 -16
  148. data/lib/chef/resource/selinux_permissive.rb +9 -9
  149. data/lib/chef/resource/selinux_port.rb +16 -16
  150. data/lib/chef/resource/selinux_state.rb +28 -28
  151. data/lib/chef/resource/selinux_user.rb +14 -14
  152. data/lib/chef/resource/service.rb +5 -5
  153. data/lib/chef/resource/snap_package.rb +16 -16
  154. data/lib/chef/resource/ssh_known_hosts_entry.rb +10 -10
  155. data/lib/chef/resource/sudo.rb +68 -68
  156. data/lib/chef/resource/swap_file.rb +12 -12
  157. data/lib/chef/resource/sysctl.rb +42 -42
  158. data/lib/chef/resource/systemd_unit.rb +38 -38
  159. data/lib/chef/resource/timezone.rb +16 -16
  160. data/lib/chef/resource/user/mac_user.rb +3 -3
  161. data/lib/chef/resource/user.rb +6 -6
  162. data/lib/chef/resource/user_ulimit.rb +22 -22
  163. data/lib/chef/resource/windows_ad_join.rb +25 -25
  164. data/lib/chef/resource/windows_audit_policy.rb +34 -34
  165. data/lib/chef/resource/windows_auto_run.rb +8 -8
  166. data/lib/chef/resource/windows_certificate.rb +20 -20
  167. data/lib/chef/resource/windows_defender.rb +22 -22
  168. data/lib/chef/resource/windows_defender_exclusion.rb +17 -17
  169. data/lib/chef/resource/windows_env.rb +6 -6
  170. data/lib/chef/resource/windows_feature.rb +42 -42
  171. data/lib/chef/resource/windows_feature_dism.rb +8 -8
  172. data/lib/chef/resource/windows_feature_powershell.rb +20 -20
  173. data/lib/chef/resource/windows_firewall_profile.rb +28 -28
  174. data/lib/chef/resource/windows_firewall_rule.rb +47 -47
  175. data/lib/chef/resource/windows_font.rb +7 -7
  176. data/lib/chef/resource/windows_package.rb +59 -59
  177. data/lib/chef/resource/windows_pagefile.rb +29 -29
  178. data/lib/chef/resource/windows_path.rb +12 -12
  179. data/lib/chef/resource/windows_printer.rb +28 -28
  180. data/lib/chef/resource/windows_printer_port.rb +21 -21
  181. data/lib/chef/resource/windows_security_policy.rb +23 -23
  182. data/lib/chef/resource/windows_service.rb +108 -108
  183. data/lib/chef/resource/windows_share.rb +19 -19
  184. data/lib/chef/resource/windows_shortcut.rb +7 -7
  185. data/lib/chef/resource/windows_task.rb +105 -105
  186. data/lib/chef/resource/windows_uac.rb +14 -14
  187. data/lib/chef/resource/windows_update_settings.rb +27 -27
  188. data/lib/chef/resource/windows_user_privilege.rb +59 -59
  189. data/lib/chef/resource/windows_workgroup.rb +12 -12
  190. data/lib/chef/resource/yum_package.rb +1 -1
  191. data/lib/chef/resource/yum_repository.rb +36 -36
  192. data/lib/chef/resource.rb +1 -1
  193. data/lib/chef/resource_collection/resource_set.rb +2 -3
  194. data/lib/chef/resource_inspector.rb +1 -2
  195. data/lib/chef/run_context.rb +2 -2
  196. data/lib/chef/runner.rb +1 -1
  197. data/lib/chef/secret_fetcher/akeyless_vault.rb +0 -1
  198. data/lib/chef/secret_fetcher/hashi_vault.rb +0 -1
  199. data/lib/chef/shell/ext.rb +20 -20
  200. data/lib/chef/shell/shell_session.rb +1 -1
  201. data/lib/chef/shell.rb +7 -0
  202. data/lib/chef/version.rb +1 -1
  203. data/lib/chef/version_constraint.rb +1 -1
  204. data/lib/chef/win32/file/version_info.rb +1 -1
  205. metadata +63 -38
@@ -28,159 +28,159 @@ class Chef
28
28
  description "Use the **habitat_sup** resource to runs a Chef Habitat supervisor for one or more Chef Habitat services. The resource is commonly used in conjunction with `habitat_service` which will manage the services loaded and started within the supervisor."
29
29
  introduced "17.3"
30
30
  examples <<~DOC
31
- **Set up with just the defaults**
31
+ **Set up with just the defaults**
32
32
 
33
- ```ruby
34
- habitat_sup 'default'
35
- ```
33
+ ```ruby
34
+ habitat_sup 'default'
35
+ ```
36
36
 
37
- **Update listen ports and use Supervisor toml config**
37
+ **Update listen ports and use Supervisor toml config**
38
38
 
39
- ```ruby
40
- habitat_sup 'test-options' do
41
- listen_http '0.0.0.0:9999'
42
- listen_gossip '0.0.0.0:9998'
43
- toml_config true
44
- end
45
- ```
39
+ ```ruby
40
+ habitat_sup 'test-options' do
41
+ listen_http '0.0.0.0:9999'
42
+ listen_gossip '0.0.0.0:9998'
43
+ toml_config true
44
+ end
45
+ ```
46
46
 
47
- **Use with an on-prem Habitat Builder. Note: Access to public builder may not be available due to your company policies**
47
+ **Use with an on-prem Habitat Builder. Note: Access to public builder may not be available due to your company policies**
48
48
 
49
- ```ruby
50
- habitat_sup 'default' do
51
- bldr_url 'https://bldr.example.com'
52
- end
53
- ```
49
+ ```ruby
50
+ habitat_sup 'default' do
51
+ bldr_url 'https://bldr.example.com'
52
+ end
53
+ ```
54
54
 
55
- **Using update_condition**
55
+ **Using update_condition**
56
56
 
57
- ```ruby
58
- habitat_sup 'default' do
59
- bldr_url 'https://bldr.example.com'
60
- habitat_channel 'dev'
61
- update_condition 'track-channel'
62
- end
63
- ```
64
-
65
- **Provide event stream information**
66
-
67
- ```ruby
68
- habitat_sup 'default' do
69
- license 'accept'
70
- event_stream_application 'myapp'
71
- event_stream_environment 'production'
72
- event_stream_site 'MySite'
73
- event_stream_url 'automate.example.com:4222'
74
- event_stream_token 'myawesomea2clitoken='
75
- event_stream_cert '/hab/cache/ssl/mycert.crt'
76
- end
77
- ```
57
+ ```ruby
58
+ habitat_sup 'default' do
59
+ bldr_url 'https://bldr.example.com'
60
+ habitat_channel 'dev'
61
+ update_condition 'track-channel'
62
+ end
63
+ ```
64
+
65
+ **Provide event stream information**
66
+
67
+ ```ruby
68
+ habitat_sup 'default' do
69
+ license 'accept'
70
+ event_stream_application 'myapp'
71
+ event_stream_environment 'production'
72
+ event_stream_site 'MySite'
73
+ event_stream_url 'automate.example.com:4222'
74
+ event_stream_token 'myawesomea2clitoken='
75
+ event_stream_cert '/hab/cache/ssl/mycert.crt'
76
+ end
77
+ ```
78
78
 
79
- **Provide specific versions**
79
+ **Provide specific versions**
80
80
 
81
- ```ruby
82
- habitat_sup 'default' do
83
- bldr_url 'https://bldr.example.com'
84
- sup_version '1.5.50'
85
- launcher_version '13458'
86
- service_version '0.6.0' # WINDOWS ONLY
87
- end
88
- ```
81
+ ```ruby
82
+ habitat_sup 'default' do
83
+ bldr_url 'https://bldr.example.com'
84
+ sup_version '1.5.50'
85
+ launcher_version '13458'
86
+ service_version '0.6.0' # WINDOWS ONLY
87
+ end
88
+ ```
89
89
 
90
- **Set latest version of packages to retain**
90
+ **Set latest version of packages to retain**
91
91
 
92
- habitat_sup 'default' do
93
- bldr_url 'https://bldr.example.com'
94
- sup_version '1.5.86'
95
- launcher_version '13458'
96
- service_version '0.6.0' # WINDOWS ONLY
97
- keep_latest '2'
98
- end
99
- ```
92
+ habitat_sup 'default' do
93
+ bldr_url 'https://bldr.example.com'
94
+ sup_version '1.5.86'
95
+ launcher_version '13458'
96
+ service_version '0.6.0' # WINDOWS ONLY
97
+ keep_latest '2'
98
+ end
99
+ ```
100
100
  DOC
101
101
 
102
102
  property :bldr_url, String,
103
- description: "The Habitat Builder URL for the `habitat_package` resource, if needed."
103
+ description: "The Habitat Builder URL for the `habitat_package` resource, if needed."
104
104
 
105
105
  property :permanent_peer, [true, false], default: false,
106
- description: "Only valid for `:run` action, passes `--permanent-peer` to the hab command."
106
+ description: "Only valid for `:run` action, passes `--permanent-peer` to the hab command."
107
107
 
108
108
  property :listen_ctl, String,
109
- description: "Only valid for `:run` action, passes `--listen-ctl` with the specified address and port, e.g., `0.0.0.0:9632`, to the hab command."
109
+ description: "Only valid for `:run` action, passes `--listen-ctl` with the specified address and port, e.g., `0.0.0.0:9632`, to the hab command."
110
110
 
111
111
  property :listen_gossip, String,
112
- description: "Only valid for `:run` action, passes `--listen-gossip` with the specified address and port, e.g., `0.0.0.0:9638`, to the hab command."
112
+ description: "Only valid for `:run` action, passes `--listen-gossip` with the specified address and port, e.g., `0.0.0.0:9638`, to the hab command."
113
113
 
114
114
  property :listen_http, String,
115
- description: "Only valid for `:run` action, passes `--listen-http` with the specified address and port, e.g., `0.0.0.0:9631`, to the hab command."
115
+ description: "Only valid for `:run` action, passes `--listen-http` with the specified address and port, e.g., `0.0.0.0:9631`, to the hab command."
116
116
 
117
117
  property :org, String, default: "default",
118
- description: "Only valid for `:run` action, passes `--org` with the specified org name to the hab command."
118
+ description: "Only valid for `:run` action, passes `--org` with the specified org name to the hab command."
119
119
 
120
120
  property :peer, [String, Array], coerce: proc { |b| b.is_a?(String) ? [b] : b },
121
- description: "Only valid for `:run` action, passes `--peer` with the specified initial peer to the hab command."
121
+ description: "Only valid for `:run` action, passes `--peer` with the specified initial peer to the hab command."
122
122
 
123
123
  property :ring, String,
124
- description: "Only valid for `:run` action, passes `--ring` with the specified ring key name to the hab command."
124
+ description: "Only valid for `:run` action, passes `--ring` with the specified ring key name to the hab command."
125
125
 
126
126
  property :hab_channel, String,
127
- description: "The channel to install Habitat from. Defaults to stable"
127
+ description: "The channel to install Habitat from. Defaults to stable"
128
128
 
129
129
  property :auto_update, [true, false], default: false,
130
- description: "Passes `--auto-update`. This will set the Habitat supervisor to automatically update itself any time a stable version has been released."
130
+ description: "Passes `--auto-update`. This will set the Habitat supervisor to automatically update itself any time a stable version has been released."
131
131
 
132
- property :auth_token, String,
133
- description: "Auth token for accessing a private organization on bldr. This value is templated into the appropriate service file."
132
+ property :auth_token, String, sensitive: true,
133
+ description: "Auth token for accessing a private organization on bldr. This value is templated into the appropriate service file."
134
134
 
135
- property :gateway_auth_token, String,
136
- description: "Auth token for accessing the supervisor's HTTP gateway. This value is templated into the appropriate service file."
135
+ property :gateway_auth_token, String, sensitive: true,
136
+ description: "Auth token for accessing the supervisor's HTTP gateway. This value is templated into the appropriate service file."
137
137
 
138
138
  property :update_condition, String,
139
- description: "Passes `--update-condition` dictating when this service should updated. Defaults to `latest`. Options are `latest` or `track-channel` **_Note: This requires a minimum habitat version of 1.5.71_**
139
+ description: "Passes `--update-condition` dictating when this service should updated. Defaults to `latest`. Options are `latest` or `track-channel` **_Note: This requires a minimum habitat version of 1.5.71_**
140
140
  - `latest`: Runs the latest package that can be found in the configured channel and local packages.
141
141
  - `track-channel`: Always run what is at the head of a given channel. This enables service rollback where demoting a package from a channel will cause the package to rollback to an older version of the package. A ramification of enabling this condition is packages newer than the package at the head of the channel will be automatically uninstalled during a service rollback."
142
142
 
143
143
  property :limit_no_files, String,
144
- description: "allows you to set LimitNOFILE in the systemd service when used Note: Linux Only."
144
+ description: "allows you to set LimitNOFILE in the systemd service when used Note: Linux Only."
145
145
 
146
146
  property :license, String, equal_to: ["accept"],
147
- description: "Specifies acceptance of habitat license when set to `accept`."
147
+ description: "Specifies acceptance of habitat license when set to `accept`."
148
148
 
149
149
  property :health_check_interval, [String, Integer], coerce: proc { |h| h.is_a?(String) ? h : h.to_s },
150
- description: "The interval (seconds) on which to run health checks."
150
+ description: "The interval (seconds) on which to run health checks."
151
151
 
152
152
  property :event_stream_application, String,
153
- description: "The name of your application that will be displayed in the Chef Automate Applications Dashboard."
153
+ description: "The name of your application that will be displayed in the Chef Automate Applications Dashboard."
154
154
 
155
155
  property :event_stream_environment, String,
156
- description: "The application environment for the supervisor, this is for grouping in the Applications Dashboard."
156
+ description: "The application environment for the supervisor, this is for grouping in the Applications Dashboard."
157
157
 
158
158
  property :event_stream_site, String,
159
- description: "Application Dashboard label for the 'site' of the application - can be filtered in the dashboard."
159
+ description: "Application Dashboard label for the 'site' of the application - can be filtered in the dashboard."
160
160
 
161
161
  property :event_stream_url, String,
162
- description: "`AUTOMATE_HOSTNAME:4222` - the Chef Automate URL with port 4222 specified Note: The port can be changed if needed."
162
+ description: "`AUTOMATE_HOSTNAME:4222` - the Chef Automate URL with port 4222 specified Note: The port can be changed if needed."
163
163
 
164
164
  property :event_stream_token, String,
165
- description: "Chef Automate token for sending application event stream data."
165
+ description: "Chef Automate token for sending application event stream data."
166
166
 
167
167
  property :event_stream_cert, String,
168
- description: "With `Intermediary Certificates` or, Automate 2 being set to use TLS with a valid cert, you will need to provide `Habitat` with your certificate for communication with Automate to work. [Follow these steps!](https://automate.chef.io/docs/applications-setup/#share-the-tls-certificate-with-chef-habitat)."
168
+ description: "With `Intermediary Certificates` or, Automate 2 being set to use TLS with a valid cert, you will need to provide `Habitat` with your certificate for communication with Automate to work. [Follow these steps!](https://automate.chef.io/docs/applications-setup/#share-the-tls-certificate-with-chef-habitat)."
169
169
 
170
170
  property :sup_version, String,
171
- description: "Allows you to choose which version of supervisor you would like to install. Note: If a version is provided, it will also install that version of habitat if not previously installed."
171
+ description: "Allows you to choose which version of supervisor you would like to install. Note: If a version is provided, it will also install that version of habitat if not previously installed."
172
172
 
173
173
  property :launcher_version, String,
174
- description: "Allows you to choose which version of launcher to install."
174
+ description: "Allows you to choose which version of launcher to install."
175
175
 
176
176
  property :service_version, String, # Windows only
177
- description: "Allows you to choose which version of the **_Windows Service_** to install."
177
+ description: "Allows you to choose which version of the **_Windows Service_** to install."
178
178
 
179
179
  property :keep_latest, String,
180
- description: "Automatically cleans up old packages. If this flag is enabled, service startup will initiate an uninstall of all previous versions of the associated package. This also applies when a service is restarted due to an update. If a number is passed to this argument, that number of latest versions will be kept. The same logic applies to the Supervisor package `env:HAB_KEEP_LATEST_PACKAGES=1` Note: This requires Habitat version `1.5.86+`"
180
+ description: "Automatically cleans up old packages. If this flag is enabled, service startup will initiate an uninstall of all previous versions of the associated package. This also applies when a service is restarted due to an update. If a number is passed to this argument, that number of latest versions will be kept. The same logic applies to the Supervisor package `env:HAB_KEEP_LATEST_PACKAGES=1` Note: This requires Habitat version `1.5.86+`"
181
181
 
182
182
  property :toml_config, [true, false], default: false,
183
- description: "Supports using the Supervisor toml configuration instead of passing exec parameters to the service, [reference](https://www.habitat.sh/docs/reference/#supervisor-config)."
183
+ description: "Supports using the Supervisor toml configuration instead of passing exec parameters to the service, [reference](https://www.habitat.sh/docs/reference/#supervisor-config)."
184
184
 
185
185
  action :run, description: "The `run` action handles installing Habitat using the `habitat_install` resource, ensures that the appropriate versions of the `core/hab-sup` and `core/hab-launcher` packages are installed using `habitat_package`, and then drops off the appropriate init system definitions and manages the service." do
186
186
  habitat_install new_resource.name do
@@ -281,15 +281,13 @@ class Chef
281
281
  # validate that peers have been passed with a port # for toml file
282
282
  def peer_list_with_port
283
283
  if new_resource.peer
284
- peer_list = []
285
- new_resource.peer.each do |p|
286
- peer_list << if !/.*:.*/.match?(p)
287
- p + ":9632"
288
- else
289
- p
290
- end
284
+ peer_list = new_resource.peer.map do |p|
285
+ if !/.*:.*/.match?(p)
286
+ p + ":9632"
287
+ else
288
+ p
289
+ end
291
290
  end
292
- peer_list
293
291
  end
294
292
  end
295
293
 
@@ -34,16 +34,16 @@ class Chef
34
34
  content(Unit: {
35
35
  Description: "The Habitat Supervisor",
36
36
  },
37
- Service: {
38
- LimitNOFILE: new_resource.limit_no_files,
39
- Environment: service_environment,
40
- ExecStart: "/bin/hab sup run #{exec_start_options}",
41
- ExecStop: "/bin/hab sup term",
42
- Restart: "on-failure",
43
- }.compact,
44
- Install: {
45
- WantedBy: "default.target",
46
- })
37
+ Service: {
38
+ LimitNOFILE: new_resource.limit_no_files,
39
+ Environment: service_environment,
40
+ ExecStart: "/bin/hab sup run #{exec_start_options}",
41
+ ExecStop: "/bin/hab sup term",
42
+ Restart: "on-failure",
43
+ }.compact,
44
+ Install: {
45
+ WantedBy: "default.target",
46
+ })
47
47
  action :create
48
48
  end
49
49
 
@@ -66,9 +66,9 @@ class Chef
66
66
  local true
67
67
  cookbook "habitat"
68
68
  variables exec_start_options: exec_start_options,
69
- bldr_url: new_resource.bldr_url,
70
- auth_token: new_resource.auth_token,
71
- gateway_auth_token: new_resource.gateway_auth_token
69
+ bldr_url: new_resource.bldr_url,
70
+ auth_token: new_resource.auth_token,
71
+ gateway_auth_token: new_resource.gateway_auth_token
72
72
  # win_launcher: win_version
73
73
  action :touch
74
74
  end
@@ -26,18 +26,18 @@ class Chef
26
26
  description "Use the **habitat_config** resource to apply a configuration to a Chef Habitat service."
27
27
  introduced "17.3"
28
28
  examples <<~DOC
29
- **Configure your nginx defaults**
30
-
31
- ```ruby
32
- habitat_config 'nginx.default' do
33
- config({
34
- worker_count: 2,
35
- http: {
36
- keepalive_timeout: 120
37
- }
38
- })
39
- end
40
- ```
29
+ **Configure your nginx defaults**
30
+
31
+ ```ruby
32
+ habitat_config 'nginx.default' do
33
+ config({
34
+ worker_count: 2,
35
+ http: {
36
+ keepalive_timeout: 120
37
+ }
38
+ })
39
+ end
40
+ ```
41
41
  DOC
42
42
 
43
43
  property :config, Mash, required: true, coerce: proc { |m| m.is_a?(Hash) ? Mash.new(m) : m },
@@ -53,7 +53,7 @@ class Chef
53
53
  property :remote_sup_http, String, default: "127.0.0.1:9631", desired_state: false,
54
54
  description: "Address for remote supervisor http port. Used to pull existing."
55
55
 
56
- property :gateway_auth_token, String, desired_state: false,
56
+ property :gateway_auth_token, String, sensitive: true, desired_state: false,
57
57
  description: "Auth token for accessing the remote supervisor's http port."
58
58
 
59
59
  property :user, String, desired_state: false,
@@ -24,28 +24,28 @@ class Chef
24
24
  description "Use the **habitat_install** resource to install Chef Habitat."
25
25
  introduced "17.3"
26
26
  examples <<~DOC
27
- **Installation Without a Resource Name**
27
+ **Installation Without a Resource Name**
28
28
 
29
- ```ruby
30
- habitat_install
31
- ```
29
+ ```ruby
30
+ habitat_install
31
+ ```
32
32
 
33
- **Installation specifying a habitat builder URL**
33
+ **Installation specifying a habitat builder URL**
34
34
 
35
- ```ruby
36
- habitat_install 'install habitat' do
37
- bldr_url 'http://localhost'
38
- end
39
- ```
35
+ ```ruby
36
+ habitat_install 'install habitat' do
37
+ bldr_url 'http://localhost'
38
+ end
39
+ ```
40
40
 
41
- **Installation specifying version and habitat builder URL**
41
+ **Installation specifying version and habitat builder URL**
42
42
 
43
- ```ruby
44
- habitat_install 'install habitat' do
45
- bldr_url 'http://localhost'
46
- hab_version '1.5.50'
47
- end
48
- ```
43
+ ```ruby
44
+ habitat_install 'install habitat' do
45
+ bldr_url 'http://localhost'
46
+ hab_version '1.5.50'
47
+ end
48
+ ```
49
49
  DOC
50
50
 
51
51
  property :name, String, default: "install habitat",
@@ -118,7 +118,7 @@ class Chef
118
118
  property :remote_sup_http, String, default: "127.0.0.1:9631", desired_state: false,
119
119
  description: "IP address and port used to communicate with the remote supervisor. If this value is invalid, the resource will update the supervisor configuration each time #{ChefUtils::Dist::Server::PRODUCT} runs."
120
120
 
121
- property :gateway_auth_token, String, desired_state: false,
121
+ property :gateway_auth_token, String, sensitive: true, desired_state: false,
122
122
  description: "Auth token for accessing the remote supervisor's http port."
123
123
 
124
124
  property :update_condition, [Symbol, String], equal_to: [:latest, "latest", :'track-channel', "track-channel"], default: :latest, coerce: proc { |s| s.is_a?(String) ? s.to_sym : s },
@@ -21,18 +21,18 @@ class Chef
21
21
  description "Use the **habitat_user_toml** to template a `user.toml` for Chef Habitat services. Configurations set in the `user.toml` override the `default.toml` for a given package, which makes it an alternative to applying service group level configuration."
22
22
  introduced "17.3"
23
23
  examples <<~DOC
24
- **Configure user specific settings to nginx**
24
+ **Configure user specific settings to nginx**
25
25
 
26
- ```ruby
27
- habitat_user_toml 'nginx' do
28
- config({
29
- worker_count: 2,
30
- http: {
31
- keepalive_timeout: 120
32
- }
33
- })
34
- end
35
- ```
26
+ ```ruby
27
+ habitat_user_toml 'nginx' do
28
+ config({
29
+ worker_count: 2,
30
+ http: {
31
+ keepalive_timeout: 120
32
+ }
33
+ })
34
+ end
35
+ ```
36
36
  DOC
37
37
 
38
38
  property :config, Mash, required: true, coerce: proc { |m| m.is_a?(Hash) ? Mash.new(m) : m },
@@ -73,7 +73,7 @@ class Chef
73
73
  def wmi_property_from_query(wmi_property, wmi_query)
74
74
  @wmi = ::WIN32OLE.connect("winmgmts://")
75
75
  result = @wmi.ExecQuery(wmi_query)
76
- return unless result.each.count > 0
76
+ return unless result.each.any?
77
77
 
78
78
  result.each.next.send(wmi_property)
79
79
  end
@@ -29,7 +29,7 @@ class Chef
29
29
  return true if spec == "*"
30
30
 
31
31
  if spec.respond_to? :to_int
32
- return spec >= min && spec <= max
32
+ return spec.between?(min, max)
33
33
  end
34
34
 
35
35
  # Lists of individual values, ranges, and step values all share the validity range for type
@@ -38,7 +38,7 @@ class Chef
38
38
  return false unless /^\d+$/.match?(x)
39
39
 
40
40
  x = x.to_i
41
- return false unless x >= min && x <= max
41
+ return false unless x.between?(min, max)
42
42
  end
43
43
  true
44
44
  end
@@ -46,7 +46,7 @@ class Chef
46
46
  property :owner, [String, Integer],
47
47
  description: "The owner of the Homebrew installation.",
48
48
  default: lazy { find_homebrew_username },
49
- default_description: "Calculated default username"\
49
+ default_description: "Calculated default username" \
50
50
 
51
51
  action :install, description: "Install an application that is packaged as a Homebrew cask." do
52
52
  unless casked?
@@ -31,33 +31,33 @@ class Chef
31
31
  description "Use the **homebrew_package** resource to manage packages for the macOS platform. Note: Starting with #{ChefUtils::Dist::Infra::PRODUCT} 16 the homebrew resource now accepts an array of packages for installing multiple packages at once."
32
32
  introduced "12.0"
33
33
  examples <<~DOC
34
- **Install a package**:
34
+ **Install a package**:
35
35
 
36
- ```ruby
37
- homebrew_package 'git'
38
- ```
36
+ ```ruby
37
+ homebrew_package 'git'
38
+ ```
39
39
 
40
- **Install multiple packages at once**:
40
+ **Install multiple packages at once**:
41
41
 
42
- ```ruby
43
- homebrew_package %w(git fish ruby)
44
- ```
42
+ ```ruby
43
+ homebrew_package %w(git fish ruby)
44
+ ```
45
45
 
46
- **Specify the Homebrew user with a UUID**
46
+ **Specify the Homebrew user with a UUID**
47
47
 
48
- ```ruby
49
- homebrew_package 'git' do
50
- homebrew_user 1001
51
- end
52
- ```
48
+ ```ruby
49
+ homebrew_package 'git' do
50
+ homebrew_user 1001
51
+ end
52
+ ```
53
53
 
54
- **Specify the Homebrew user with a string**:
54
+ **Specify the Homebrew user with a string**:
55
55
 
56
- ```ruby
57
- homebrew_package 'vim' do
58
- homebrew_user 'user1'
59
- end
60
- ```
56
+ ```ruby
57
+ homebrew_package 'vim' do
58
+ homebrew_user 'user1'
59
+ end
60
+ ```
61
61
  DOC
62
62
 
63
63
  allowed_actions :install, :upgrade, :remove, :purge
@@ -88,7 +88,7 @@ class Chef
88
88
  "/opt/homebrew",
89
89
  "/usr/local/Homebrew",
90
90
  "/home/linuxbrew/.linuxbrew",
91
- ].filter_map { |x| x if Dir.exist?(x) }.first
91
+ ].select { |x| Dir.exist?(x) }.first
92
92
  tap_dir = name.gsub("/", "/homebrew-")
93
93
  ::File.directory?("#{base_path}/Library/Taps/#{tap_dir}")
94
94
  end
@@ -237,7 +237,7 @@ class Chef
237
237
  mode "0644"
238
238
  end
239
239
  when ::File.exist?("/usr/sbin/svccfg") # solaris 5.11
240
- execute "svccfg -s system/identity:node setprop config/nodename=\'#{new_resource.hostname}\'" do
240
+ execute "svccfg -s system/identity:node setprop config/nodename='#{new_resource.hostname}'" do
241
241
  notifies :run, "execute[svcadm refresh]", :immediately
242
242
  notifies :run, "execute[svcadm restart]", :immediately
243
243
  not_if { shell_out!("svccfg -s system/identity:node listprop config/nodename").stdout.chomp =~ %r{config/nodename\s+astring\s+#{new_resource.hostname}} }
@@ -251,7 +251,7 @@ class Chef
251
251
  action :nothing
252
252
  end
253
253
  else
254
- raise "Do not know how to set hostname on os #{node["os"]}, platform #{node["platform"]},"\
254
+ raise "Do not know how to set hostname on os #{node["os"]}, platform #{node["platform"]}," \
255
255
  "platform_version #{node["platform_version"]}, platform_family #{node["platform_family"]}"
256
256
  end
257
257
 
@@ -31,10 +31,10 @@ class Chef
31
31
  allowed_actions :get, :patch, :put, :post, :delete, :head, :options
32
32
 
33
33
  property :url, String, identity: true,
34
- description: "The URL to which an HTTP request is sent."
34
+ description: "The URL to which an HTTP request is sent."
35
35
 
36
36
  property :headers, Hash, default: {},
37
- description: "A Hash of custom headers."
37
+ description: "A Hash of custom headers."
38
38
 
39
39
  def initialize(name, run_context = nil)
40
40
  super