diff options
author | Tim Smith <tsmith@chef.io> | 2017-12-15 13:18:38 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2017-12-15 13:18:38 -0800 |
commit | 08fa1e149d597a5cc2d2061304be83ce8bd9488f (patch) | |
tree | e95ec39c069d2afcf8637dc5748d307e7d8425c1 | |
parent | c976a3b545216121ce59cad940f5baff1207dca6 (diff) | |
download | chef-08fa1e149d597a5cc2d2061304be83ce8bd9488f.tar.gz |
Add resource names to resources
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/batch.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/bff_package.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/cookbook_file.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/dsc_resource.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/execute.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/file.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/group.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/http_request.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/ifconfig.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/launchd.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/link.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/macosx_service.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/mdadm.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/mount.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/portage_package.rb | 5 | ||||
-rw-r--r-- | lib/chef/resource/powershell_package.rb | 7 | ||||
-rw-r--r-- | lib/chef/resource/ruby_block.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/windows_path.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/windows_task.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/zypper_repository.rb | 2 |
20 files changed, 23 insertions, 17 deletions
diff --git a/lib/chef/resource/batch.rb b/lib/chef/resource/batch.rb index 10e96839fb..260080fb0c 100644 --- a/lib/chef/resource/batch.rb +++ b/lib/chef/resource/batch.rb @@ -21,7 +21,7 @@ require "chef/resource/windows_script" class Chef class Resource class Batch < Chef::Resource::WindowsScript - + resource_name :batch provides :batch, os: "windows" def initialize(name, run_context = nil) diff --git a/lib/chef/resource/bff_package.rb b/lib/chef/resource/bff_package.rb index b14591876a..2a6d1ac267 100644 --- a/lib/chef/resource/bff_package.rb +++ b/lib/chef/resource/bff_package.rb @@ -22,6 +22,7 @@ require "chef/provider/package/aix" class Chef class Resource class BffPackage < Chef::Resource::Package + resource_name :bff_package end end end diff --git a/lib/chef/resource/cookbook_file.rb b/lib/chef/resource/cookbook_file.rb index 785cf693be..81bd5472f6 100644 --- a/lib/chef/resource/cookbook_file.rb +++ b/lib/chef/resource/cookbook_file.rb @@ -27,6 +27,8 @@ class Chef class CookbookFile < Chef::Resource::File include Chef::Mixin::Securable + resource_name :cookbook_file + default_action :create def initialize(name, run_context = nil) diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb index d3b579e428..ef8912f2ed 100644 --- a/lib/chef/resource/dsc_resource.rb +++ b/lib/chef/resource/dsc_resource.rb @@ -20,6 +20,7 @@ require "chef/dsl/powershell" class Chef class Resource class DscResource < Chef::Resource + resource_name :dsc_resource provides :dsc_resource, os: "windows" # This class will check if the object responds to diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb index ba1b8ae6e3..4d07db16cc 100644 --- a/lib/chef/resource/execute.rb +++ b/lib/chef/resource/execute.rb @@ -23,6 +23,7 @@ require "chef/provider/execute" class Chef class Resource class Execute < Chef::Resource + resource_name :execute identity_attr :command diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 0540385646..e72a861b54 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -28,6 +28,8 @@ class Chef class File < Chef::Resource include Chef::Mixin::Securable + resource_name :file + if Platform.windows? # Use Windows rights instead of standard *nix permissions state_attrs :checksum, :rights, :deny_rights diff --git a/lib/chef/resource/group.rb b/lib/chef/resource/group.rb index d3a4a1ce89..0008b9e30d 100644 --- a/lib/chef/resource/group.rb +++ b/lib/chef/resource/group.rb @@ -20,6 +20,7 @@ class Chef class Resource class Group < Chef::Resource + resource_name :group identity_attr :group_name diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb index 9fac3562f3..acdad8ebf1 100644 --- a/lib/chef/resource/http_request.rb +++ b/lib/chef/resource/http_request.rb @@ -23,6 +23,7 @@ require "chef/provider/http_request" class Chef class Resource class HttpRequest < Chef::Resource + resource_name :http_request identity_attr :url diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb index 3673311348..8e6b161770 100644 --- a/lib/chef/resource/ifconfig.rb +++ b/lib/chef/resource/ifconfig.rb @@ -22,9 +22,9 @@ require "chef/resource" class Chef class Resource class Ifconfig < Chef::Resource + resource_name :ifconfig identity_attr :device - state_attrs :inet_addr, :mask default_action :add diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb index 3fba76e220..2bf43adcf8 100644 --- a/lib/chef/resource/launchd.rb +++ b/lib/chef/resource/launchd.rb @@ -22,6 +22,7 @@ require "chef/provider/launchd" class Chef class Resource class Launchd < Chef::Resource + resource_name :launchd provides :launchd, os: "darwin" identity_attr :label diff --git a/lib/chef/resource/link.rb b/lib/chef/resource/link.rb index 5717ec7bad..644b17eded 100644 --- a/lib/chef/resource/link.rb +++ b/lib/chef/resource/link.rb @@ -25,6 +25,8 @@ class Chef class Link < Chef::Resource include Chef::Mixin::Securable + resource_name :link + identity_attr :target_file state_attrs :to, :owner, :group diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb index 08c748bead..9d35a7e315 100644 --- a/lib/chef/resource/macosx_service.rb +++ b/lib/chef/resource/macosx_service.rb @@ -21,7 +21,7 @@ require "chef/resource/service" class Chef class Resource class MacosxService < Chef::Resource::Service - + resource_name :macosx_service provides :macosx_service, os: "darwin" provides :service, os: "darwin" diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb index df6e705f15..7f89895d94 100644 --- a/lib/chef/resource/mdadm.rb +++ b/lib/chef/resource/mdadm.rb @@ -23,6 +23,8 @@ class Chef class Resource class Mdadm < Chef::Resource + resource_name :mdadm + identity_attr :raid_device state_attrs :devices, :level, :chunk diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index 9df2bbcdbc..3c0e7a37a9 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -22,6 +22,7 @@ require "chef/resource" class Chef class Resource class Mount < Chef::Resource + resource_name :mount identity_attr :device diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb index ad66c7b42b..cc63a0beec 100644 --- a/lib/chef/resource/portage_package.rb +++ b/lib/chef/resource/portage_package.rb @@ -22,11 +22,6 @@ class Chef class Resource class PortagePackage < Chef::Resource::Package resource_name :portage_package - def initialize(name, run_context = nil) - super - @provider = Chef::Provider::Package::Portage - end - end end end diff --git a/lib/chef/resource/powershell_package.rb b/lib/chef/resource/powershell_package.rb index 4d658d3cc5..b2a370f80c 100644 --- a/lib/chef/resource/powershell_package.rb +++ b/lib/chef/resource/powershell_package.rb @@ -23,17 +23,12 @@ class Chef class PowershellPackage < Chef::Resource::Package include Chef::Mixin::Uris + resource_name :powershell_package provides :powershell_package, os: "windows" allowed_actions :install, :remove - def initialize(name, run_context = nil) - super - @resource_name = :powershell_package - end - property :package_name, [String, Array], coerce: proc { |x| [x].flatten } - property :version, [String, Array], coerce: proc { |x| [x].flatten } end diff --git a/lib/chef/resource/ruby_block.rb b/lib/chef/resource/ruby_block.rb index 87a4cfb7c5..1acdd1860e 100644 --- a/lib/chef/resource/ruby_block.rb +++ b/lib/chef/resource/ruby_block.rb @@ -23,6 +23,8 @@ require "chef/provider/ruby_block" class Chef class Resource class RubyBlock < Chef::Resource + resource_name :ruby_block + default_action :run allowed_actions :create, :run diff --git a/lib/chef/resource/windows_path.rb b/lib/chef/resource/windows_path.rb index 5472a7e4fd..a4bfa9a603 100644 --- a/lib/chef/resource/windows_path.rb +++ b/lib/chef/resource/windows_path.rb @@ -21,7 +21,7 @@ require "chef/resource" class Chef class Resource class WindowsPath < Chef::Resource - + resource_name :windows_path provides :windows_path, os: "windows" allowed_actions :add, :remove diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb index 344ce50b64..dac677749f 100644 --- a/lib/chef/resource/windows_task.rb +++ b/lib/chef/resource/windows_task.rb @@ -21,7 +21,6 @@ require "chef/resource" class Chef class Resource class WindowsTask < Chef::Resource - resource_name :windows_task provides :windows_task, os: "windows" diff --git a/lib/chef/resource/zypper_repository.rb b/lib/chef/resource/zypper_repository.rb index 88b6fd9336..6046c640b5 100644 --- a/lib/chef/resource/zypper_repository.rb +++ b/lib/chef/resource/zypper_repository.rb @@ -22,7 +22,7 @@ class Chef class Resource class ZypperRepository < Chef::Resource resource_name :zypper_repository - provides :zypper_repo + provides :zypper_repo # backwards compatibility with the existing cookbook resource property :repo_name, String, name_property: true property :description, String |