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
data/lib/chef/resource/python.rb
CHANGED
data/lib/chef/resource/reboot.rb
CHANGED
@@ -24,13 +24,11 @@ require 'chef/resource'
|
|
24
24
|
class Chef
|
25
25
|
class Resource
|
26
26
|
class Reboot < Chef::Resource
|
27
|
-
|
27
|
+
allowed_actions :request_reboot, :reboot_now, :cancel
|
28
28
|
|
29
29
|
def initialize(name, run_context=nil)
|
30
30
|
super
|
31
|
-
@resource_name = :reboot
|
32
31
|
@provider = Chef::Provider::Reboot
|
33
|
-
@allowed_actions.push(:request_reboot, :reboot_now, :cancel)
|
34
32
|
|
35
33
|
@reason = "Reboot by Chef"
|
36
34
|
@delay_mins = 0
|
@@ -22,11 +22,12 @@ require 'chef/digester'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class RegistryKey < Chef::Resource
|
25
|
-
provides :registry_key
|
26
|
-
|
27
25
|
identity_attr :key
|
28
26
|
state_attrs :values
|
29
27
|
|
28
|
+
default_action :create
|
29
|
+
allowed_actions :create, :create_if_missing, :delete, :delete_key
|
30
|
+
|
30
31
|
# Some registry key data types may not be safely reported as json.
|
31
32
|
# Example (CHEF-5323):
|
32
33
|
#
|
@@ -60,13 +61,10 @@ class Chef
|
|
60
61
|
|
61
62
|
def initialize(name, run_context=nil)
|
62
63
|
super
|
63
|
-
@resource_name = :registry_key
|
64
|
-
@action = :create
|
65
64
|
@architecture = :machine
|
66
65
|
@recursive = false
|
67
66
|
@key = name
|
68
67
|
@values, @unscrubbed_values = [], []
|
69
|
-
@allowed_actions.push(:create, :create_if_missing, :delete, :delete_key)
|
70
68
|
end
|
71
69
|
|
72
70
|
def key(arg=nil)
|
@@ -26,19 +26,18 @@ class Chef
|
|
26
26
|
class RemoteDirectory < Chef::Resource::Directory
|
27
27
|
include Chef::Mixin::Securable
|
28
28
|
|
29
|
-
provides :remote_directory
|
30
|
-
|
31
29
|
identity_attr :path
|
32
30
|
|
33
31
|
state_attrs :files_owner, :files_group, :files_mode
|
34
32
|
|
33
|
+
default_action :create
|
34
|
+
allowed_actions :create, :create_if_missing, :delete
|
35
|
+
|
35
36
|
def initialize(name, run_context=nil)
|
36
37
|
super
|
37
|
-
@resource_name = :remote_directory
|
38
38
|
@path = name
|
39
39
|
@source = ::File.basename(name)
|
40
40
|
@delete = false
|
41
|
-
@action = :create
|
42
41
|
@recursive = true
|
43
42
|
@purge = false
|
44
43
|
@files_backup = 5
|
@@ -46,7 +45,6 @@ class Chef
|
|
46
45
|
@files_group = nil
|
47
46
|
@files_mode = 0644 unless Chef::Platform.windows?
|
48
47
|
@overwrite = true
|
49
|
-
@allowed_actions.push(:create, :create_if_missing, :delete)
|
50
48
|
@cookbook = nil
|
51
49
|
end
|
52
50
|
|
@@ -21,18 +21,15 @@ require 'uri'
|
|
21
21
|
require 'chef/resource/file'
|
22
22
|
require 'chef/provider/remote_file'
|
23
23
|
require 'chef/mixin/securable'
|
24
|
+
require 'chef/mixin/uris'
|
24
25
|
|
25
26
|
class Chef
|
26
27
|
class Resource
|
27
28
|
class RemoteFile < Chef::Resource::File
|
28
29
|
include Chef::Mixin::Securable
|
29
30
|
|
30
|
-
provides :remote_file
|
31
|
-
|
32
31
|
def initialize(name, run_context=nil)
|
33
32
|
super
|
34
|
-
@resource_name = :remote_file
|
35
|
-
@action = "create"
|
36
33
|
@source = []
|
37
34
|
@use_etag = true
|
38
35
|
@use_last_modified = true
|
@@ -127,6 +124,8 @@ class Chef
|
|
127
124
|
|
128
125
|
private
|
129
126
|
|
127
|
+
include Chef::Mixin::Uris
|
128
|
+
|
130
129
|
def validate_source(source)
|
131
130
|
source = Array(source).flatten
|
132
131
|
raise ArgumentError, "#{resource_name} has an empty source" if source.empty?
|
@@ -140,7 +139,7 @@ class Chef
|
|
140
139
|
end
|
141
140
|
|
142
141
|
def absolute_uri?(source)
|
143
|
-
Chef::Provider::RemoteFile::Fetcher.network_share?(source) or (source.kind_of?(String) and
|
142
|
+
Chef::Provider::RemoteFile::Fetcher.network_share?(source) or (source.kind_of?(String) and as_uri(source).absolute?)
|
144
143
|
rescue URI::InvalidURIError
|
145
144
|
false
|
146
145
|
end
|
data/lib/chef/resource/route.rb
CHANGED
@@ -22,18 +22,16 @@ require 'chef/resource'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class Route < Chef::Resource
|
25
|
-
provides :route
|
26
|
-
|
27
25
|
identity_attr :target
|
28
26
|
|
29
27
|
state_attrs :netmask, :gateway
|
30
28
|
|
29
|
+
default_action :add
|
30
|
+
allowed_actions :add, :delete
|
31
|
+
|
31
32
|
def initialize(name, run_context=nil)
|
32
33
|
super
|
33
|
-
@resource_name = :route
|
34
34
|
@target = name
|
35
|
-
@action = [:add]
|
36
|
-
@allowed_actions.push(:add, :delete)
|
37
35
|
@netmask = nil
|
38
36
|
@gateway = nil
|
39
37
|
@metric = nil
|
@@ -22,12 +22,10 @@ require 'chef/provider/package/rpm'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class RpmPackage < Chef::Resource::Package
|
25
|
-
|
26
25
|
provides :rpm_package, os: [ "linux", "aix" ]
|
27
26
|
|
28
27
|
def initialize(name, run_context=nil)
|
29
28
|
super
|
30
|
-
@resource_name = :rpm_package
|
31
29
|
@allow_downgrade = false
|
32
30
|
end
|
33
31
|
|
data/lib/chef/resource/ruby.rb
CHANGED
@@ -22,14 +22,10 @@ require 'chef/provider/script'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class Ruby < Chef::Resource::Script
|
25
|
-
provides :ruby
|
26
|
-
|
27
25
|
def initialize(name, run_context=nil)
|
28
26
|
super
|
29
|
-
@resource_name = :ruby
|
30
27
|
@interpreter = "ruby"
|
31
28
|
end
|
32
|
-
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end
|
@@ -23,15 +23,13 @@ require 'chef/provider/ruby_block'
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class RubyBlock < Chef::Resource
|
26
|
-
|
26
|
+
default_action :run
|
27
|
+
allowed_actions :create, :run
|
27
28
|
|
28
29
|
identity_attr :block_name
|
29
30
|
|
30
31
|
def initialize(name, run_context=nil)
|
31
32
|
super
|
32
|
-
@resource_name = :ruby_block
|
33
|
-
@action = "run"
|
34
|
-
@allowed_actions << :create << :run
|
35
33
|
@block_name = name
|
36
34
|
end
|
37
35
|
|
data/lib/chef/resource/scm.rb
CHANGED
@@ -22,24 +22,22 @@ require 'chef/resource'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class Scm < Chef::Resource
|
25
|
-
provides :scm
|
26
|
-
|
27
25
|
identity_attr :destination
|
28
26
|
|
29
27
|
state_attrs :revision
|
30
28
|
|
29
|
+
default_action :sync
|
30
|
+
allowed_actions :checkout, :export, :sync, :diff, :log
|
31
|
+
|
31
32
|
def initialize(name, run_context=nil)
|
32
33
|
super
|
33
34
|
@destination = name
|
34
|
-
@resource_name = :scm
|
35
35
|
@enable_submodules = false
|
36
36
|
@enable_checkout = true
|
37
37
|
@revision = "HEAD"
|
38
38
|
@remote = "origin"
|
39
39
|
@ssh_wrapper = nil
|
40
40
|
@depth = nil
|
41
|
-
@allowed_actions.push(:checkout, :export, :sync, :diff, :log)
|
42
|
-
@action = [:sync]
|
43
41
|
@checkout_branch = "deploy"
|
44
42
|
@environment = nil
|
45
43
|
end
|
data/lib/chef/resource/script.rb
CHANGED
@@ -23,14 +23,11 @@ require 'chef/provider/script'
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class Script < Chef::Resource::Execute
|
26
|
-
provides :script
|
27
|
-
|
28
26
|
# Chef-13: go back to using :name as the identity attr
|
29
27
|
identity_attr :command
|
30
28
|
|
31
29
|
def initialize(name, run_context=nil)
|
32
30
|
super
|
33
|
-
@resource_name = :script
|
34
31
|
# Chef-13: the command variable should be initialized to nil
|
35
32
|
@command = name
|
36
33
|
@code = nil
|
@@ -22,15 +22,15 @@ require 'chef/resource'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class Service < Chef::Resource
|
25
|
-
provides :service
|
26
|
-
|
27
25
|
identity_attr :service_name
|
28
26
|
|
29
27
|
state_attrs :enabled, :running
|
30
28
|
|
29
|
+
default_action :nothing
|
30
|
+
allowed_actions :enable, :disable, :start, :stop, :restart, :reload
|
31
|
+
|
31
32
|
def initialize(name, run_context=nil)
|
32
33
|
super
|
33
|
-
@resource_name = :service
|
34
34
|
@service_name = name
|
35
35
|
@enabled = nil
|
36
36
|
@running = nil
|
@@ -44,9 +44,7 @@ class Chef
|
|
44
44
|
@init_command = nil
|
45
45
|
@priority = nil
|
46
46
|
@timeout = nil
|
47
|
-
@action = "nothing"
|
48
47
|
@supports = { :restart => false, :reload => false, :status => false }
|
49
|
-
@allowed_actions.push(:enable, :disable, :start, :stop, :restart, :reload)
|
50
48
|
end
|
51
49
|
|
52
50
|
def service_name(arg=nil)
|
@@ -22,16 +22,7 @@ require 'chef/provider/package/smartos'
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class SmartosPackage < Chef::Resource::Package
|
25
|
-
|
26
|
-
provides :smartos_package
|
27
25
|
provides :package, os: "solaris2", platform_family: "smartos"
|
28
|
-
|
29
|
-
def initialize(name, run_context=nil)
|
30
|
-
super
|
31
|
-
@resource_name = :smartos_package
|
32
|
-
end
|
33
|
-
|
34
26
|
end
|
35
27
|
end
|
36
28
|
end
|
37
|
-
|
@@ -23,21 +23,11 @@ require 'chef/provider/package/solaris'
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
25
25
|
class SolarisPackage < Chef::Resource::Package
|
26
|
-
|
27
|
-
provides :solaris_package
|
28
26
|
provides :package, os: "solaris2", platform_family: "nexentacore"
|
29
27
|
provides :package, os: "solaris2", platform_family: "solaris2" do |node|
|
30
28
|
# on >= Solaris 11 we default to IPS packages instead
|
31
29
|
node[:platform_version].to_f <= 5.10
|
32
30
|
end
|
33
|
-
|
34
|
-
def initialize(name, run_context=nil)
|
35
|
-
super
|
36
|
-
@resource_name = :solaris_package
|
37
|
-
end
|
38
|
-
|
39
31
|
end
|
40
32
|
end
|
41
33
|
end
|
42
|
-
|
43
|
-
|
@@ -22,14 +22,12 @@ require "chef/resource/scm"
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
24
|
class Subversion < Chef::Resource::Scm
|
25
|
-
|
25
|
+
allowed_actions :force_export
|
26
26
|
|
27
27
|
def initialize(name, run_context=nil)
|
28
28
|
super
|
29
29
|
@svn_arguments = '--no-auth-cache'
|
30
30
|
@svn_info_args = '--no-auth-cache'
|
31
|
-
@resource_name = :subversion
|
32
|
-
allowed_actions << :force_export
|
33
31
|
end
|
34
32
|
|
35
33
|
# Override exception to strip password if any, so it won't appear in logs and different Chef notifications
|
@@ -27,15 +27,11 @@ class Chef
|
|
27
27
|
class Template < Chef::Resource::File
|
28
28
|
include Chef::Mixin::Securable
|
29
29
|
|
30
|
-
provides :template
|
31
|
-
|
32
30
|
attr_reader :inline_helper_blocks
|
33
31
|
attr_reader :inline_helper_modules
|
34
32
|
|
35
33
|
def initialize(name, run_context=nil)
|
36
34
|
super
|
37
|
-
@resource_name = :template
|
38
|
-
@action = "create"
|
39
35
|
@source = "#{::File.basename(name)}.erb"
|
40
36
|
@cookbook = nil
|
41
37
|
@local = false
|
@@ -21,10 +21,6 @@ class Chef
|
|
21
21
|
# Convenience class for using the deploy resource with the timestamped
|
22
22
|
# deployment strategy (provider)
|
23
23
|
class TimestampedDeploy < Chef::Resource::Deploy
|
24
|
-
provides :timestamped_deploy
|
25
|
-
def initialize(*args, &block)
|
26
|
-
super(*args, &block)
|
27
|
-
end
|
28
24
|
end
|
29
25
|
end
|
30
26
|
end
|
data/lib/chef/resource/user.rb
CHANGED
@@ -21,16 +21,15 @@ require 'chef/resource'
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
23
23
|
class User < Chef::Resource
|
24
|
-
|
25
24
|
identity_attr :username
|
26
25
|
|
27
26
|
state_attrs :uid, :gid, :home
|
28
27
|
|
29
|
-
|
28
|
+
default_action :create
|
29
|
+
allowed_actions :create, :remove, :modify, :manage, :lock, :unlock
|
30
30
|
|
31
31
|
def initialize(name, run_context=nil)
|
32
32
|
super
|
33
|
-
@resource_name = :user
|
34
33
|
@username = name
|
35
34
|
@comment = nil
|
36
35
|
@uid = nil
|
@@ -42,14 +41,12 @@ class Chef
|
|
42
41
|
@manage_home = false
|
43
42
|
@force = false
|
44
43
|
@non_unique = false
|
45
|
-
@action = :create
|
46
44
|
@supports = {
|
47
45
|
:manage_home => false,
|
48
46
|
:non_unique => false
|
49
47
|
}
|
50
48
|
@iterations = 27855
|
51
49
|
@salt = nil
|
52
|
-
@allowed_actions.push(:create, :remove, :modify, :manage, :lock, :unlock)
|
53
50
|
end
|
54
51
|
|
55
52
|
def username(arg=nil)
|
@@ -19,13 +19,6 @@
|
|
19
19
|
class Chef
|
20
20
|
class Resource
|
21
21
|
class WhyrunSafeRubyBlock < Chef::Resource::RubyBlock
|
22
|
-
provides :whyrun_safe_ruby_block
|
23
|
-
|
24
|
-
def initialize(name, run_context=nil)
|
25
|
-
super
|
26
|
-
@resource_name = :whyrun_safe_ruby_block
|
27
|
-
end
|
28
|
-
|
29
22
|
end
|
30
23
|
end
|
31
24
|
end
|
@@ -26,13 +26,13 @@ class Chef
|
|
26
26
|
class WindowsPackage < Chef::Resource::Package
|
27
27
|
include Chef::Mixin::Uris
|
28
28
|
|
29
|
-
provides :package, os: "windows"
|
30
29
|
provides :windows_package, os: "windows"
|
30
|
+
provides :package, os: "windows"
|
31
|
+
|
32
|
+
allowed_actions :install, :remove
|
31
33
|
|
32
34
|
def initialize(name, run_context=nil)
|
33
35
|
super
|
34
|
-
@allowed_actions.push(:install, :remove)
|
35
|
-
@resource_name = :windows_package
|
36
36
|
@source ||= source(@package_name)
|
37
37
|
|
38
38
|
# Unique to this resource
|
@@ -31,8 +31,8 @@ class Chef
|
|
31
31
|
def initialize(name, run_context, resource_name, interpreter_command)
|
32
32
|
super(name, run_context)
|
33
33
|
@interpreter = interpreter_command
|
34
|
-
@resource_name = resource_name
|
35
|
-
@default_guard_interpreter = resource_name
|
34
|
+
@resource_name = resource_name if resource_name
|
35
|
+
@default_guard_interpreter = self.resource_name
|
36
36
|
end
|
37
37
|
|
38
38
|
include Chef::Mixin::WindowsArchitectureHelper
|
@@ -25,8 +25,10 @@ class Chef
|
|
25
25
|
# Until #1773 is resolved, you need to manually specify the windows_service resource
|
26
26
|
# to use action :configure_startup and attribute startup_type
|
27
27
|
|
28
|
-
provides :service, os: "windows"
|
29
28
|
provides :windows_service, os: "windows"
|
29
|
+
provides :service, os: "windows"
|
30
|
+
|
31
|
+
allowed_actions :configure_startup
|
30
32
|
|
31
33
|
identity_attr :service_name
|
32
34
|
|
@@ -34,8 +36,6 @@ class Chef
|
|
34
36
|
|
35
37
|
def initialize(name, run_context=nil)
|
36
38
|
super
|
37
|
-
@resource_name = :windows_service
|
38
|
-
@allowed_actions.push(:configure_startup)
|
39
39
|
@startup_type = :automatic
|
40
40
|
@run_as_user = ""
|
41
41
|
@run_as_password = ""
|