summaryrefslogtreecommitdiff
path: root/lib/chef/resource
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-03-05 10:15:46 -0800
committerGitHub <noreply@github.com>2018-03-05 10:15:46 -0800
commit012f732bd53c4426c6ba92d9091cb3b7a96daaa5 (patch)
tree80c6a5a1e77df944981f4bc854f0d74588f4ba74 /lib/chef/resource
parenta96e2311e2bfb59b750ac11cb290cd17d02fef71 (diff)
parent3cf017dfd506770d06ad3b5341fca1215ad470a9 (diff)
downloadchef-012f732bd53c4426c6ba92d9091cb3b7a96daaa5.tar.gz
Merge branch 'master' into misc_resource
Diffstat (limited to 'lib/chef/resource')
-rw-r--r--lib/chef/resource/apt_package.rb2
-rw-r--r--lib/chef/resource/git.rb15
-rw-r--r--lib/chef/resource/osx_profile.rb4
-rw-r--r--lib/chef/resource/portage_package.rb10
-rw-r--r--lib/chef/resource/registry_key.rb28
-rw-r--r--lib/chef/resource/windows_service.rb4
6 files changed, 16 insertions, 47 deletions
diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb
index ea0c9c6183..22680d5b44 100644
--- a/lib/chef/resource/apt_package.rb
+++ b/lib/chef/resource/apt_package.rb
@@ -23,7 +23,7 @@ class Chef
class Resource
class AptPackage < Chef::Resource::Package
resource_name :apt_package
- provides :package, os: "linux", platform_family: "debian"
+ provides :package, platform_family: "debian"
description "Use the apt_package resource to manage packages on Debian and Ubuntu platforms."
diff --git a/lib/chef/resource/git.rb b/lib/chef/resource/git.rb
index 9f1702f715..58200815d4 100644
--- a/lib/chef/resource/git.rb
+++ b/lib/chef/resource/git.rb
@@ -21,27 +21,14 @@ require "chef/resource/scm"
class Chef
class Resource
class Git < Chef::Resource::Scm
-
description "Use the git resource to manage source control resources that exist"\
" in a git repository. git version 1.6.5 (or higher) is required to"\
" use all of the functionality in the git resource."
- def initialize(name, run_context = nil)
- super
- @additional_remotes = Hash[]
- end
-
- def additional_remotes(arg = nil)
- set_or_return(
- :additional_remotes,
- arg,
- :kind_of => Hash
- )
- end
+ property :additional_remotes, Hash, default: {}
alias :branch :revision
alias :reference :revision
-
alias :repo :repository
end
end
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index a2f880d38d..cf857cec6f 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -24,8 +24,6 @@ class Chef
provides :osx_profile, os: "darwin"
provides :osx_config_profile, os: "darwin"
- identity_attr :profile_name
-
description "Use the osx_profile resource to manage configuration profiles (.mobileconfig files)"\
" on the macOS platform. The osx_profile resource installs profiles by using"\
" the uuidgen library to generate a unique ProfileUUID, and then using the"\
@@ -35,7 +33,7 @@ class Chef
default_action :install
allowed_actions :install, :remove
- property :profile_name, String, name_property: true
+ property :profile_name, String, name_property: true, identity: true
property :profile, [ String, Hash ]
property :identifier, String
property :path, String
diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb
index a12039b555..6936f5129f 100644
--- a/lib/chef/resource/portage_package.rb
+++ b/lib/chef/resource/portage_package.rb
@@ -1,6 +1,6 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,13 +22,9 @@ class Chef
class Resource
class PortagePackage < Chef::Resource::Package
resource_name :portage_package
- description "Use the portage_package resource to manage packages for the Gentoo platform."
-
- def initialize(name, run_context = nil)
- super
- @provider = Chef::Provider::Package::Portage
- end
+ provides :portage_package
+ description "Use the portage_package resource to manage packages for the Gentoo platform."
end
end
end
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
index 565ff278ea..8ca111bf33 100644
--- a/lib/chef/resource/registry_key.rb
+++ b/lib/chef/resource/registry_key.rb
@@ -15,14 +15,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require "chef/provider/registry_key"
+
require "chef/resource"
require "chef/digester"
class Chef
class Resource
- # Use the registry_key resource to create and delete registry keys in Microsoft Windows.
class RegistryKey < Chef::Resource
+ resource_name :registry_key
+ provides :registry_key
+
+ description "Use the registry_key resource to create and delete registry keys in Microsoft Windows."
+ introduced "11.0"
+
identity_attr :key
state_attrs :values
@@ -62,8 +67,6 @@ class Chef
def initialize(name, run_context = nil)
super
- @architecture = :machine
- @recursive = false
@key = name
@values, @unscrubbed_values = [], []
end
@@ -102,21 +105,8 @@ class Chef
end
end
- def recursive(arg = nil)
- set_or_return(
- :recursive,
- arg,
- :kind_of => [TrueClass, FalseClass]
- )
- end
-
- def architecture(arg = nil)
- set_or_return(
- :architecture,
- arg,
- :kind_of => Symbol
- )
- end
+ property :recursive, [TrueClass, FalseClass], default: false
+ property :architecture, Symbol, default: :machine, equal_to: [:machine, :x86_64, :i386]
private
diff --git a/lib/chef/resource/windows_service.rb b/lib/chef/resource/windows_service.rb
index 8a76a716aa..aaa21aa6a7 100644
--- a/lib/chef/resource/windows_service.rb
+++ b/lib/chef/resource/windows_service.rb
@@ -41,11 +41,9 @@ class Chef
allowed_actions :configure_startup, :create, :delete, :configure
- identity_attr :service_name
-
state_attrs :enabled, :running
- property :service_name, name_property: true
+ property :service_name, name_property: true, identity: true
# The display name to be used by user interface programs to identify the
# service. This string has a maximum length of 256 characters.