chef 13.6.4 → 13.7.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +6 -6
- data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
- data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
@@ -20,6 +20,12 @@ require "chef/resource"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# Use the osx_profile resource to manage configuration profiles (.mobileconfig files)
|
24
|
+
# on the macOS platform. The osx_profile resource installs profiles by using
|
25
|
+
# the uuidgen library to generate a unique ProfileUUID, and then using the
|
26
|
+
# profiles command to install the profile on the system.
|
27
|
+
#
|
28
|
+
# @since 12.7
|
23
29
|
class OsxProfile < Chef::Resource
|
24
30
|
provides :osx_profile, os: "darwin"
|
25
31
|
provides :osx_config_profile, os: "darwin"
|
@@ -29,46 +35,10 @@ class Chef
|
|
29
35
|
default_action :install
|
30
36
|
allowed_actions :install, :remove
|
31
37
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
@identifier = nil
|
37
|
-
@path = nil
|
38
|
-
end
|
39
|
-
|
40
|
-
def profile_name(arg = nil)
|
41
|
-
set_or_return(
|
42
|
-
:profile_name,
|
43
|
-
arg,
|
44
|
-
:kind_of => [ String ]
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
def profile(arg = nil)
|
49
|
-
set_or_return(
|
50
|
-
:profile,
|
51
|
-
arg,
|
52
|
-
:kind_of => [ String, Hash ]
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
def identifier(arg = nil)
|
57
|
-
set_or_return(
|
58
|
-
:identifier,
|
59
|
-
arg,
|
60
|
-
:kind_of => [ String ]
|
61
|
-
)
|
62
|
-
end
|
63
|
-
|
64
|
-
def path(arg = nil)
|
65
|
-
set_or_return(
|
66
|
-
:path,
|
67
|
-
arg,
|
68
|
-
:kind_of => [ String ]
|
69
|
-
)
|
70
|
-
end
|
71
|
-
|
38
|
+
property :profile_name, String, name_property: true
|
39
|
+
property :profile, [ String, Hash ]
|
40
|
+
property :identifier, String
|
41
|
+
property :path, String
|
72
42
|
end
|
73
43
|
end
|
74
44
|
end
|
@@ -21,6 +21,12 @@ require "chef/resource"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
+
# Use the package resource to manage packages. When the package is installed from a local file (such as with RubyGems,
|
25
|
+
# dpkg, or RPM Package Manager), the file must be added to the node using the remote_file or cookbook_file resources.
|
26
|
+
#
|
27
|
+
# This resource is the base resource for several other resources used for package management on specific platforms.
|
28
|
+
# While it is possible to use each of these specific resources, it is recommended to use the package resource as often
|
29
|
+
# as possible.
|
24
30
|
class Package < Chef::Resource
|
25
31
|
resource_name :package
|
26
32
|
|
@@ -20,6 +20,7 @@ require "chef/resource/package"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# Use the pacman_package resource to manage packages (using pacman) on the Arch Linux platform.
|
23
24
|
class PacmanPackage < Chef::Resource::Package
|
24
25
|
resource_name :pacman_package
|
25
26
|
provides :pacman_package, os: "linux"
|
@@ -21,6 +21,9 @@ require "chef/provider/package/paludis"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
+
# Use the paludis_package resource to manage packages for the Paludis platform.
|
25
|
+
#
|
26
|
+
# @since 12.1
|
24
27
|
class PaludisPackage < Chef::Resource::Package
|
25
28
|
resource_name :paludis_package
|
26
29
|
provides :paludis_package, os: "linux"
|
data/lib/chef/resource/perl.rb
CHANGED
@@ -21,6 +21,10 @@ require "chef/provider/script"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
+
# Use the perl resource to execute scripts using the Perl interpreter. This resource may also use any of the actions
|
25
|
+
# and properties that are available to the execute resource. Commands that are executed with this resource are (by
|
26
|
+
# their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and
|
27
|
+
# only_if to guard this resource for idempotence.
|
24
28
|
class Perl < Chef::Resource::Script
|
25
29
|
def initialize(name, run_context = nil)
|
26
30
|
super
|
@@ -20,6 +20,7 @@ require "chef/resource/package"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# Use the portage_package resource to manage packages for the Gentoo platform.
|
23
24
|
class PortagePackage < Chef::Resource::Package
|
24
25
|
resource_name :portage_package
|
25
26
|
def initialize(name, run_context = nil)
|
@@ -20,6 +20,11 @@ require "chef/mixin/uris"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# Use the powershell_package resource to install and manage packages via the Powershell Package Manager for the
|
24
|
+
# Microsoft Windows platform. The powershell_package resource requires administrative access, and a source must be
|
25
|
+
# configured in the Powershell Package Manager via the Register-PackageSource command
|
26
|
+
#
|
27
|
+
# @since 12.16
|
23
28
|
class PowershellPackage < Chef::Resource::Package
|
24
29
|
include Chef::Mixin::Uris
|
25
30
|
|
@@ -19,6 +19,14 @@ require "chef/resource/windows_script"
|
|
19
19
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
22
|
+
# Use the powershell_script resource to execute a script using the Windows PowerShell interpreter, much like how the
|
23
|
+
# script and script-based resources—bash, csh, perl, python, and ruby—are used. The powershell_script is specific to
|
24
|
+
# the Microsoft Windows platform and the Windows PowerShell interpreter.
|
25
|
+
#
|
26
|
+
# The powershell_script resource creates and executes a temporary file (similar to how the script resource behaves),
|
27
|
+
# rather than running the command inline. Commands that are executed with this resource are (by their nature) not
|
28
|
+
# idempotent, as they are typically unique to the environment in which they are run. Use not_if and only_if to guard
|
29
|
+
# this resource for idempotence.
|
22
30
|
class PowershellScript < Chef::Resource::WindowsScript
|
23
31
|
provides :powershell_script, os: "windows"
|
24
32
|
|
data/lib/chef/resource/python.rb
CHANGED
@@ -20,6 +20,10 @@ require "chef/provider/script"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# Use the python resource to execute scripts using the Python interpreter. This resource may also use any of the actions
|
24
|
+
# and properties that are available to the execute resource. Commands that are executed with this resource are (by
|
25
|
+
# their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and
|
26
|
+
# only_if to guard this resource for idempotence.
|
23
27
|
class Python < Chef::Resource::Script
|
24
28
|
def initialize(name, run_context = nil)
|
25
29
|
super
|
data/lib/chef/resource/reboot.rb
CHANGED
@@ -18,31 +18,25 @@
|
|
18
18
|
|
19
19
|
require "chef/resource"
|
20
20
|
|
21
|
-
# In using this resource via notifications, it's important to *only* use
|
22
|
-
# immediate notifications. Delayed notifications produce unintuitive and
|
23
|
-
# probably undesired results.
|
24
21
|
class Chef
|
25
22
|
class Resource
|
23
|
+
# Use the reboot resource to reboot a node, a necessary step with some
|
24
|
+
# installations on certain platforms. This resource is supported for use on
|
25
|
+
# the Microsoft Windows, macOS, and Linux platforms.
|
26
|
+
#
|
27
|
+
# In using this resource via notifications, it's important to *only* use
|
28
|
+
# immediate notifications. Delayed notifications produce unintuitive and
|
29
|
+
# probably undesired results.
|
30
|
+
#
|
31
|
+
# @since 12.0
|
26
32
|
class Reboot < Chef::Resource
|
27
|
-
|
28
|
-
|
29
|
-
def initialize(name, run_context = nil)
|
30
|
-
super
|
31
|
-
@provider = Chef::Provider::Reboot
|
32
|
-
|
33
|
-
@reason = "Reboot by Chef"
|
34
|
-
@delay_mins = 0
|
33
|
+
resource_name :reboot
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
def reason(arg = nil)
|
40
|
-
set_or_return(:reason, arg, :kind_of => String)
|
41
|
-
end
|
35
|
+
allowed_actions :request_reboot, :reboot_now, :cancel
|
36
|
+
default_action :nothing # make sure people are quite clear what they want
|
42
37
|
|
43
|
-
|
44
|
-
|
45
|
-
end
|
38
|
+
property :reason, String, default: "Reboot by Chef"
|
39
|
+
property :delay_mins, Integer, default: 0
|
46
40
|
end
|
47
41
|
end
|
48
42
|
end
|
@@ -23,6 +23,9 @@ require "chef/mixin/securable"
|
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Resource
|
26
|
+
# Use the remote_directory resource to incrementally transfer a directory from a cookbook to a node. The director
|
27
|
+
# that is copied from the cookbook should be located under COOKBOOK_NAME/files/default/REMOTE_DIRECTORY. The
|
28
|
+
# remote_directory resource will obey file specificity.
|
26
29
|
class RemoteDirectory < Chef::Resource::Directory
|
27
30
|
include Chef::Mixin::Securable
|
28
31
|
|
@@ -25,6 +25,8 @@ require "chef/mixin/uris"
|
|
25
25
|
|
26
26
|
class Chef
|
27
27
|
class Resource
|
28
|
+
# Use the remote_file resource to transfer a file from a remote location using file specificity. This resource is
|
29
|
+
# similar to the file resource.
|
28
30
|
class RemoteFile < Chef::Resource::File
|
29
31
|
include Chef::Mixin::Securable
|
30
32
|
|
@@ -20,6 +20,10 @@ require "chef/resource"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# @author Tyler Ball
|
24
|
+
# @attr [Resource] resource the Chef resource object to notify to
|
25
|
+
# @attr [Action] action the action to notify
|
26
|
+
# @attr [Resource] notifying_resource the Chef resource performing the notification
|
23
27
|
class Notification
|
24
28
|
|
25
29
|
attr_accessor :resource, :action, :notifying_resource
|
@@ -30,6 +34,10 @@ class Chef
|
|
30
34
|
@notifying_resource = notifying_resource
|
31
35
|
end
|
32
36
|
|
37
|
+
# Is the current notification a duplicate of another notification
|
38
|
+
#
|
39
|
+
# @param [Notification] another notification object to compare to
|
40
|
+
# @return [Boolean] does the resource match
|
33
41
|
def duplicates?(other_notification)
|
34
42
|
unless other_notification.respond_to?(:resource) && other_notification.respond_to?(:action)
|
35
43
|
msg = "only duck-types of Chef::Resource::Notification can be checked for duplication "\
|
@@ -41,6 +49,9 @@ class Chef
|
|
41
49
|
|
42
50
|
# If resource and/or notifying_resource is not a resource object, this will look them up in the resource collection
|
43
51
|
# and fix the references from strings to actual Resource objects.
|
52
|
+
# @param [ResourceCollection] resource_collection
|
53
|
+
#
|
54
|
+
# @return [void]
|
44
55
|
def resolve_resource_reference(resource_collection)
|
45
56
|
return resource if resource.kind_of?(Chef::Resource) && notifying_resource.kind_of?(Chef::Resource)
|
46
57
|
|
@@ -55,6 +66,9 @@ class Chef
|
|
55
66
|
|
56
67
|
# This will look up the resource if it is not a Resource Object. It will complain if it finds multiple
|
57
68
|
# resources, can't find a resource, or gets invalid syntax.
|
69
|
+
# @param [ResourceCollection] resource_collection
|
70
|
+
#
|
71
|
+
# @return [void]
|
58
72
|
def fix_resource_reference(resource_collection)
|
59
73
|
matching_resource = resource_collection.find(resource)
|
60
74
|
if Array(matching_resource).size > 1
|
@@ -84,6 +98,9 @@ is defined near #{notifying_resource.source_line}
|
|
84
98
|
|
85
99
|
# This will look up the notifying_resource if it is not a Resource Object. It will complain if it finds multiple
|
86
100
|
# resources, can't find a resource, or gets invalid syntax.
|
101
|
+
# @param [ResourceCollection] resource_collection
|
102
|
+
#
|
103
|
+
# @return [void]
|
87
104
|
def fix_notifier_reference(resource_collection)
|
88
105
|
matching_notifier = resource_collection.find(notifying_resource)
|
89
106
|
if Array(matching_notifier).size > 1
|
data/lib/chef/resource/route.rb
CHANGED
@@ -21,6 +21,7 @@ require "chef/provider/package/rpm"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
+
# Use the rpm_package resource to manage packages for the RPM Package Manager platform.
|
24
25
|
class RpmPackage < Chef::Resource::Package
|
25
26
|
resource_name :rpm_package
|
26
27
|
provides :rpm_package, os: %w{linux aix}
|
data/lib/chef/resource/ruby.rb
CHANGED
@@ -21,6 +21,10 @@ require "chef/provider/script"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
+
# Use the ruby resource to execute scripts using the Ruby interpreter. This resource may also use any of the actions
|
25
|
+
# and properties that are available to the execute resource. Commands that are executed with this resource are (by
|
26
|
+
# their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and
|
27
|
+
# only_if to guard this resource for idempotence.
|
24
28
|
class Ruby < Chef::Resource::Script
|
25
29
|
def initialize(name, run_context = nil)
|
26
30
|
super
|
@@ -22,6 +22,9 @@ require "chef/provider/ruby_block"
|
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
|
+
# Use the ruby_block resource to execute Ruby code during a chef-client run. Ruby code in the ruby_block resource is
|
26
|
+
# evaluated with other resources during convergence, whereas Ruby code outside of a ruby_block resource is evaluated
|
27
|
+
# before other resources, as the recipe is compiled.
|
25
28
|
class RubyBlock < Chef::Resource
|
26
29
|
default_action :run
|
27
30
|
allowed_actions :create, :run
|
data/lib/chef/resource/script.rb
CHANGED
@@ -22,6 +22,10 @@ require "chef/provider/script"
|
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
|
+
# Use the script resource to execute scripts using a specified interpreter, such as Bash, csh, Perl, Python, or Ruby.
|
26
|
+
# This resource may also use any of the actions and properties that are available to the execute resource. Commands
|
27
|
+
# that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the
|
28
|
+
# environment in which they are run. Use not_if and only_if to guard this resource for idempotence.
|
25
29
|
class Script < Chef::Resource::Execute
|
26
30
|
identity_attr :name
|
27
31
|
|
@@ -21,6 +21,7 @@ require "chef/provider/package/smartos"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
+
# Use the smartos_package resource to manage packages for the SmartOS platform.
|
24
25
|
class SmartosPackage < Chef::Resource::Package
|
25
26
|
resource_name :smartos_package
|
26
27
|
provides :package, os: "solaris2", platform_family: "smartos"
|
@@ -22,6 +22,7 @@ require "chef/provider/package/solaris"
|
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
|
+
# The solaris_package resource is used to manage packages for the Solaris platform.
|
25
26
|
class SolarisPackage < Chef::Resource::Package
|
26
27
|
resource_name :solaris_package
|
27
28
|
provides :package, os: "solaris2", platform_family: "nexentacore"
|
@@ -21,6 +21,9 @@ require "iniparse"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
+
# Use the systemd_unit resource to create, manage, and run systemd units.
|
25
|
+
#
|
26
|
+
# @since 12.11
|
24
27
|
class SystemdUnit < Chef::Resource
|
25
28
|
resource_name :systemd_unit
|
26
29
|
|
@@ -46,6 +49,9 @@ class Chef
|
|
46
49
|
default: true, desired_state: false
|
47
50
|
property :verify, [TrueClass, FalseClass],
|
48
51
|
default: true, desired_state: false
|
52
|
+
property :unit_name, String, desired_state: false,
|
53
|
+
identity: true,
|
54
|
+
name_property: true
|
49
55
|
|
50
56
|
def to_ini
|
51
57
|
case content
|
@@ -24,6 +24,15 @@ require "chef/mixin/securable"
|
|
24
24
|
|
25
25
|
class Chef
|
26
26
|
class Resource
|
27
|
+
# A cookbook template is an Embedded Ruby (ERB) template that is used to dynamically generate static text files.
|
28
|
+
# Templates may contain Ruby expressions and statements, and are a great way to manage configuration files. Use the
|
29
|
+
# template resource to add cookbook templates to recipes; place the corresponding Embedded Ruby (ERB) template file
|
30
|
+
# in a cookbook’s /templates directory.
|
31
|
+
#
|
32
|
+
# Use the template resource to manage the contents of a file using an Embedded Ruby (ERB) template by transferring
|
33
|
+
# files from a sub-directory of COOKBOOK_NAME/templates/ to a specified path located on a host that is running the
|
34
|
+
# chef-client. This resource includes actions and properties from the file resource. Template files managed by the
|
35
|
+
# template resource follow the same file specificity rules as the remote_file and file resources.
|
27
36
|
class Template < Chef::Resource::File
|
28
37
|
include Chef::Mixin::Securable
|
29
38
|
|
data/lib/chef/resource/user.rb
CHANGED
@@ -20,6 +20,7 @@ require "chef/resource"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# Use the user resource to add users, update existing users, remove users, and to lock/unlock user passwords.
|
23
24
|
class User < Chef::Resource
|
24
25
|
resource_name :user_resource_abstract_base_class # this prevents magickal class name DSL wiring
|
25
26
|
identity_attr :username
|
@@ -23,6 +23,8 @@ require "chef/win32/error" if RUBY_PLATFORM =~ /mswin|mingw|windows/
|
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Resource
|
26
|
+
# Use the windows_package resource to manage Microsoft Installer Package (MSI) packages for the Microsoft Windows
|
27
|
+
# platform.
|
26
28
|
class WindowsPackage < Chef::Resource::Package
|
27
29
|
include Chef::Mixin::Uris
|
28
30
|
|
@@ -20,21 +20,16 @@ require "chef/resource"
|
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
|
+
# Use the windows_path resource to manage the path environment variable on Microsoft Windows.
|
24
|
+
#
|
25
|
+
# @since 13.4
|
23
26
|
class WindowsPath < Chef::Resource
|
24
|
-
|
25
|
-
provides :windows_path
|
27
|
+
resource_name :windows_path
|
28
|
+
provides :windows_path
|
26
29
|
|
27
30
|
allowed_actions :add, :remove
|
28
31
|
default_action :add
|
29
32
|
|
30
|
-
def initialize(name, run_context = nil)
|
31
|
-
super
|
32
|
-
@resource_name = :windows_path
|
33
|
-
@path = name
|
34
|
-
@provider = Chef::Provider::WindowsPath
|
35
|
-
@action = :add
|
36
|
-
end
|
37
|
-
|
38
33
|
property :path, String, name_property: true
|
39
34
|
end
|
40
35
|
end
|