chef 13.6.4-universal-mingw32 → 13.7.16-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/VERSION +1 -1
- data/acceptance/Gemfile +2 -2
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +1 -6
- data/distro/powershell/chef/chef.psm1 +1 -5
- data/lib/chef/api_client.rb +5 -5
- data/lib/chef/api_client_v1.rb +6 -6
- data/lib/chef/application.rb +3 -2
- data/lib/chef/application/knife.rb +4 -0
- data/lib/chef/chef_class.rb +2 -2
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -4
- data/lib/chef/client.rb +3 -3
- data/lib/chef/cookbook/chefignore.rb +4 -0
- data/lib/chef/cookbook/cookbook_collection.rb +2 -2
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/deprecated.rb +10 -0
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/http.rb +10 -10
- data/lib/chef/knife.rb +16 -15
- data/lib/chef/knife/configure.rb +12 -36
- data/lib/chef/knife/cookbook_upload.rb +4 -4
- data/lib/chef/knife/core/bootstrap_context.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +6 -2
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/data_bag_show.rb +1 -1
- data/lib/chef/knife/edit.rb +1 -1
- data/lib/chef/knife/ssh.rb +47 -35
- data/lib/chef/knife/user_create.rb +2 -0
- data/lib/chef/knife/user_delete.rb +2 -0
- data/lib/chef/knife/user_edit.rb +2 -0
- data/lib/chef/knife/user_reregister.rb +2 -0
- data/lib/chef/knife/user_show.rb +2 -0
- data/lib/chef/mixin/powershell_out.rb +1 -1
- data/lib/chef/node/attribute.rb +46 -70
- data/lib/chef/node/attribute_collections.rb +5 -5
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/node/immutable_collections.rb +180 -23
- data/lib/chef/node/mixin/state_tracking.rb +6 -6
- data/lib/chef/node_map.rb +63 -45
- data/lib/chef/property.rb +8 -8
- data/lib/chef/provider.rb +9 -3
- data/lib/chef/provider/apt_preference.rb +1 -1
- data/lib/chef/provider/apt_repository.rb +1 -1
- data/lib/chef/provider/apt_update.rb +1 -1
- data/lib/chef/provider/file.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +6 -2
- data/lib/chef/provider/ifconfig.rb +96 -34
- data/lib/chef/provider/launchd.rb +0 -1
- data/lib/chef/provider/log.rb +3 -13
- data/lib/chef/provider/package/dnf.rb +1 -1
- data/lib/chef/provider/package/smartos.rb +2 -2
- data/lib/chef/provider/reboot.rb +12 -0
- data/lib/chef/provider/remote_directory.rb +1 -1
- data/lib/chef/provider/remote_file/http.rb +3 -2
- data/lib/chef/provider/service/solaris.rb +6 -2
- data/lib/chef/provider/systemd_unit.rb +34 -33
- data/lib/chef/provider/user/dscl.rb +1 -1
- data/lib/chef/provider/windows_path.rb +6 -7
- data/lib/chef/provider/windows_task.rb +89 -33
- data/lib/chef/provider/yum_repository.rb +24 -9
- data/lib/chef/resource/apt_package.rb +1 -0
- data/lib/chef/resource/apt_preference.rb +4 -0
- data/lib/chef/resource/apt_repository.rb +4 -0
- data/lib/chef/resource/apt_update.rb +3 -0
- data/lib/chef/resource/bash.rb +4 -0
- data/lib/chef/resource/batch.rb +5 -0
- data/lib/chef/resource/bff_package.rb +4 -0
- data/lib/chef/resource/breakpoint.rb +6 -0
- data/lib/chef/resource/cab_package.rb +6 -6
- data/lib/chef/resource/chef_gem.rb +13 -0
- data/lib/chef/resource/chocolatey_package.rb +4 -6
- data/lib/chef/resource/cookbook_file.rb +13 -15
- data/lib/chef/resource/cron.rb +2 -0
- data/lib/chef/resource/csh.rb +4 -0
- data/lib/chef/resource/directory.rb +8 -26
- data/lib/chef/resource/dnf_package.rb +5 -0
- data/lib/chef/resource/dpkg_package.rb +2 -0
- data/lib/chef/resource/dsc_resource.rb +5 -0
- data/lib/chef/resource/dsc_script.rb +6 -0
- data/lib/chef/resource/env.rb +3 -0
- data/lib/chef/resource/erl_call.rb +5 -0
- data/lib/chef/resource/execute.rb +5 -1
- data/lib/chef/resource/file.rb +2 -1
- data/lib/chef/resource/file/verification.rb +10 -0
- data/lib/chef/resource/freebsd_package.rb +10 -2
- data/lib/chef/resource/gem_package.rb +2 -0
- data/lib/chef/resource/git.rb +2 -0
- data/lib/chef/resource/group.rb +1 -0
- data/lib/chef/resource/homebrew_package.rb +3 -0
- data/lib/chef/resource/http_request.rb +2 -0
- data/lib/chef/resource/ifconfig.rb +23 -150
- data/lib/chef/resource/ips_package.rb +1 -0
- data/lib/chef/resource/ksh.rb +6 -0
- data/lib/chef/resource/launchd.rb +5 -4
- data/lib/chef/resource/link.rb +10 -0
- data/lib/chef/resource/log.rb +19 -46
- data/lib/chef/resource/macports_package.rb +1 -0
- data/lib/chef/resource/mdadm.rb +4 -0
- data/lib/chef/resource/mount.rb +1 -0
- data/lib/chef/resource/msu_package.rb +7 -8
- data/lib/chef/resource/ohai.rb +2 -0
- data/lib/chef/resource/openbsd_package.rb +3 -0
- data/lib/chef/resource/osx_profile.rb +10 -40
- data/lib/chef/resource/package.rb +6 -0
- data/lib/chef/resource/pacman_package.rb +1 -0
- data/lib/chef/resource/paludis_package.rb +3 -0
- data/lib/chef/resource/perl.rb +4 -0
- data/lib/chef/resource/portage_package.rb +1 -0
- data/lib/chef/resource/powershell_package.rb +5 -0
- data/lib/chef/resource/powershell_script.rb +8 -0
- data/lib/chef/resource/python.rb +4 -0
- data/lib/chef/resource/reboot.rb +14 -20
- data/lib/chef/resource/registry_key.rb +1 -0
- data/lib/chef/resource/remote_directory.rb +3 -0
- data/lib/chef/resource/remote_file.rb +2 -0
- data/lib/chef/resource/resource_notification.rb +17 -0
- data/lib/chef/resource/route.rb +1 -0
- data/lib/chef/resource/rpm_package.rb +1 -0
- data/lib/chef/resource/ruby.rb +4 -0
- data/lib/chef/resource/ruby_block.rb +3 -0
- data/lib/chef/resource/script.rb +4 -0
- data/lib/chef/resource/service.rb +1 -0
- data/lib/chef/resource/smartos_package.rb +1 -0
- data/lib/chef/resource/solaris_package.rb +1 -0
- data/lib/chef/resource/subversion.rb +1 -0
- data/lib/chef/resource/systemd_unit.rb +6 -0
- data/lib/chef/resource/template.rb +9 -0
- data/lib/chef/resource/user.rb +1 -0
- data/lib/chef/resource/windows_package.rb +2 -0
- data/lib/chef/resource/windows_path.rb +5 -10
- data/lib/chef/resource/windows_service.rb +3 -0
- data/lib/chef/resource/windows_task.rb +66 -87
- data/lib/chef/resource/yum_repository.rb +26 -22
- data/lib/chef/resource/zypper_package.rb +2 -0
- data/lib/chef/resource/zypper_repository.rb +6 -1
- data/lib/chef/run_context.rb +8 -2
- data/lib/chef/server_api.rb +1 -0
- data/lib/chef/util/selinux.rb +5 -4
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version/platform.rb +18 -0
- data/lib/chef/version_constraint/platform.rb +2 -0
- data/spec/data/client.d_00/02-strings.rb +2 -0
- data/spec/functional/assets/chefinittest +6 -4
- data/spec/functional/knife/ssh_spec.rb +54 -7
- data/spec/functional/resource/bff_spec.rb +3 -3
- data/spec/functional/resource/ifconfig_spec.rb +1 -1
- data/spec/functional/resource/mount_spec.rb +7 -3
- data/spec/functional/resource/user/useradd_spec.rb +4 -4
- data/spec/functional/resource/windows_task_spec.rb +6 -6
- data/spec/functional/win32/security_spec.rb +7 -33
- data/spec/integration/knife/data_bag_show_spec.rb +1 -1
- data/spec/integration/recipes/noop_resource_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +30 -30
- data/spec/integration/recipes/resource_action_spec.rb +2 -2
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +71 -15
- data/spec/spec_helper.rb +19 -0
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/unit/application_dot_d.rb +2 -0
- data/spec/support/shared/unit/execute_resource.rb +8 -1
- data/spec/support/shared/unit/provider/file.rb +9 -1
- data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +10 -7
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +2 -2
- data/spec/unit/client_spec.rb +1 -1
- data/spec/unit/deprecated_spec.rb +4 -4
- data/spec/unit/http_spec.rb +9 -0
- data/spec/unit/knife/bootstrap_spec.rb +5 -0
- data/spec/unit/knife/configure_spec.rb +10 -60
- data/spec/unit/knife/data_bag_create_spec.rb +40 -2
- data/spec/unit/knife/data_bag_show_spec.rb +16 -2
- data/spec/unit/knife/ssh_spec.rb +85 -39
- data/spec/unit/knife_spec.rb +2 -0
- data/spec/unit/lwrp_spec.rb +5 -3
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +7 -6
- data/spec/unit/node/attribute_spec.rb +55 -24
- data/spec/unit/node/immutable_collections_spec.rb +28 -14
- data/spec/unit/node/vivid_mash_spec.rb +27 -10
- data/spec/unit/node_map_spec.rb +34 -0
- data/spec/unit/property_spec.rb +13 -13
- data/spec/unit/provider/group/dscl_spec.rb +14 -5
- data/spec/unit/provider/ifconfig_spec.rb +10 -3
- data/spec/unit/provider/remote_file/http_spec.rb +23 -19
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +6 -5
- data/spec/unit/provider/user/dscl_spec.rb +26 -0
- data/spec/unit/provider/windows_task_spec.rb +148 -4
- data/spec/unit/provider_spec.rb +1 -1
- data/spec/unit/resource/apt_package_spec.rb +1 -1
- data/spec/unit/resource/bash_spec.rb +8 -10
- data/spec/unit/resource/batch_spec.rb +1 -1
- data/spec/unit/resource/cab_package_spec.rb +19 -1
- data/spec/unit/resource/chef_gem_spec.rb +3 -3
- data/spec/unit/resource/chocolatey_package_spec.rb +10 -10
- data/spec/unit/resource/conditional_spec.rb +2 -2
- data/spec/unit/resource/cookbook_file_spec.rb +24 -30
- data/spec/unit/resource/cron_spec.rb +79 -82
- data/spec/unit/resource/csh_spec.rb +8 -10
- data/spec/unit/resource/deploy_spec.rb +1 -1
- data/spec/unit/resource/directory_spec.rb +28 -31
- data/spec/unit/resource/dnf_package_spec.rb +9 -9
- data/spec/unit/resource/env_spec.rb +7 -7
- data/spec/unit/resource/erl_call_spec.rb +9 -9
- data/spec/unit/resource/execute_spec.rb +6 -6
- data/spec/unit/resource/file/verification_spec.rb +18 -4
- data/spec/unit/resource/file_spec.rb +53 -56
- data/spec/unit/resource/freebsd_package_spec.rb +7 -7
- data/spec/unit/resource/gem_package_spec.rb +1 -1
- data/spec/unit/resource/git_spec.rb +7 -9
- data/spec/unit/resource/group_spec.rb +60 -70
- data/spec/unit/resource/http_request_spec.rb +16 -19
- data/spec/unit/resource/ifconfig_spec.rb +3 -3
- data/spec/unit/resource/ips_package_spec.rb +3 -5
- data/spec/unit/resource/ksh_spec.rb +8 -10
- data/spec/unit/resource/launchd_spec.rb +17 -10
- data/spec/unit/resource/link_spec.rb +53 -53
- data/spec/unit/resource/log_spec.rb +24 -28
- data/spec/unit/resource/mdadm_spec.rb +42 -44
- data/spec/unit/resource/mount_spec.rb +97 -99
- data/spec/unit/resource/msu_package_spec.rb +14 -8
- data/spec/unit/resource/ohai_spec.rb +15 -17
- data/spec/unit/resource/openbsd_package_spec.rb +3 -3
- data/spec/unit/resource/osx_profile_spec.rb +7 -7
- data/spec/unit/resource/package_spec.rb +36 -40
- data/spec/unit/resource/perl_spec.rb +8 -11
- data/spec/unit/resource/portage_package_spec.rb +8 -10
- data/spec/unit/resource/powershell_package_spec.rb +9 -9
- data/spec/unit/resource/python_spec.rb +8 -11
- data/spec/unit/resource/reboot_spec.rb +50 -0
- data/spec/unit/resource/registry_key_spec.rb +84 -98
- data/spec/unit/resource/remote_directory_spec.rb +40 -42
- data/spec/unit/resource/remote_file_spec.rb +78 -80
- data/spec/unit/resource/route_spec.rb +42 -44
- data/spec/unit/resource/rpm_package_spec.rb +5 -7
- data/spec/unit/resource/ruby_block_spec.rb +14 -16
- data/spec/unit/resource/ruby_spec.rb +8 -12
- data/spec/unit/resource/scm_spec.rb +66 -69
- data/spec/unit/resource/script_spec.rb +1 -1
- data/spec/unit/resource/service_spec.rb +80 -83
- data/spec/unit/resource/smartos_package_spec.rb +5 -0
- data/spec/unit/resource/solaris_package_spec.rb +3 -5
- data/spec/unit/resource/subversion_spec.rb +18 -16
- data/spec/unit/resource/systemd_unit_spec.rb +50 -54
- data/spec/unit/resource/template_spec.rb +56 -61
- data/spec/unit/resource/user_spec.rb +47 -53
- data/spec/unit/resource/windows_package_spec.rb +1 -1
- data/spec/unit/resource/windows_path_spec.rb +11 -8
- data/spec/unit/resource/windows_task_spec.rb +129 -33
- data/spec/unit/resource/yum_package_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +61 -8
- data/spec/unit/resource/zypper_repository_spec.rb +17 -18
- data/spec/unit/util/selinux_spec.rb +3 -6
- data/tasks/dependencies.rb +0 -5
- data/tasks/rspec.rb +1 -1
- metadata +7 -19
- data/acceptance/.DS_Store +0 -0
- data/acceptance/.bundle/config +0 -2
- data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
- data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
- data/distro/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/chef/.DS_Store +0 -0
- data/lib/chef/knife/.DS_Store +0 -0
- data/lib/chef/mixin/.DS_Store +0 -0
- data/spec/.DS_Store +0 -0
- data/spec/functional/.DS_Store +0 -0
- data/spec/support/.DS_Store +0 -0
- data/spec/unit/.DS_Store +0 -0
- data/tasks/.DS_Store +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1fcd5ce7cb24f5f47ba8138e6fffd6b5157783ff98fecbd099c3b5e07c497c2c
|
4
|
+
data.tar.gz: 653cca5199263fba6bbbc3cf6cf85c0cdf6b876208b332b2cc65610f765d8133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e43227b9110b01c0e75076b7748f5b14f555a655ceccb72927fd93bc040c7b3c37329529dbc7d2468a9ddbf66f8a15c4236b26f4e7c6635534044bde8b6aa2bc
|
7
|
+
data.tar.gz: 9544fec98cbe49787fd3e14b6ae63fa0c8cf09136de0f34ed4bb7408c1fa7d770220dde5ee37e96cf039349bfc35ccfa03941ab3e0f4e95a4d655199d830c45f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
13.
|
1
|
+
13.7.16
|
data/acceptance/Gemfile
CHANGED
@@ -15,5 +15,5 @@ gem "berkshelf"
|
|
15
15
|
# packages are not always immediately available via the omnitruck API.
|
16
16
|
gem "mixlib-install", "1.2.3"
|
17
17
|
|
18
|
-
# for chef-
|
19
|
-
gem "chef-config", "<
|
18
|
+
# for chef-14 development - pin to the released rubygems version
|
19
|
+
gem "chef-config", "< 14.0"
|
@@ -6,12 +6,7 @@ class TopCookbooks < Chef::Resource
|
|
6
6
|
# Disabling all windows tests until winrm issue is properly settled.
|
7
7
|
#
|
8
8
|
action :run do
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
cookbook_kitchen "#{command} git" do
|
13
|
-
end
|
14
|
-
|
9
|
+
|
15
10
|
# FIXME: waiting for https://github.com/learn-chef/learn-chef-acceptance/pull/23
|
16
11
|
# cookbook_kitchen "#{command} learn-the-basics-ubuntu" do
|
17
12
|
# repository "learn-chef/learn-chef-acceptance"
|
@@ -236,7 +236,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
|
|
236
236
|
throw "Unable to create process [$ArgumentString]. Error code $reason."
|
237
237
|
}
|
238
238
|
|
239
|
-
$sb = New-Object System.Text.StringBuilder
|
240
239
|
$buffer = New-Object byte[] 1024
|
241
240
|
|
242
241
|
# Initialize reference variables
|
@@ -270,7 +269,7 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
|
|
270
269
|
while ([Chef.Kernel32]::ReadFile($hReadOut, $buffer, $buffer.Length, [ref] $bytesRead, 0)) {
|
271
270
|
$output = [Text.Encoding]::UTF8.GetString($buffer, 0, $bytesRead)
|
272
271
|
if ($output) {
|
273
|
-
|
272
|
+
$output
|
274
273
|
}
|
275
274
|
if ($bytesRead -lt $buffer.Length) {
|
276
275
|
# Partial buffer indicating the end of stream, break out of ReadFile loop
|
@@ -307,9 +306,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
|
|
307
306
|
}
|
308
307
|
}
|
309
308
|
|
310
|
-
# Return output obtained from child process stdout/stderr
|
311
|
-
$sb.ToString()
|
312
|
-
|
313
309
|
# Cleanup handles
|
314
310
|
$success = [Chef.Kernel32]::CloseHandle($pi.hProcess)
|
315
311
|
if (-Not $success) {
|
data/lib/chef/api_client.rb
CHANGED
@@ -47,7 +47,7 @@ class Chef
|
|
47
47
|
|
48
48
|
# Gets or sets the client name.
|
49
49
|
#
|
50
|
-
# @
|
50
|
+
# @param [Optional String] The name must be alpha-numeric plus - and _.
|
51
51
|
# @return [String] The current value of the name.
|
52
52
|
def name(arg = nil)
|
53
53
|
set_or_return(
|
@@ -59,7 +59,7 @@ class Chef
|
|
59
59
|
|
60
60
|
# Gets or sets whether this client is an admin.
|
61
61
|
#
|
62
|
-
# @
|
62
|
+
# @param [Optional True/False] Should be true or false - default is false.
|
63
63
|
# @return [True/False] The current value
|
64
64
|
def admin(arg = nil)
|
65
65
|
set_or_return(
|
@@ -71,7 +71,7 @@ class Chef
|
|
71
71
|
|
72
72
|
# Gets or sets the public key.
|
73
73
|
#
|
74
|
-
# @
|
74
|
+
# @param [Optional String] The string representation of the public key.
|
75
75
|
# @return [String] The current value.
|
76
76
|
def public_key(arg = nil)
|
77
77
|
set_or_return(
|
@@ -83,7 +83,7 @@ class Chef
|
|
83
83
|
|
84
84
|
# Gets or sets whether this client is a validator.
|
85
85
|
#
|
86
|
-
# @
|
86
|
+
# @param [Boolean] whether or not the client is a validator. If
|
87
87
|
# `nil`, retrieves the already-set value.
|
88
88
|
# @return [Boolean] The current value
|
89
89
|
def validator(arg = nil)
|
@@ -96,7 +96,7 @@ class Chef
|
|
96
96
|
|
97
97
|
# Gets or sets the private key.
|
98
98
|
#
|
99
|
-
# @
|
99
|
+
# @param [Optional String] The string representation of the private key.
|
100
100
|
# @return [String] The current value.
|
101
101
|
def private_key(arg = nil)
|
102
102
|
set_or_return(
|
data/lib/chef/api_client_v1.rb
CHANGED
@@ -70,7 +70,7 @@ class Chef
|
|
70
70
|
|
71
71
|
# Gets or sets the client name.
|
72
72
|
#
|
73
|
-
# @
|
73
|
+
# @param [Optional String] The name must be alpha-numeric plus - and _.
|
74
74
|
# @return [String] The current value of the name.
|
75
75
|
def name(arg = nil)
|
76
76
|
set_or_return(
|
@@ -82,7 +82,7 @@ class Chef
|
|
82
82
|
|
83
83
|
# Gets or sets whether this client is an admin.
|
84
84
|
#
|
85
|
-
# @
|
85
|
+
# @param [Optional True/False] Should be true or false - default is false.
|
86
86
|
# @return [True/False] The current value
|
87
87
|
def admin(arg = nil)
|
88
88
|
set_or_return(
|
@@ -94,7 +94,7 @@ class Chef
|
|
94
94
|
|
95
95
|
# Gets or sets the public key.
|
96
96
|
#
|
97
|
-
# @
|
97
|
+
# @param [Optional String] The string representation of the public key.
|
98
98
|
# @return [String] The current value.
|
99
99
|
def public_key(arg = nil)
|
100
100
|
set_or_return(
|
@@ -106,7 +106,7 @@ class Chef
|
|
106
106
|
|
107
107
|
# Gets or sets whether this client is a validator.
|
108
108
|
#
|
109
|
-
# @
|
109
|
+
# @param [Boolean] whether or not the client is a validator. If
|
110
110
|
# `nil`, retrieves the already-set value.
|
111
111
|
# @return [Boolean] The current value
|
112
112
|
def validator(arg = nil)
|
@@ -120,7 +120,7 @@ class Chef
|
|
120
120
|
# Private key. The server will return it as a string.
|
121
121
|
# Set to true under API V0 to have the server regenerate the default key.
|
122
122
|
#
|
123
|
-
# @
|
123
|
+
# @param [Optional String] The string representation of the private key.
|
124
124
|
# @return [String] The current value.
|
125
125
|
def private_key(arg = nil)
|
126
126
|
set_or_return(
|
@@ -132,7 +132,7 @@ class Chef
|
|
132
132
|
|
133
133
|
# Used to ask server to generate key pair under api V1
|
134
134
|
#
|
135
|
-
# @
|
135
|
+
# @param [Optional True/False] Should be true or false - default is false.
|
136
136
|
# @return [True/False] The current value
|
137
137
|
def create_key(arg = nil)
|
138
138
|
set_or_return(
|
data/lib/chef/application.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: AJ Christensen (<aj@chef.io>)
|
3
3
|
# Author:: Mark Mzyk (mmzyk@chef.io)
|
4
|
-
# Copyright:: Copyright 2008-
|
4
|
+
# Copyright:: Copyright 2008-2018, Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -90,6 +90,7 @@ class Chef
|
|
90
90
|
load_config_file
|
91
91
|
Chef::Config.export_proxies
|
92
92
|
Chef::Config.init_openssl
|
93
|
+
File.umask Chef::Config[:umask]
|
93
94
|
end
|
94
95
|
|
95
96
|
# Parse the config file
|
@@ -176,7 +177,7 @@ class Chef
|
|
176
177
|
# Based on config and whether or not STDOUT is a tty, should we setup a
|
177
178
|
# secondary logger for stdout?
|
178
179
|
def want_additional_logger?
|
179
|
-
( Chef::Config[:log_location]
|
180
|
+
!( Chef::Config[:log_location].is_a?(IO) && Chef::Config[:log_location].tty? ) && !Chef::Config[:daemonize]
|
180
181
|
end
|
181
182
|
|
182
183
|
def configure_stdout_logger
|
@@ -148,6 +148,10 @@ class Chef::Application::Knife < Chef::Application
|
|
148
148
|
:boolean => true,
|
149
149
|
:default => nil
|
150
150
|
|
151
|
+
option :profile,
|
152
|
+
:long => "--profile PROFILE",
|
153
|
+
:description => "The credentials profile to select"
|
154
|
+
|
151
155
|
# Run knife
|
152
156
|
def run
|
153
157
|
Mixlib::Log::Formatter.show_time = false
|
data/lib/chef/chef_class.rb
CHANGED
@@ -200,8 +200,8 @@ class Chef
|
|
200
200
|
#
|
201
201
|
# Emit a deprecation message.
|
202
202
|
#
|
203
|
-
# @param type The message to send. This should
|
204
|
-
#
|
203
|
+
# @param [Symbol] type The message to send. This should refer to a class
|
204
|
+
# defined in Chef::Deprecated
|
205
205
|
# @param message An explicit message to display, rather than the generic one
|
206
206
|
# associated with the deprecation.
|
207
207
|
# @param location The location. Defaults to the caller who called you (since
|
@@ -5,7 +5,7 @@ class Chef
|
|
5
5
|
module ChefFS
|
6
6
|
module DataHandler
|
7
7
|
class DataBagItemDataHandler < DataHandlerBase
|
8
|
-
RESERVED_NAMES =
|
8
|
+
RESERVED_NAMES = /^(node|role|environment|client)$/
|
9
9
|
|
10
10
|
def normalize(data_bag_item, entry)
|
11
11
|
# If it's wrapped with raw_data, unwrap it.
|
@@ -56,8 +56,7 @@ class Chef
|
|
56
56
|
# 2. Put the actual values in the order of the defaults
|
57
57
|
# 3. Move any other values to the end
|
58
58
|
#
|
59
|
-
#
|
60
|
-
#
|
59
|
+
# @example
|
61
60
|
# normalize_hash({x: 100, c: 2, a: 1}, { a: 10, b: 20, c: 30})
|
62
61
|
# -> { a: 1, b: 20, c: 2, x: 100}
|
63
62
|
#
|
@@ -140,8 +139,7 @@ class Chef
|
|
140
139
|
# the keys specified in "keys"; anything else must be emitted by the
|
141
140
|
# caller.
|
142
141
|
#
|
143
|
-
#
|
144
|
-
#
|
142
|
+
# @example
|
145
143
|
# to_ruby_keys({"name" => "foo", "environment" => "desert", "foo": "bar"}, [ "name", "environment" ])
|
146
144
|
# ->
|
147
145
|
# 'name "foo"
|
data/lib/chef/client.rb
CHANGED
@@ -299,7 +299,7 @@ class Chef
|
|
299
299
|
run_status.stop_clock
|
300
300
|
Chef::Log.info("Chef Run complete in #{run_status.elapsed_time} seconds")
|
301
301
|
run_completed_successfully
|
302
|
-
events.run_completed(node)
|
302
|
+
events.run_completed(node, run_status)
|
303
303
|
|
304
304
|
# keep this inside the main loop to get exception backtraces
|
305
305
|
end_profiling
|
@@ -315,7 +315,7 @@ class Chef
|
|
315
315
|
run_status.exception = run_error
|
316
316
|
run_failed
|
317
317
|
end
|
318
|
-
events.run_failed(run_error)
|
318
|
+
events.run_failed(run_error, run_status)
|
319
319
|
ensure
|
320
320
|
Chef::RequestID.instance.reset_request_id
|
321
321
|
@run_status = nil
|
@@ -602,7 +602,7 @@ class Chef
|
|
602
602
|
# @api private
|
603
603
|
#
|
604
604
|
def run_ohai
|
605
|
-
filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
|
605
|
+
filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version ohai_time os os_version} : nil
|
606
606
|
ohai.all_plugins(filter)
|
607
607
|
events.ohai_completed(node)
|
608
608
|
rescue Ohai::Exceptions::CriticalPluginFailure => e
|
@@ -33,12 +33,16 @@ class Chef
|
|
33
33
|
@ignores = parse_ignore_file
|
34
34
|
end
|
35
35
|
|
36
|
+
# @param [Array] list the list of cookbook files
|
37
|
+
# @return [Array] list of cookbook files with chefignore files removed
|
36
38
|
def remove_ignores_from(file_list)
|
37
39
|
Array(file_list).inject([]) do |unignored, file|
|
38
40
|
ignored?(file) ? unignored : unignored << file
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
44
|
+
# @param [String] file_name the file name to check ignored status for
|
45
|
+
# @return [Boolean] is the file ignored or not
|
42
46
|
def ignored?(file_name)
|
43
47
|
@ignores.any? { |glob| File.fnmatch?(glob, file_name) }
|
44
48
|
end
|
@@ -47,8 +47,8 @@ class Chef
|
|
47
47
|
# Currently checks chef_version and ohai_version in the cookbook metadata
|
48
48
|
# against the running Chef::VERSION and Ohai::VERSION.
|
49
49
|
#
|
50
|
-
# @
|
51
|
-
# @
|
50
|
+
# @raise [Chef::Exceptions::CookbookChefVersionMismatch] if the Chef::VERSION fails validation
|
51
|
+
# @raise [Chef::Exceptions::CookbookOhaiVersionMismatch] if the Ohai::VERSION fails validation
|
52
52
|
def validate!
|
53
53
|
each do |cookbook_name, cookbook_version|
|
54
54
|
cookbook_version.metadata.validate_chef_version!
|
@@ -596,7 +596,7 @@ class Chef
|
|
596
596
|
# Validates that the Ohai::VERSION of the running chef-client matches one of the
|
597
597
|
# configured ohai_version statements in this cookbooks metadata.
|
598
598
|
#
|
599
|
-
# @
|
599
|
+
# @raise [Chef::Exceptions::CookbookOhaiVersionMismatch] if the cookbook fails validation
|
600
600
|
def validate_ohai_version!
|
601
601
|
unless gem_dep_matches?("ohai", Gem::Version.new(Ohai::VERSION), *ohai_versions)
|
602
602
|
raise Exceptions::CookbookOhaiVersionMismatch.new(Ohai::VERSION, name, version, *ohai_versions)
|
@@ -606,7 +606,7 @@ class Chef
|
|
606
606
|
# Validates that the Chef::VERSION of the running chef-client matches one of the
|
607
607
|
# configured chef_version statements in this cookbooks metadata.
|
608
608
|
#
|
609
|
-
# @
|
609
|
+
# @raise [Chef::Exceptions::CookbookChefVersionMismatch] if the cookbook fails validation
|
610
610
|
def validate_chef_version!
|
611
611
|
unless gem_dep_matches?("chef", Gem::Version.new(Chef::VERSION), *chef_versions)
|
612
612
|
raise Exceptions::CookbookChefVersionMismatch.new(Chef::VERSION, name, version, *chef_versions)
|
data/lib/chef/data_bag.rb
CHANGED
data/lib/chef/deprecated.rb
CHANGED
@@ -36,11 +36,11 @@ class Chef
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# Called at the end a successful Chef run.
|
39
|
-
def run_completed(node)
|
39
|
+
def run_completed(node, run_status)
|
40
40
|
end
|
41
41
|
|
42
42
|
# Called at the end of a failed Chef run.
|
43
|
-
def run_failed(exception)
|
43
|
+
def run_failed(exception, run_status)
|
44
44
|
end
|
45
45
|
|
46
46
|
# Called right after ohai runs.
|
data/lib/chef/http.rb
CHANGED
@@ -170,11 +170,10 @@ class Chef
|
|
170
170
|
raise
|
171
171
|
end
|
172
172
|
|
173
|
-
def streaming_request_with_progress(path, headers = {}, &progress_block)
|
173
|
+
def streaming_request_with_progress(path, headers = {}, tempfile = nil, &progress_block)
|
174
174
|
http_attempts ||= 0
|
175
175
|
url = create_url(path)
|
176
176
|
response, rest_request, return_value = nil, nil, nil
|
177
|
-
tempfile = nil
|
178
177
|
data = nil
|
179
178
|
|
180
179
|
method = :GET
|
@@ -182,7 +181,7 @@ class Chef
|
|
182
181
|
|
183
182
|
response, rest_request, return_value = send_http_request(method, url, processed_headers, data) do |http_response|
|
184
183
|
if http_response.kind_of?(Net::HTTPSuccess)
|
185
|
-
tempfile = stream_to_tempfile(url, http_response, &progress_block)
|
184
|
+
tempfile = stream_to_tempfile(url, http_response, tempfile, &progress_block)
|
186
185
|
end
|
187
186
|
apply_stream_complete_middleware(http_response, rest_request, return_value)
|
188
187
|
end
|
@@ -217,11 +216,10 @@ class Chef
|
|
217
216
|
#
|
218
217
|
# @yield [tempfile] block to process the tempfile
|
219
218
|
# @yieldparams [tempfile<Tempfile>] tempfile
|
220
|
-
def streaming_request(path, headers = {})
|
219
|
+
def streaming_request(path, headers = {}, tempfile = nil)
|
221
220
|
http_attempts ||= 0
|
222
221
|
url = create_url(path)
|
223
222
|
response, rest_request, return_value = nil, nil, nil
|
224
|
-
tempfile = nil
|
225
223
|
data = nil
|
226
224
|
|
227
225
|
method = :GET
|
@@ -229,7 +227,7 @@ class Chef
|
|
229
227
|
|
230
228
|
response, rest_request, return_value = send_http_request(method, url, processed_headers, data) do |http_response|
|
231
229
|
if http_response.kind_of?(Net::HTTPSuccess)
|
232
|
-
tempfile = stream_to_tempfile(url, http_response)
|
230
|
+
tempfile = stream_to_tempfile(url, http_response, tempfile)
|
233
231
|
end
|
234
232
|
apply_stream_complete_middleware(http_response, rest_request, return_value)
|
235
233
|
end
|
@@ -500,11 +498,13 @@ class Chef
|
|
500
498
|
end
|
501
499
|
|
502
500
|
# @api private
|
503
|
-
def stream_to_tempfile(url, response, &progress_block)
|
501
|
+
def stream_to_tempfile(url, response, tf = nil, &progress_block)
|
504
502
|
content_length = response["Content-Length"]
|
505
|
-
tf
|
506
|
-
|
507
|
-
|
503
|
+
if tf.nil?
|
504
|
+
tf = Tempfile.open("chef-rest")
|
505
|
+
if Chef::Platform.windows?
|
506
|
+
tf.binmode # required for binary files on Windows platforms
|
507
|
+
end
|
508
508
|
end
|
509
509
|
Chef::Log.debug("Streaming download from #{url} to tempfile #{tf.path}")
|
510
510
|
# Stolen from http://www.ruby-forum.com/topic/166423
|
data/lib/chef/knife.rb
CHANGED
@@ -42,9 +42,9 @@ class Chef
|
|
42
42
|
extend Chef::Mixin::ConvertToClassName
|
43
43
|
extend Forwardable
|
44
44
|
|
45
|
-
# Backwards Compat:
|
46
|
-
#
|
47
|
-
#
|
45
|
+
# @note Backwards Compat:
|
46
|
+
# Ideally, we should not vomit all of these methods into this base class;
|
47
|
+
# instead, they should be accessed by hitting the ui object directly.
|
48
48
|
def_delegator :@ui, :stdout
|
49
49
|
def_delegator :@ui, :stderr
|
50
50
|
def_delegator :@ui, :stdin
|
@@ -105,12 +105,11 @@ class Chef
|
|
105
105
|
# Explicitly set the category for the current command to +new_category+
|
106
106
|
# The category is normally determined from the first word of the command
|
107
107
|
# name, but some commands make more sense using two or more words
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
113
|
-
# category('data bag')
|
108
|
+
# @param new_category [String] value to set the category to (see examples)
|
109
|
+
#
|
110
|
+
# @example Data bag commands would be in the 'data' category by default. To
|
111
|
+
# put them in the 'data bag' category:
|
112
|
+
# category('data bag')
|
114
113
|
def self.category(new_category)
|
115
114
|
@category = new_category
|
116
115
|
end
|
@@ -178,8 +177,9 @@ class Chef
|
|
178
177
|
@config_loader ||= WorkstationConfigLoader.new(nil, Chef::Log)
|
179
178
|
end
|
180
179
|
|
181
|
-
def self.load_config(explicit_config_file)
|
180
|
+
def self.load_config(explicit_config_file, profile)
|
182
181
|
config_loader.explicit_config_file = explicit_config_file
|
182
|
+
config_loader.profile = profile
|
183
183
|
config_loader.load
|
184
184
|
|
185
185
|
ui.warn("No knife configuration file found") if config_loader.no_config_found?
|
@@ -196,10 +196,11 @@ class Chef
|
|
196
196
|
|
197
197
|
# Run knife for the given +args+ (ARGV), adding +options+ to the list of
|
198
198
|
# CLI options that the subcommand knows how to handle.
|
199
|
-
#
|
200
|
-
# args
|
201
|
-
# options
|
202
|
-
#
|
199
|
+
#
|
200
|
+
# @param args [Array] The arguments. Usually ARGV
|
201
|
+
# @param options [Mixlib::CLI option parser hash] These +options+ are how
|
202
|
+
# subcommands know about global knife CLI options
|
203
|
+
#
|
203
204
|
def self.run(args, options = {})
|
204
205
|
# Fallback debug logging. Normally the logger isn't configured until we
|
205
206
|
# read the config, but this means any logging that happens before the
|
@@ -404,7 +405,7 @@ class Chef
|
|
404
405
|
def configure_chef
|
405
406
|
# knife needs to send logger output to STDERR by default
|
406
407
|
Chef::Config[:log_location] = STDERR
|
407
|
-
config_loader = self.class.load_config(config[:config_file])
|
408
|
+
config_loader = self.class.load_config(config[:config_file], config[:profile])
|
408
409
|
config[:config_file] = config_loader.config_location
|
409
410
|
|
410
411
|
# For CLI options like `--config-option key=value`. These have to get
|