chef 12.4.0.rc.0-universal-mingw32 → 12.4.0.rc.2-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +12 -1
- data/lib/chef/api_client.rb +130 -26
- data/lib/chef/application.rb +0 -1
- data/lib/chef/application/client.rb +8 -19
- data/lib/chef/audit/audit_reporter.rb +12 -7
- data/lib/chef/audit/logger.rb +36 -0
- data/lib/chef/audit/runner.rb +4 -2
- data/lib/chef/chef_class.rb +62 -11
- data/lib/chef/client.rb +587 -207
- data/lib/chef/config.rb +0 -1
- data/lib/chef/dsl/recipe.rb +45 -56
- data/lib/chef/dsl/resources.rb +3 -2
- data/lib/chef/event_dispatch/base.rb +7 -2
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_content_management/deploy/mv_windows.rb +16 -6
- data/lib/chef/formatters/doc.rb +15 -7
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +10 -7
- data/lib/chef/guard_interpreter/default_guard_interpreter.rb +2 -0
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +4 -1
- data/lib/chef/http/authenticator.rb +7 -2
- data/lib/chef/knife.rb +16 -4
- data/lib/chef/knife/client_create.rb +55 -31
- data/lib/chef/knife/core/generic_presenter.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +1 -1
- data/lib/chef/knife/osc_user_create.rb +97 -0
- data/lib/chef/knife/osc_user_delete.rb +51 -0
- data/lib/chef/knife/osc_user_edit.rb +58 -0
- data/lib/chef/knife/osc_user_list.rb +47 -0
- data/lib/chef/knife/osc_user_reregister.rb +64 -0
- data/lib/chef/knife/osc_user_show.rb +54 -0
- data/lib/chef/knife/user_create.rb +95 -36
- data/lib/chef/knife/user_delete.rb +52 -2
- data/lib/chef/knife/user_edit.rb +37 -7
- data/lib/chef/knife/user_list.rb +3 -0
- data/lib/chef/knife/user_reregister.rb +39 -8
- data/lib/chef/knife/user_show.rb +30 -1
- data/lib/chef/mixin/api_version_request_handling.rb +66 -0
- data/lib/chef/mixin/convert_to_class_name.rb +10 -4
- data/lib/chef/mixin/deprecation.rb +24 -0
- data/lib/chef/mixin/powershell_out.rb +98 -0
- data/lib/chef/mixin/provides.rb +5 -18
- data/lib/chef/mixin/uris.rb +11 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +5 -2
- data/lib/chef/mixin/windows_env_helper.rb +11 -2
- data/lib/chef/node_map.rb +130 -75
- data/lib/chef/osc_user.rb +194 -0
- data/lib/chef/platform/provider_mapping.rb +2 -269
- data/lib/chef/platform/provider_priority_map.rb +6 -69
- data/lib/chef/platform/query_helpers.rb +5 -0
- data/lib/chef/platform/resource_priority_map.rb +12 -15
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/provider.rb +19 -0
- data/lib/chef/provider/directory.rb +3 -0
- data/lib/chef/provider/dsc_resource.rb +8 -1
- data/lib/chef/provider/file.rb +1 -0
- data/lib/chef/provider/group/aix.rb +1 -0
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/group/gpasswd.rb +1 -0
- data/lib/chef/provider/group/groupmod.rb +1 -1
- data/lib/chef/provider/group/pw.rb +1 -0
- data/lib/chef/provider/group/suse.rb +2 -0
- data/lib/chef/provider/group/usermod.rb +2 -1
- data/lib/chef/provider/group/windows.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +2 -0
- data/lib/chef/provider/ifconfig/aix.rb +1 -0
- data/lib/chef/provider/ifconfig/debian.rb +2 -0
- data/lib/chef/provider/ifconfig/redhat.rb +1 -0
- data/lib/chef/provider/lwrp_base.rb +4 -0
- data/lib/chef/provider/mount.rb +0 -1
- data/lib/chef/provider/mount/aix.rb +1 -0
- data/lib/chef/provider/mount/mount.rb +2 -0
- data/lib/chef/provider/mount/solaris.rb +2 -0
- data/lib/chef/provider/package.rb +55 -0
- data/lib/chef/provider/package/aix.rb +7 -7
- data/lib/chef/provider/package/apt.rb +3 -3
- data/lib/chef/provider/package/dpkg.rb +4 -4
- data/lib/chef/provider/package/easy_install.rb +5 -5
- data/lib/chef/provider/package/freebsd/base.rb +2 -2
- data/lib/chef/provider/package/freebsd/pkg.rb +6 -6
- data/lib/chef/provider/package/freebsd/pkgng.rb +5 -5
- data/lib/chef/provider/package/freebsd/port.rb +4 -4
- data/lib/chef/provider/package/homebrew.rb +2 -2
- data/lib/chef/provider/package/ips.rb +4 -4
- data/lib/chef/provider/package/macports.rb +5 -6
- data/lib/chef/provider/package/openbsd.rb +4 -5
- data/lib/chef/provider/package/pacman.rb +4 -4
- data/lib/chef/provider/package/portage.rb +2 -0
- data/lib/chef/provider/package/rpm.rb +7 -8
- data/lib/chef/provider/package/rubygems.rb +5 -12
- data/lib/chef/provider/package/smartos.rb +4 -4
- data/lib/chef/provider/package/solaris.rb +7 -7
- data/lib/chef/provider/package/windows/msi.rb +1 -1
- data/lib/chef/provider/package/yum.rb +4 -6
- data/lib/chef/provider/package/zypper.rb +16 -14
- data/lib/chef/provider/powershell_script.rb +129 -47
- data/lib/chef/provider/remote_file/content.rb +4 -1
- data/lib/chef/provider/remote_file/local_file.rb +10 -4
- data/lib/chef/provider/service.rb +44 -0
- data/lib/chef/provider/service/freebsd.rb +1 -1
- data/lib/chef/provider/service/init.rb +1 -0
- data/lib/chef/provider/service/macosx.rb +1 -1
- data/lib/chef/provider/service/windows.rb +0 -1
- data/lib/chef/provider/user.rb +1 -1
- data/lib/chef/provider/user/aix.rb +3 -2
- data/lib/chef/provider/user/pw.rb +1 -0
- data/lib/chef/provider/user/solaris.rb +2 -0
- data/lib/chef/provider/user/useradd.rb +1 -0
- data/lib/chef/provider_resolver.rb +87 -134
- data/lib/chef/resource.rb +274 -68
- data/lib/chef/resource/apt_package.rb +0 -2
- data/lib/chef/resource/bash.rb +0 -2
- data/lib/chef/resource/batch.rb +1 -1
- data/lib/chef/resource/bff_package.rb +0 -7
- data/lib/chef/resource/breakpoint.rb +3 -6
- data/lib/chef/resource/chef_gem.rb +0 -3
- data/lib/chef/resource/cookbook_file.rb +1 -3
- data/lib/chef/resource/cron.rb +2 -4
- data/lib/chef/resource/csh.rb +0 -2
- data/lib/chef/resource/deploy.rb +9 -6
- data/lib/chef/resource/deploy_revision.rb +0 -14
- data/lib/chef/resource/directory.rb +2 -4
- data/lib/chef/resource/dpkg_package.rb +0 -5
- data/lib/chef/resource/dsc_resource.rb +2 -3
- data/lib/chef/resource/dsc_script.rb +2 -3
- data/lib/chef/resource/easy_install_package.rb +0 -7
- data/lib/chef/resource/env.rb +3 -3
- data/lib/chef/resource/erl_call.rb +2 -5
- data/lib/chef/resource/execute.rb +2 -4
- data/lib/chef/resource/file.rb +2 -4
- data/lib/chef/resource/freebsd_package.rb +0 -5
- data/lib/chef/resource/gem_package.rb +0 -3
- data/lib/chef/resource/git.rb +0 -3
- data/lib/chef/resource/group.rb +2 -4
- data/lib/chef/resource/homebrew_package.rb +0 -2
- data/lib/chef/resource/http_request.rb +3 -4
- data/lib/chef/resource/ifconfig.rb +3 -4
- data/lib/chef/resource/ips_package.rb +2 -2
- data/lib/chef/resource/link.rb +3 -5
- data/lib/chef/resource/log.rb +2 -4
- data/lib/chef/resource/lwrp_base.rb +10 -61
- data/lib/chef/resource/macosx_service.rb +1 -2
- data/lib/chef/resource/macports_package.rb +0 -7
- data/lib/chef/resource/mdadm.rb +2 -5
- data/lib/chef/resource/mount.rb +2 -4
- data/lib/chef/resource/ohai.rb +2 -4
- data/lib/chef/resource/openbsd_package.rb +0 -6
- data/lib/chef/resource/package.rb +9 -6
- data/lib/chef/resource/pacman_package.rb +0 -7
- data/lib/chef/resource/paludis_package.rb +2 -3
- data/lib/chef/resource/perl.rb +0 -3
- data/lib/chef/resource/portage_package.rb +0 -3
- data/lib/chef/resource/powershell_script.rb +1 -2
- data/lib/chef/resource/python.rb +0 -3
- data/lib/chef/resource/reboot.rb +1 -3
- data/lib/chef/resource/registry_key.rb +3 -5
- data/lib/chef/resource/remote_directory.rb +3 -5
- data/lib/chef/resource/remote_file.rb +4 -5
- data/lib/chef/resource/route.rb +3 -5
- data/lib/chef/resource/rpm_package.rb +0 -2
- data/lib/chef/resource/ruby.rb +0 -4
- data/lib/chef/resource/ruby_block.rb +2 -4
- data/lib/chef/resource/scm.rb +3 -5
- data/lib/chef/resource/script.rb +0 -3
- data/lib/chef/resource/service.rb +3 -5
- data/lib/chef/resource/smartos_package.rb +0 -9
- data/lib/chef/resource/solaris_package.rb +0 -10
- data/lib/chef/resource/subversion.rb +1 -3
- data/lib/chef/resource/template.rb +0 -4
- data/lib/chef/resource/timestamped_deploy.rb +0 -4
- data/lib/chef/resource/user.rb +2 -5
- data/lib/chef/resource/whyrun_safe_ruby_block.rb +0 -7
- data/lib/chef/resource/windows_package.rb +3 -3
- data/lib/chef/resource/windows_script.rb +2 -2
- data/lib/chef/resource/windows_service.rb +3 -3
- data/lib/chef/resource/yum_package.rb +0 -3
- data/lib/chef/resource/zypper_package.rb +27 -0
- data/lib/chef/resource_builder.rb +7 -0
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/resource_resolver.rb +108 -62
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/rest.rb +1 -0
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/user.rb +193 -42
- data/lib/chef/util/backup.rb +9 -1
- data/lib/chef/util/path_helper.rb +0 -1
- data/lib/chef/version.rb +1 -1
- data/spec/functional/audit/runner_spec.rb +22 -42
- data/spec/functional/mixin/powershell_out_spec.rb +43 -0
- data/spec/functional/resource/execute_spec.rb +9 -2
- data/spec/functional/resource/file_spec.rb +25 -0
- data/spec/functional/resource/group_spec.rb +5 -0
- data/spec/functional/resource/link_spec.rb +5 -11
- data/spec/functional/resource/powershell_spec.rb +40 -5
- data/spec/functional/resource/user/useradd_spec.rb +10 -18
- data/spec/integration/recipes/lwrp_spec.rb +57 -0
- data/spec/integration/recipes/provider_choice.rb +2 -7
- data/spec/integration/recipes/recipe_dsl_spec.rb +517 -19
- data/spec/spec_helper.rb +1 -1
- data/spec/support/lib/chef/provider/openldap_includer.rb +29 -0
- data/spec/support/lib/chef/resource/cat.rb +0 -2
- data/spec/support/lib/chef/resource/one_two_three_four.rb +0 -6
- data/spec/support/lib/chef/resource/openldap_includer.rb +27 -0
- data/spec/support/lib/chef/resource/with_state.rb +0 -9
- data/spec/support/lib/chef/resource/zen_follower.rb +0 -6
- data/spec/support/lib/chef/resource/zen_master.rb +1 -6
- data/spec/support/shared/context/client.rb +277 -0
- data/spec/support/shared/examples/client.rb +53 -0
- data/spec/support/shared/functional/file_resource.rb +0 -4
- data/spec/support/shared/functional/securable_resource.rb +0 -24
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +4 -4
- data/spec/support/shared/functional/windows_script.rb +1 -1
- data/spec/support/shared/unit/api_versioning.rb +77 -0
- data/spec/support/shared/unit/knife_shared.rb +40 -0
- data/spec/support/shared/unit/user_and_client_shared.rb +115 -0
- data/spec/unit/api_client_spec.rb +189 -14
- data/spec/unit/application/client_spec.rb +0 -5
- data/spec/unit/audit/audit_reporter_spec.rb +58 -14
- data/spec/unit/audit/logger_spec.rb +42 -0
- data/spec/unit/audit/runner_spec.rb +2 -2
- data/spec/unit/chef_fs/file_pattern_spec.rb +3 -15
- data/spec/unit/client_spec.rb +58 -374
- data/spec/unit/cookbook_spec.rb +0 -9
- data/spec/unit/cookbook_version_spec.rb +0 -20
- data/spec/unit/deprecation_spec.rb +55 -0
- data/spec/unit/dsl/resources_spec.rb +85 -0
- data/spec/unit/exceptions_spec.rb +2 -2
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +60 -0
- data/spec/unit/formatters/doc_spec.rb +46 -0
- data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +12 -10
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +8 -0
- data/spec/unit/http/authenticator_spec.rb +11 -2
- data/spec/unit/knife/client_create_spec.rb +122 -51
- data/spec/unit/knife/core/subcommand_loader_spec.rb +19 -3
- data/spec/unit/knife/core/ui_spec.rb +14 -0
- data/spec/unit/knife/osc_user_create_spec.rb +93 -0
- data/spec/unit/knife/osc_user_delete_spec.rb +44 -0
- data/spec/unit/knife/osc_user_edit_spec.rb +52 -0
- data/spec/unit/knife/osc_user_list_spec.rb +37 -0
- data/spec/unit/knife/osc_user_reregister_spec.rb +58 -0
- data/spec/unit/knife/osc_user_show_spec.rb +46 -0
- data/spec/unit/knife/user_create_spec.rb +177 -51
- data/spec/unit/knife/user_delete_spec.rb +34 -8
- data/spec/unit/knife/user_edit_spec.rb +31 -12
- data/spec/unit/knife/user_list_spec.rb +7 -3
- data/spec/unit/knife/user_reregister_spec.rb +38 -17
- data/spec/unit/knife/user_show_spec.rb +35 -11
- data/spec/unit/knife_spec.rb +10 -4
- data/spec/unit/lwrp_spec.rb +228 -54
- data/spec/unit/mixin/api_version_request_handling_spec.rb +127 -0
- data/spec/unit/mixin/command_spec.rb +1 -2
- data/spec/unit/mixin/powershell_out_spec.rb +70 -0
- data/spec/unit/mixin/uris_spec.rb +23 -11
- data/spec/unit/node_map_spec.rb +4 -1
- data/spec/unit/osc_user_spec.rb +276 -0
- data/spec/unit/platform_spec.rb +0 -60
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +199 -135
- data/spec/unit/provider/ifconfig/debian_spec.rb +0 -10
- data/spec/unit/provider/package/aix_spec.rb +16 -16
- data/spec/unit/provider/package/dpkg_spec.rb +2 -2
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +13 -13
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +7 -7
- data/spec/unit/provider/package/ips_spec.rb +22 -22
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +4 -26
- data/spec/unit/provider/package/pacman_spec.rb +5 -5
- data/spec/unit/provider/package/rpm_spec.rb +14 -14
- data/spec/unit/provider/package/rubygems_spec.rb +10 -44
- data/spec/unit/provider/package/smartos_spec.rb +4 -4
- data/spec/unit/provider/package/solaris_spec.rb +11 -11
- data/spec/unit/provider/package/zypper_spec.rb +125 -90
- data/spec/unit/provider/package_spec.rb +34 -0
- data/spec/unit/provider/powershell_spec.rb +53 -11
- data/spec/unit/provider/remote_directory_spec.rb +2 -2
- data/spec/unit/provider/remote_file/local_file_spec.rb +25 -6
- data/spec/unit/provider/service/freebsd_service_spec.rb +0 -12
- data/spec/unit/provider/user_spec.rb +3 -3
- data/spec/unit/provider_resolver_spec.rb +463 -327
- data/spec/unit/recipe_spec.rb +42 -15
- data/spec/unit/resource/breakpoint_spec.rb +1 -1
- data/spec/unit/resource/erl_call_spec.rb +1 -1
- data/spec/unit/resource/file_spec.rb +1 -1
- data/spec/unit/resource/ifconfig_spec.rb +10 -6
- data/spec/unit/resource/remote_file_spec.rb +5 -0
- data/spec/unit/resource/route_spec.rb +1 -1
- data/spec/unit/resource/ruby_block_spec.rb +2 -2
- data/spec/unit/resource/template_spec.rb +1 -1
- data/spec/unit/resource/timestamped_deploy_spec.rb +1 -2
- data/spec/unit/resource/windows_service_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +99 -13
- data/spec/unit/rest_spec.rb +5 -5
- data/spec/unit/run_context_spec.rb +41 -0
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/user_spec.rb +406 -93
- data/tasks/maintainers.rb +69 -0
- metadata +37 -4
@@ -23,18 +23,17 @@ require 'chef/provider/http_request'
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class HttpRequest < Chef::Resource
|
26
|
-
provides :http_request
|
27
26
|
|
28
27
|
identity_attr :url
|
29
28
|
|
29
|
+
default_action :get
|
30
|
+
allowed_actions :get, :put, :post, :delete, :head, :options
|
31
|
+
|
30
32
|
def initialize(name, run_context=nil)
|
31
33
|
super
|
32
|
-
@resource_name = :http_request
|
33
34
|
@message = name
|
34
35
|
@url = nil
|
35
|
-
@action = :get
|
36
36
|
@headers = {}
|
37
|
-
@allowed_actions.push(:get, :put, :post, :delete, :head, :options)
|
38
37
|
end
|
39
38
|
|
40
39
|
def url(args=nil)
|
@@ -22,18 +22,17 @@ require 'chef/resource'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class Ifconfig < Chef::Resource
|
25
|
-
provides :ifconfig
|
26
25
|
|
27
26
|
identity_attr :device
|
28
27
|
|
29
28
|
state_attrs :inet_addr, :mask
|
30
29
|
|
30
|
+
default_action :add
|
31
|
+
allowed_actions :add, :delete, :enable, :disable
|
32
|
+
|
31
33
|
def initialize(name, run_context=nil)
|
32
34
|
super
|
33
|
-
@resource_name = :ifconfig
|
34
35
|
@target = name
|
35
|
-
@action = :add
|
36
|
-
@allowed_actions.push(:add, :delete, :enable, :disable)
|
37
36
|
@hwaddr = nil
|
38
37
|
@mask = nil
|
39
38
|
@inet_addr = nil
|
@@ -25,10 +25,10 @@ class Chef
|
|
25
25
|
|
26
26
|
provides :ips_package, os: "solaris2"
|
27
27
|
|
28
|
+
allowed_actions :install, :remove, :upgrade
|
29
|
+
|
28
30
|
def initialize(name, run_context = nil)
|
29
31
|
super(name, run_context)
|
30
|
-
@resource_name = :ips_package
|
31
|
-
@allowed_actions.push(:install, :remove, :upgrade)
|
32
32
|
@accept_license = false
|
33
33
|
end
|
34
34
|
|
data/lib/chef/resource/link.rb
CHANGED
@@ -25,21 +25,19 @@ class Chef
|
|
25
25
|
class Link < Chef::Resource
|
26
26
|
include Chef::Mixin::Securable
|
27
27
|
|
28
|
-
provides :link
|
29
|
-
|
30
28
|
identity_attr :target_file
|
31
29
|
|
32
30
|
state_attrs :to, :owner, :group
|
33
31
|
|
32
|
+
default_action :create
|
33
|
+
allowed_actions :create, :delete
|
34
|
+
|
34
35
|
def initialize(name, run_context=nil)
|
35
36
|
verify_links_supported!
|
36
37
|
super
|
37
|
-
@resource_name = :link
|
38
38
|
@to = nil
|
39
|
-
@action = :create
|
40
39
|
@link_type = :symbolic
|
41
40
|
@target_file = name
|
42
|
-
@allowed_actions.push(:create, :delete)
|
43
41
|
end
|
44
42
|
|
45
43
|
def to(arg=nil)
|
data/lib/chef/resource/log.rb
CHANGED
@@ -23,10 +23,11 @@ require 'chef/provider/log'
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class Log < Chef::Resource
|
26
|
-
provides :log
|
27
26
|
|
28
27
|
identity_attr :message
|
29
28
|
|
29
|
+
default_action :write
|
30
|
+
|
30
31
|
# Sends a string from a recipe to a log provider
|
31
32
|
#
|
32
33
|
# log "some string to log" do
|
@@ -49,10 +50,7 @@ class Chef
|
|
49
50
|
# node<Chef::Node>:: Node where resource will be used
|
50
51
|
def initialize(name, run_context=nil)
|
51
52
|
super
|
52
|
-
@resource_name = :log
|
53
53
|
@level = :info
|
54
|
-
@action = :write
|
55
|
-
@allowed_actions.push(:write)
|
56
54
|
@message = name
|
57
55
|
end
|
58
56
|
|
@@ -35,8 +35,6 @@ class Chef
|
|
35
35
|
# so attributes, default action, etc. can be defined with pleasing syntax.
|
36
36
|
class LWRPBase < Resource
|
37
37
|
|
38
|
-
NULL_ARG = Object.new
|
39
|
-
|
40
38
|
# Class methods
|
41
39
|
class <<self
|
42
40
|
|
@@ -55,12 +53,11 @@ class Chef
|
|
55
53
|
|
56
54
|
# We load the class first to give it a chance to set its own name
|
57
55
|
resource_class = Class.new(self)
|
58
|
-
resource_class.resource_name
|
56
|
+
resource_class.resource_name resource_name.to_sym
|
59
57
|
resource_class.run_context = run_context
|
60
|
-
resource_class.provides resource_name.to_sym
|
61
58
|
resource_class.class_from_file(filename)
|
62
59
|
|
63
|
-
#
|
60
|
+
# Make a useful string for the class (rather than <Class:312894723894>)
|
64
61
|
resource_class.instance_eval do
|
65
62
|
define_singleton_method(:to_s) do
|
66
63
|
"LWRP resource #{resource_name} from cookbook #{cookbook_name}"
|
@@ -72,21 +69,11 @@ class Chef
|
|
72
69
|
|
73
70
|
LWRPBase.loaded_lwrps[filename] = true
|
74
71
|
|
72
|
+
# Create the deprecated Chef::Resource::LwrpFoo class
|
75
73
|
Chef::Resource.register_deprecated_lwrp_class(resource_class, convert_to_class_name(resource_name))
|
76
|
-
|
77
74
|
resource_class
|
78
75
|
end
|
79
76
|
|
80
|
-
def resource_name(arg = NULL_ARG)
|
81
|
-
if arg.equal?(NULL_ARG)
|
82
|
-
@resource_name
|
83
|
-
else
|
84
|
-
@resource_name = arg
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
alias_method :resource_name=, :resource_name
|
89
|
-
|
90
77
|
# Define an attribute on this resource, including optional validation
|
91
78
|
# parameters.
|
92
79
|
def attribute(attr_name, validation_opts={})
|
@@ -95,42 +82,21 @@ class Chef
|
|
95
82
|
end
|
96
83
|
end
|
97
84
|
|
98
|
-
# Sets the default action
|
99
|
-
def default_action(action_name=NULL_ARG)
|
100
|
-
unless action_name.equal?(NULL_ARG)
|
101
|
-
@actions ||= []
|
102
|
-
if action_name.is_a?(Array)
|
103
|
-
action = action_name.map { |arg| arg.to_sym }
|
104
|
-
@actions = actions | action
|
105
|
-
@default_action = action
|
106
|
-
else
|
107
|
-
action = action_name.to_sym
|
108
|
-
@actions.push(action) unless @actions.include?(action)
|
109
|
-
@default_action = [action]
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
@default_action ||= from_superclass(:default_action)
|
114
|
-
end
|
115
|
-
|
116
85
|
# Adds +action_names+ to the list of valid actions for this resource.
|
86
|
+
# Does not include superclass's action list when appending.
|
117
87
|
def actions(*action_names)
|
118
|
-
if action_names.empty?
|
119
|
-
|
88
|
+
if !action_names.empty? && !@allowed_actions
|
89
|
+
self.allowed_actions = action_names
|
120
90
|
else
|
121
|
-
|
122
|
-
if defined?(@actions)
|
123
|
-
@actions.push(*action_names)
|
124
|
-
else
|
125
|
-
@actions = action_names
|
126
|
-
end
|
91
|
+
allowed_actions(*action_names)
|
127
92
|
end
|
128
93
|
end
|
94
|
+
alias :actions= :allowed_actions=
|
129
95
|
|
130
96
|
# @deprecated
|
131
97
|
def valid_actions(*args)
|
132
|
-
Chef::Log.warn("`valid_actions' is deprecated, please use
|
133
|
-
|
98
|
+
Chef::Log.warn("`valid_actions' is deprecated, please use allowed_actions `instead'!")
|
99
|
+
allowed_actions(*args)
|
134
100
|
end
|
135
101
|
|
136
102
|
# Set the run context on the class. Used to provide access to the node
|
@@ -162,23 +128,6 @@ class Chef
|
|
162
128
|
superclass.respond_to?(m) ? superclass.send(m) : default
|
163
129
|
end
|
164
130
|
end
|
165
|
-
|
166
|
-
private
|
167
|
-
|
168
|
-
# Default initializer. Sets the default action and allowed actions.
|
169
|
-
def initialize(name, run_context=nil)
|
170
|
-
super(name, run_context)
|
171
|
-
|
172
|
-
# Raise an exception if the resource_name was not defined
|
173
|
-
if self.class.resource_name.nil?
|
174
|
-
raise Chef::Exceptions::InvalidResourceSpecification,
|
175
|
-
"You must specify `resource_name'!"
|
176
|
-
end
|
177
|
-
|
178
|
-
@resource_name = self.class.resource_name.to_sym
|
179
|
-
@action = self.class.default_action
|
180
|
-
allowed_actions.push(self.class.actions).flatten!
|
181
|
-
end
|
182
131
|
end
|
183
132
|
end
|
184
133
|
end
|
@@ -22,8 +22,8 @@ class Chef
|
|
22
22
|
class Resource
|
23
23
|
class MacosxService < Chef::Resource::Service
|
24
24
|
|
25
|
-
provides :service, os: "darwin"
|
26
25
|
provides :macosx_service, os: "darwin"
|
26
|
+
provides :service, os: "darwin"
|
27
27
|
|
28
28
|
identity_attr :service_name
|
29
29
|
|
@@ -31,7 +31,6 @@ class Chef
|
|
31
31
|
|
32
32
|
def initialize(name, run_context=nil)
|
33
33
|
super
|
34
|
-
@resource_name = :macosx_service
|
35
34
|
@plist = nil
|
36
35
|
@session_type = nil
|
37
36
|
end
|
@@ -19,14 +19,7 @@
|
|
19
19
|
class Chef
|
20
20
|
class Resource
|
21
21
|
class MacportsPackage < Chef::Resource::Package
|
22
|
-
|
23
|
-
provides :macports_package
|
24
22
|
provides :package, os: "darwin"
|
25
|
-
|
26
|
-
def initialize(name, run_context=nil)
|
27
|
-
super
|
28
|
-
@resource_name = :macports_package
|
29
|
-
end
|
30
23
|
end
|
31
24
|
end
|
32
25
|
end
|
data/lib/chef/resource/mdadm.rb
CHANGED
@@ -27,11 +27,11 @@ class Chef
|
|
27
27
|
|
28
28
|
state_attrs :devices, :level, :chunk
|
29
29
|
|
30
|
-
|
30
|
+
default_action :create
|
31
|
+
allowed_actions :create, :assemble, :stop
|
31
32
|
|
32
33
|
def initialize(name, run_context=nil)
|
33
34
|
super
|
34
|
-
@resource_name = :mdadm
|
35
35
|
|
36
36
|
@chunk = 16
|
37
37
|
@devices = []
|
@@ -40,9 +40,6 @@ class Chef
|
|
40
40
|
@metadata = "0.90"
|
41
41
|
@bitmap = nil
|
42
42
|
@raid_device = name
|
43
|
-
|
44
|
-
@action = :create
|
45
|
-
@allowed_actions.push(:create, :assemble, :stop)
|
46
43
|
end
|
47
44
|
|
48
45
|
def chunk(arg=nil)
|
data/lib/chef/resource/mount.rb
CHANGED
@@ -27,11 +27,11 @@ class Chef
|
|
27
27
|
|
28
28
|
state_attrs :mount_point, :device_type, :fstype, :username, :password, :domain
|
29
29
|
|
30
|
-
|
30
|
+
default_action :mount
|
31
|
+
allowed_actions :mount, :umount, :remount, :enable, :disable
|
31
32
|
|
32
33
|
def initialize(name, run_context=nil)
|
33
34
|
super
|
34
|
-
@resource_name = :mount
|
35
35
|
@mount_point = name
|
36
36
|
@device = nil
|
37
37
|
@device_type = :device
|
@@ -42,9 +42,7 @@ class Chef
|
|
42
42
|
@pass = 2
|
43
43
|
@mounted = false
|
44
44
|
@enabled = false
|
45
|
-
@action = :mount
|
46
45
|
@supports = { :remount => false }
|
47
|
-
@allowed_actions.push(:mount, :umount, :remount, :enable, :disable)
|
48
46
|
@username = nil
|
49
47
|
@password = nil
|
50
48
|
@domain = nil
|
data/lib/chef/resource/ohai.rb
CHANGED
@@ -20,18 +20,16 @@
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
22
22
|
class Ohai < Chef::Resource
|
23
|
-
provides :ohai
|
24
23
|
|
25
24
|
identity_attr :name
|
26
25
|
|
27
26
|
state_attrs :plugin
|
28
27
|
|
28
|
+
default_action :reload
|
29
|
+
|
29
30
|
def initialize(name, run_context=nil)
|
30
31
|
super
|
31
|
-
@resource_name = :ohai
|
32
32
|
@name = name
|
33
|
-
@allowed_actions.push(:reload)
|
34
|
-
@action = :reload
|
35
33
|
@plugin = nil
|
36
34
|
end
|
37
35
|
|
@@ -30,11 +30,6 @@ class Chef
|
|
30
30
|
|
31
31
|
provides :package, os: "openbsd"
|
32
32
|
|
33
|
-
def initialize(name, run_context=nil)
|
34
|
-
super
|
35
|
-
@resource_name = :openbsd_package
|
36
|
-
end
|
37
|
-
|
38
33
|
def after_created
|
39
34
|
assign_provider
|
40
35
|
end
|
@@ -48,4 +43,3 @@ class Chef
|
|
48
43
|
end
|
49
44
|
end
|
50
45
|
end
|
51
|
-
|
@@ -22,25 +22,23 @@ require 'chef/resource'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class Package < Chef::Resource
|
25
|
-
provides :package
|
26
|
-
|
27
25
|
identity_attr :package_name
|
28
26
|
|
29
27
|
state_attrs :version, :options
|
30
28
|
|
29
|
+
default_action :install
|
30
|
+
allowed_actions :install, :upgrade, :remove, :purge, :reconfig
|
31
|
+
|
31
32
|
def initialize(name, run_context=nil)
|
32
33
|
super
|
33
|
-
@action = :install
|
34
|
-
@allowed_actions.push(:install, :upgrade, :remove, :purge, :reconfig)
|
35
34
|
@candidate_version = nil
|
36
35
|
@options = nil
|
37
36
|
@package_name = name
|
38
|
-
@resource_name = :package
|
39
37
|
@response_file = nil
|
40
38
|
@response_file_variables = Hash.new
|
41
39
|
@source = nil
|
42
40
|
@version = nil
|
43
|
-
@timeout =
|
41
|
+
@timeout = nil
|
44
42
|
end
|
45
43
|
|
46
44
|
def package_name(arg=nil)
|
@@ -102,3 +100,8 @@ class Chef
|
|
102
100
|
end
|
103
101
|
end
|
104
102
|
end
|
103
|
+
|
104
|
+
require 'chef/chef_class'
|
105
|
+
require 'chef/resource/homebrew_package'
|
106
|
+
|
107
|
+
Chef.set_resource_priority_array :package, Chef::Resource::HomebrewPackage, os: "darwin"
|
@@ -21,14 +21,7 @@ require 'chef/resource/package'
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
23
|
class PacmanPackage < Chef::Resource::Package
|
24
|
-
|
25
24
|
provides :pacman_package, os: "linux"
|
26
|
-
|
27
|
-
def initialize(name, run_context=nil)
|
28
|
-
super
|
29
|
-
@resource_name = :pacman_package
|
30
|
-
end
|
31
|
-
|
32
25
|
end
|
33
26
|
end
|
34
27
|
end
|
@@ -22,13 +22,12 @@ require 'chef/provider/package/paludis'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class PaludisPackage < Chef::Resource::Package
|
25
|
-
|
26
25
|
provides :paludis_package, os: "linux"
|
27
26
|
|
27
|
+
allowed_actions :install, :remove, :upgrade
|
28
|
+
|
28
29
|
def initialize(name, run_context=nil)
|
29
30
|
super(name, run_context)
|
30
|
-
@resource_name = :paludis_package
|
31
|
-
@allowed_actions.push(:install, :remove, :upgrade)
|
32
31
|
@timeout = 3600
|
33
32
|
end
|
34
33
|
end
|
data/lib/chef/resource/perl.rb
CHANGED
@@ -21,11 +21,8 @@ require 'chef/resource/package'
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
23
|
class PortagePackage < Chef::Resource::Package
|
24
|
-
provides :portage_package
|
25
|
-
|
26
24
|
def initialize(name, run_context=nil)
|
27
25
|
super
|
28
|
-
@resource_name = :portage_package
|
29
26
|
@provider = Chef::Provider::Package::Portage
|
30
27
|
end
|
31
28
|
|
@@ -20,11 +20,10 @@ require 'chef/resource/windows_script'
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
22
22
|
class PowershellScript < Chef::Resource::WindowsScript
|
23
|
-
|
24
23
|
provides :powershell_script, os: "windows"
|
25
24
|
|
26
25
|
def initialize(name, run_context=nil)
|
27
|
-
super(name, run_context,
|
26
|
+
super(name, run_context, nil, "powershell.exe")
|
28
27
|
@convert_boolean_return = false
|
29
28
|
end
|
30
29
|
|