chef 15.3.14-universal-mingw32 → 15.4.45-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/chef.gemspec +2 -2
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/event_dispatch/dispatcher.rb +9 -2
- data/lib/chef/formatters/doc.rb +3 -3
- data/lib/chef/knife.rb +13 -3
- data/lib/chef/knife/bootstrap.rb +28 -4
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +7 -8
- data/lib/chef/knife/data_bag_secret_options.rb +11 -4
- data/lib/chef/knife/download.rb +2 -2
- data/lib/chef/knife/exec.rb +9 -1
- data/lib/chef/knife/ssh.rb +1 -1
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/supermarket_list.rb +19 -7
- data/lib/chef/knife/supermarket_search.rb +3 -2
- data/lib/chef/node/attribute.rb +2 -0
- data/lib/chef/node/attribute_collections.rb +8 -0
- data/lib/chef/node/immutable_collections.rb +12 -0
- data/lib/chef/node/mixin/immutablize_array.rb +1 -0
- data/lib/chef/node/mixin/immutablize_hash.rb +1 -0
- data/lib/chef/provider.rb +14 -8
- data/lib/chef/provider/package/chocolatey.rb +11 -3
- data/lib/chef/provider/package/dnf/python_helper.rb +8 -3
- data/lib/chef/provider/package/windows/exe.rb +2 -2
- data/lib/chef/provider/package/windows/msi.rb +3 -3
- data/lib/chef/provider/package/yum/python_helper.rb +8 -3
- data/lib/chef/provider/service/windows.rb +1 -1
- data/lib/chef/resource/apt_repository.rb +19 -13
- data/lib/chef/resource/apt_update.rb +15 -1
- data/lib/chef/resource/archive_file.rb +10 -1
- data/lib/chef/resource/build_essential.rb +14 -1
- data/lib/chef/resource/chocolatey_config.rb +17 -1
- data/lib/chef/resource/chocolatey_feature.rb +15 -0
- data/lib/chef/resource/chocolatey_package.rb +31 -1
- data/lib/chef/resource/chocolatey_source.rb +17 -1
- data/lib/chef/resource/cookbook_file.rb +1 -1
- data/lib/chef/resource/cron_access.rb +22 -1
- data/lib/chef/resource/cron_d.rb +46 -1
- data/lib/chef/resource/dmg_package.rb +28 -0
- data/lib/chef/resource/kernel_module.rb +61 -0
- data/lib/chef/resource/sudo.rb +2 -2
- data/lib/chef/resource/windows_ad_join.rb +72 -3
- data/lib/chef/resource/windows_service.rb +1 -1
- data/lib/chef/resource/windows_share.rb +2 -1
- data/lib/chef/shell.rb +4 -4
- data/lib/chef/shell/ext.rb +2 -2
- data/lib/chef/train_transport.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/ifconfig_spec.rb +0 -2
- data/spec/functional/resource/mount_spec.rb +0 -4
- data/spec/functional/util/powershell/cmdlet_spec.rb +2 -2
- data/spec/integration/knife/chef_repo_path_spec.rb +4 -2
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +19 -19
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/formatters/doc_spec.rb +18 -0
- data/spec/unit/knife/bootstrap_spec.rb +46 -10
- data/spec/unit/knife/supermarket_list_spec.rb +70 -0
- data/spec/unit/knife/supermarket_search_spec.rb +85 -0
- data/spec/unit/node/attribute_spec.rb +22 -0
- data/spec/unit/node/immutable_collections_spec.rb +72 -144
- data/spec/unit/provider/package/chocolatey_spec.rb +50 -35
- data/spec/unit/provider/package/windows/exe_spec.rb +1 -1
- data/spec/unit/provider/service/windows_spec.rb +23 -3
- data/spec/unit/resource/chocolatey_package_spec.rb +17 -2
- data/spec/unit/resource/windows_ad_join_spec.rb +4 -0
- data/spec/unit/resource/windows_service_spec.rb +5 -0
- data/spec/unit/resource/windows_share_spec.rb +7 -0
- data/tasks/docs.rb +4 -1
- metadata +10 -8
data/lib/chef/provider.rb
CHANGED
@@ -272,11 +272,17 @@ class Chef
|
|
272
272
|
raise ArgumentError, "converge_if_changed must be passed a block!"
|
273
273
|
end
|
274
274
|
|
275
|
-
properties =
|
276
|
-
|
275
|
+
properties =
|
276
|
+
if properties.empty?
|
277
|
+
new_resource.class.state_properties
|
278
|
+
else
|
279
|
+
properties.map { |property| new_resource.class.properties[property] }
|
280
|
+
end
|
281
|
+
|
277
282
|
if current_resource
|
278
283
|
# Collect the list of modified properties
|
279
|
-
specified_properties = properties.select { |property|
|
284
|
+
specified_properties = properties.select { |property| property.is_set?(new_resource) || property.has_default? }
|
285
|
+
specified_properties = specified_properties.map(&:name).map(&:to_sym)
|
280
286
|
modified = specified_properties.select { |p| new_resource.send(p) != current_resource.send(p) }
|
281
287
|
if modified.empty?
|
282
288
|
properties_str = if new_resource.sensitive
|
@@ -309,15 +315,15 @@ class Chef
|
|
309
315
|
else
|
310
316
|
# The resource doesn't exist. Mark that we are *creating* this, and
|
311
317
|
# write down any properties we are setting.
|
312
|
-
property_size = properties.map(&:size).max
|
318
|
+
property_size = properties.map(&:name).map(&:to_sym).map(&:size).max
|
313
319
|
created = properties.map do |property|
|
314
|
-
default = " (default value)" unless
|
315
|
-
properties_str = if new_resource.sensitive ||
|
320
|
+
default = " (default value)" unless property.is_set?(new_resource)
|
321
|
+
properties_str = if new_resource.sensitive || property.sensitive?
|
316
322
|
"(suppressed sensitive property)"
|
317
323
|
else
|
318
|
-
new_resource.send(property).inspect
|
324
|
+
new_resource.send(property.name.to_sym).inspect
|
319
325
|
end
|
320
|
-
" set #{property.to_s.ljust(property_size)} to #{properties_str}#{default}"
|
326
|
+
" set #{property.name.to_sym.to_s.ljust(property_size)} to #{properties_str}#{default}"
|
321
327
|
end
|
322
328
|
|
323
329
|
converge_by([ "create #{new_resource.identity}" ] + created, &converge_block)
|
@@ -210,7 +210,7 @@ class Chef
|
|
210
210
|
# @return [String] options from new_resource or empty string
|
211
211
|
def cmd_args(include_source: true)
|
212
212
|
cmd_args = [ new_resource.options ]
|
213
|
-
cmd_args
|
213
|
+
cmd_args += common_options(include_source: include_source)
|
214
214
|
cmd_args
|
215
215
|
end
|
216
216
|
|
@@ -227,8 +227,8 @@ class Chef
|
|
227
227
|
available_versions =
|
228
228
|
begin
|
229
229
|
cmd = [ "list", "-r", pkg ]
|
230
|
-
cmd
|
231
|
-
cmd.push( new_resource.
|
230
|
+
cmd += common_options
|
231
|
+
cmd.push( new_resource.list_options ) if new_resource.list_options
|
232
232
|
|
233
233
|
raw = parse_list_output(*cmd)
|
234
234
|
raw.keys.each_with_object({}) do |name, available|
|
@@ -272,6 +272,14 @@ class Chef
|
|
272
272
|
def lowercase_names(names)
|
273
273
|
names.map(&:downcase)
|
274
274
|
end
|
275
|
+
|
276
|
+
def common_options(include_source: true)
|
277
|
+
args = []
|
278
|
+
args.push( [ "-source", new_resource.source ] ) if new_resource.source && include_source
|
279
|
+
args.push( [ "--user", new_resource.user ] ) if new_resource.user
|
280
|
+
args.push( [ "--password", new_resource.password ]) if new_resource.password
|
281
|
+
args
|
282
|
+
end
|
275
283
|
end
|
276
284
|
end
|
277
285
|
end
|
@@ -38,9 +38,14 @@ class Chef
|
|
38
38
|
|
39
39
|
def dnf_command
|
40
40
|
# platform-python is used for system tools on RHEL 8 and is installed under /usr/libexec
|
41
|
-
@dnf_command ||=
|
42
|
-
|
43
|
-
|
41
|
+
@dnf_command ||= begin
|
42
|
+
cmd = which("platform-python", "python", "python3", "python2", "python2.7", extra_path: "/usr/libexec") do |f|
|
43
|
+
shell_out("#{f} -c 'import dnf'").exitstatus == 0
|
44
|
+
end
|
45
|
+
raise Chef::Exceptions::Package, "cannot find dnf libraries, you may need to use yum_package" unless cmd
|
46
|
+
|
47
|
+
"#{cmd} #{DNF_HELPER}"
|
48
|
+
end
|
44
49
|
end
|
45
50
|
|
46
51
|
def start
|
@@ -64,7 +64,7 @@ class Chef
|
|
64
64
|
unattended_flags,
|
65
65
|
expand_options(new_resource.options),
|
66
66
|
"& exit %%%%ERRORLEVEL%%%%",
|
67
|
-
].join(" "), timeout: new_resource.timeout, returns: new_resource.returns, sensitive: new_resource.sensitive
|
67
|
+
].join(" "), default_env: false, timeout: new_resource.timeout, returns: new_resource.returns, sensitive: new_resource.sensitive
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
@@ -73,7 +73,7 @@ class Chef
|
|
73
73
|
uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) }
|
74
74
|
.map(&:uninstall_string).uniq.each do |uninstall_string|
|
75
75
|
logger.trace("Registry provided uninstall string for #{new_resource} is '#{uninstall_string}'")
|
76
|
-
shell_out!(uninstall_command(uninstall_string), timeout: new_resource.timeout, returns: new_resource.returns)
|
76
|
+
shell_out!(uninstall_command(uninstall_string), default_env: false, timeout: new_resource.timeout, returns: new_resource.returns)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -70,14 +70,14 @@ class Chef
|
|
70
70
|
def install_package
|
71
71
|
# We could use MsiConfigureProduct here, but we'll start off with msiexec
|
72
72
|
logger.trace("#{new_resource} installing MSI package '#{new_resource.source}'")
|
73
|
-
shell_out!("msiexec /qn /i \"#{new_resource.source}\" #{expand_options(new_resource.options)}", timeout: new_resource.timeout, returns: new_resource.returns)
|
73
|
+
shell_out!("msiexec /qn /i \"#{new_resource.source}\" #{expand_options(new_resource.options)}", default_env: false, timeout: new_resource.timeout, returns: new_resource.returns)
|
74
74
|
end
|
75
75
|
|
76
76
|
def remove_package
|
77
77
|
# We could use MsiConfigureProduct here, but we'll start off with msiexec
|
78
78
|
if !new_resource.source.nil? && ::File.exist?(new_resource.source)
|
79
79
|
logger.trace("#{new_resource} removing MSI package '#{new_resource.source}'")
|
80
|
-
shell_out!("msiexec /qn /x \"#{new_resource.source}\" #{expand_options(new_resource.options)}", timeout: new_resource.timeout, returns: new_resource.returns)
|
80
|
+
shell_out!("msiexec /qn /x \"#{new_resource.source}\" #{expand_options(new_resource.options)}", default_env: false, timeout: new_resource.timeout, returns: new_resource.returns)
|
81
81
|
else
|
82
82
|
uninstall_version = new_resource.version || installed_version
|
83
83
|
uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) }
|
@@ -86,7 +86,7 @@ class Chef
|
|
86
86
|
uninstall_string += expand_options(new_resource.options)
|
87
87
|
uninstall_string += " /q" unless uninstall_string.downcase =~ %r{ /q}
|
88
88
|
logger.trace("#{new_resource} removing MSI package version using '#{uninstall_string}'")
|
89
|
-
shell_out!(uninstall_string, timeout: new_resource.timeout, returns: new_resource.returns)
|
89
|
+
shell_out!(uninstall_string, default_env: false, timeout: new_resource.timeout, returns: new_resource.returns)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -40,9 +40,14 @@ class Chef
|
|
40
40
|
YUM_HELPER = ::File.expand_path(::File.join(::File.dirname(__FILE__), "yum_helper.py")).freeze
|
41
41
|
|
42
42
|
def yum_command
|
43
|
-
@yum_command ||=
|
44
|
-
|
45
|
-
|
43
|
+
@yum_command ||= begin
|
44
|
+
cmd = which("platform-python", "python", "python2", "python2.7", extra_path: "/usr/libexec") do |f|
|
45
|
+
shell_out("#{f} -c 'import yum'").exitstatus == 0
|
46
|
+
end
|
47
|
+
raise Chef::Exceptions::Package, "cannot find yum libraries, you may need to use dnf_package" unless cmd
|
48
|
+
|
49
|
+
"#{cmd} #{YUM_HELPER}"
|
50
|
+
end
|
46
51
|
end
|
47
52
|
|
48
53
|
def start
|
@@ -273,7 +273,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
|
|
273
273
|
Win32::Service.configure(new_config)
|
274
274
|
logger.info "#{new_resource} configured."
|
275
275
|
|
276
|
-
grant_service_logon(new_resource.run_as_user) if new_resource.run_as_user
|
276
|
+
grant_service_logon(new_resource.run_as_user) if new_resource.run_as_user != "localsystem"
|
277
277
|
end
|
278
278
|
|
279
279
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Thom May (<thom@chef.io>)
|
3
|
-
# Copyright:: 2016-
|
3
|
+
# Copyright:: 2016-2019, Chef Software, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -35,8 +35,9 @@ class Chef
|
|
35
35
|
components ['nginx']
|
36
36
|
end
|
37
37
|
```
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
Enable Ubuntu multiverse repositories
|
40
|
+
```ruby
|
40
41
|
apt_repository 'security-ubuntu-multiverse' do
|
41
42
|
uri 'http://security.ubuntu.com/ubuntu'
|
42
43
|
distribution 'trusty-security'
|
@@ -44,14 +45,16 @@ class Chef
|
|
44
45
|
deb_src true
|
45
46
|
end
|
46
47
|
```
|
47
|
-
|
48
|
-
|
48
|
+
|
49
|
+
Add the Nginx PPA, autodetect the key and repository url
|
50
|
+
```ruby
|
49
51
|
apt_repository 'nginx-php' do
|
50
52
|
uri 'ppa:nginx/stable'
|
51
53
|
end
|
52
54
|
```
|
53
|
-
|
54
|
-
|
55
|
+
|
56
|
+
Add the JuJu PPA, grab the key from the keyserver, and add source repo
|
57
|
+
```ruby
|
55
58
|
apt_repository 'juju' do
|
56
59
|
uri 'http://ppa.launchpad.net/juju/stable/ubuntu'
|
57
60
|
components ['main']
|
@@ -62,8 +65,9 @@ class Chef
|
|
62
65
|
deb_src true
|
63
66
|
end
|
64
67
|
```
|
65
|
-
|
66
|
-
|
68
|
+
|
69
|
+
Add repository that requires multiple keys to authenticate packages
|
70
|
+
```ruby
|
67
71
|
apt_repository 'rundeck' do
|
68
72
|
uri 'https://dl.bintray.com/rundeck/rundeck-deb'
|
69
73
|
distribution '/'
|
@@ -72,8 +76,9 @@ class Chef
|
|
72
76
|
action :add
|
73
77
|
end
|
74
78
|
```
|
75
|
-
|
76
|
-
|
79
|
+
|
80
|
+
Add the Cloudera Repo of CDH4 packages for Ubuntu 12.04 on AMD64
|
81
|
+
```ruby
|
77
82
|
apt_repository 'cloudera' do
|
78
83
|
uri 'http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh'
|
79
84
|
arch 'amd64'
|
@@ -82,8 +87,9 @@ class Chef
|
|
82
87
|
key 'http://archive.cloudera.com/debian/archive.key'
|
83
88
|
end
|
84
89
|
```
|
85
|
-
|
86
|
-
|
90
|
+
|
91
|
+
Remove a repository from the list
|
92
|
+
```ruby
|
87
93
|
apt_repository 'zenoss' do
|
88
94
|
action :remove
|
89
95
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Thom May (<thom@chef.io>)
|
3
|
-
# Copyright:: Copyright (c) 2016-
|
3
|
+
# Copyright:: Copyright (c) 2016-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -26,6 +26,20 @@ class Chef
|
|
26
26
|
|
27
27
|
description "Use the apt_update resource to manage APT repository updates on Debian and Ubuntu platforms."
|
28
28
|
introduced "12.7"
|
29
|
+
examples <<~DOC
|
30
|
+
Update the Apt repository at a specified interval
|
31
|
+
```ruby
|
32
|
+
apt_update 'all platforms' do
|
33
|
+
frequency 86400
|
34
|
+
action :periodic
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
Update the Apt repository at the start of a Chef Infra Client run
|
39
|
+
```ruby
|
40
|
+
apt_update 'update'
|
41
|
+
```
|
42
|
+
DOC
|
29
43
|
|
30
44
|
# allow bare apt_update with no name
|
31
45
|
property :name, String, default: ""
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright 2017-
|
2
|
+
# Copyright:: Copyright 2017-2019, Chef Software Inc.
|
3
3
|
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
|
4
4
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
5
5
|
#
|
@@ -30,6 +30,15 @@ class Chef
|
|
30
30
|
|
31
31
|
introduced "15.0"
|
32
32
|
description "Use the archive_file resource to extract archive files to disk. This resource uses the libarchive library to extract multiple archive formats including tar, gzip, bzip, and zip formats."
|
33
|
+
examples <<~DOC
|
34
|
+
Extract a zip file to a specified directory
|
35
|
+
```ruby
|
36
|
+
archive_file 'Precompiled.zip' do
|
37
|
+
path '/tmp/Precompiled.zip'
|
38
|
+
destination '/srv/files'
|
39
|
+
end
|
40
|
+
```
|
41
|
+
DOC
|
33
42
|
|
34
43
|
property :path, String,
|
35
44
|
name_property: true,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2008-
|
2
|
+
# Copyright:: 2008-2019, Chef Software, Inc.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -24,6 +24,19 @@ class Chef
|
|
24
24
|
|
25
25
|
description "Use the build_essential resource to install packages required for compiling C software from source."
|
26
26
|
introduced "14.0"
|
27
|
+
examples <<~DOC
|
28
|
+
Install compilation packages
|
29
|
+
```ruby
|
30
|
+
build_essential
|
31
|
+
```
|
32
|
+
|
33
|
+
Install compilation packages during the compilation phase
|
34
|
+
```ruby
|
35
|
+
build_essential 'Install compilation tools' do
|
36
|
+
compile_time true
|
37
|
+
end
|
38
|
+
```
|
39
|
+
DOC
|
27
40
|
|
28
41
|
# this allows us to use build_essential without setting a name
|
29
42
|
property :name, String, default: ""
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2018, Chef Software, Inc.
|
2
|
+
# Copyright:: 2018-2019, Chef Software, Inc.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -21,6 +21,22 @@ class Chef
|
|
21
21
|
|
22
22
|
description "Use the chocolatey_config resource to add or remove Chocolatey configuration keys."
|
23
23
|
introduced "14.3"
|
24
|
+
examples <<~DOC
|
25
|
+
Set the Chocolatey cacheLocation config
|
26
|
+
```ruby
|
27
|
+
chocolatey_config 'Set cacheLocation config' do
|
28
|
+
config_key 'cacheLocation'
|
29
|
+
value 'C:\temp\choco'
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
Unset a Chocolatey config
|
34
|
+
```ruby
|
35
|
+
chocolatey_config 'BogusConfig' do
|
36
|
+
action :unset
|
37
|
+
end
|
38
|
+
```
|
39
|
+
DOC
|
24
40
|
|
25
41
|
property :config_key, String, name_property: true,
|
26
42
|
description: "An optional property to set the config key name if it differs from the resource block's name."
|
@@ -21,6 +21,21 @@ class Chef
|
|
21
21
|
|
22
22
|
description "Use the chocolatey_feature resource to enable and disable Chocolatey features."
|
23
23
|
introduced "15.1"
|
24
|
+
examples <<~DOC
|
25
|
+
Enable the checksumFiles Chocolatey feature
|
26
|
+
```ruby
|
27
|
+
chocolatey_feature 'checksumFiles' do
|
28
|
+
action :enable
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
Disable the checksumFiles Chocolatey feature
|
33
|
+
```ruby
|
34
|
+
chocolatey_feature 'checksumFiles' do
|
35
|
+
action :disable
|
36
|
+
end
|
37
|
+
```
|
38
|
+
DOC
|
24
39
|
|
25
40
|
property :feature_name, String, name_property: true,
|
26
41
|
description: "The name of the Chocolatey feature to enable or disable."
|
@@ -26,6 +26,22 @@ class Chef
|
|
26
26
|
|
27
27
|
description "Use the chocolatey_package resource to manage packages using Chocolatey on the Microsoft Windows platform."
|
28
28
|
introduced "12.7"
|
29
|
+
examples <<~DOC
|
30
|
+
Install a Chocolatey package
|
31
|
+
```ruby
|
32
|
+
chocolatey_package 'name of package' do
|
33
|
+
action :install
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
Install a package with options with Chocolatey's ``--checksum`` option
|
38
|
+
```ruby
|
39
|
+
chocolatey_package 'name of package' do
|
40
|
+
options '--checksum 1234567890'
|
41
|
+
action :install
|
42
|
+
end
|
43
|
+
```
|
44
|
+
DOC
|
29
45
|
|
30
46
|
allowed_actions :install, :upgrade, :remove, :purge, :reconfig
|
31
47
|
|
@@ -33,6 +49,18 @@ class Chef
|
|
33
49
|
property :options, [String, Array],
|
34
50
|
description: "One (or more) additional options that are passed to the command."
|
35
51
|
|
52
|
+
property :list_options, String,
|
53
|
+
introduced: "15.3",
|
54
|
+
description: "One (or more) additional list options that are passed to the command."
|
55
|
+
|
56
|
+
property :user, String,
|
57
|
+
introduced: "15.3",
|
58
|
+
description: "The username to authenticate feeds."
|
59
|
+
|
60
|
+
property :password, String,
|
61
|
+
introduced: "15.3",
|
62
|
+
description: "The password to authenticate to the source."
|
63
|
+
|
36
64
|
property :package_name, [String, Array],
|
37
65
|
description: "The name of the package. Default value: the name of the resource block.",
|
38
66
|
coerce: proc { |x| [x].flatten }
|
@@ -41,9 +69,11 @@ class Chef
|
|
41
69
|
description: "The version of a package to be installed or upgraded.",
|
42
70
|
coerce: proc { |x| [x].flatten }
|
43
71
|
|
72
|
+
# In the choco if we have the feature useEnhancedExitCodes turned on, then choco will provide enhanced exit codes(2: no results).
|
73
|
+
# Choco exit codes https://chocolatey.org/docs/commandsinfo#exit-codes
|
44
74
|
property :returns, [Integer, Array],
|
45
75
|
description: "The exit code(s) returned a chocolatey package that indicate success.",
|
46
|
-
default: [ 0 ], desired_state: false,
|
76
|
+
default: [ 0, 2 ], desired_state: false,
|
47
77
|
introduced: "12.18"
|
48
78
|
end
|
49
79
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: 2018, Chef Software, Inc.
|
2
|
+
# Copyright:: 2018-2019, Chef Software, Inc.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -21,6 +21,22 @@ class Chef
|
|
21
21
|
|
22
22
|
description "Use the chocolatey_source resource to add, remove, enable, or disable Chocolatey sources."
|
23
23
|
introduced "14.3"
|
24
|
+
examples <<~DOC
|
25
|
+
Add a Chocolatey source
|
26
|
+
```ruby
|
27
|
+
chocolatey_source 'MySource' do
|
28
|
+
source 'http://example.com/something'
|
29
|
+
action :add
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
Remove a Chocolatey source
|
34
|
+
```ruby
|
35
|
+
chocolatey_source 'MySource' do
|
36
|
+
action :remove
|
37
|
+
end
|
38
|
+
```
|
39
|
+
DOC
|
24
40
|
|
25
41
|
property :source_name, String, name_property: true,
|
26
42
|
description: "An optional property to set the source name if it differs from the resource block's name."
|