summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-02-22 21:16:15 -0800
committerTim Smith <tsmith@chef.io>2018-02-22 21:16:15 -0800
commit22a4da4476af3b85c7be361312551900077dc5bd (patch)
tree6af39d55403a8e73e5240f1eccb056dca5c17d08
parentb3a3fbaab35da9e7927a0cb1ae5e379f28ecc000 (diff)
downloadchef-macos_service.tar.gz
Modernize macosx_servicemacos_service
Use properties throughout instead of set_or_return Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/macosx_service.rb24
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb
index 08c748bead..a12add2109 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"
@@ -29,29 +29,11 @@ class Chef
state_attrs :enabled, :running
- def initialize(name, run_context = nil)
- super
- @plist = nil
- @session_type = nil
- end
-
# This will enable user to pass a plist in the case
# that the filename and label for the service dont match
- def plist(arg = nil)
- set_or_return(
- :plist,
- arg,
- :kind_of => String
- )
- end
+ property :plist, String
- def session_type(arg = nil)
- set_or_return(
- :session_type,
- arg,
- :kind_of => String
- )
- end
+ property :session_type, String
end
end