diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2020-05-06 17:22:10 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2020-05-06 17:22:10 -0700 |
commit | cf06a973e3494428c36725d649a06a4664421976 (patch) | |
tree | 06656f285a4dd36da92dfeb6c95764d24dc54caf /lib/chef/provider | |
parent | 6461450d34b7d4837c6bbfc75113ce1797567e09 (diff) | |
download | chef-cf06a973e3494428c36725d649a06a4664421976.tar.gz |
fix launchd provider for chef-16
the refactoring to use the DSL (orthogonal to setting this up as
a unified_mode resource) meant we have to care about lexical scoping
now.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/launchd.rb | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/chef/provider/launchd.rb b/lib/chef/provider/launchd.rb index fbb9307712..0eabd821e2 100644 --- a/lib/chef/provider/launchd.rb +++ b/lib/chef/provider/launchd.rb @@ -36,7 +36,6 @@ class Chef label mode owner - path source session_type type @@ -44,7 +43,6 @@ class Chef def load_current_resource current_resource = Chef::Resource::Launchd.new(new_resource.name) - @path = path ? path : gen_path_from_type end def gen_path_from_type @@ -89,26 +87,20 @@ class Chef end def manage_plist(action) + path = @path if source - cookbook_file @path do - cookbook_name = cookbook if cookbook - name(@path) if @path - backup(backup) if backup - group(group) if group - mode(mode) if mode - owner(owner) if owner - source(source) if source + cookbook_file path do + cookbook_name = new_resource.cookbook if new_resource.cookbook + name(path) if path + copy_properties_from(new_resource, :backup, :group, :mode, :owner, :source) action(action) only_if { manage_agent?(action) } end else - file @path do - name(@path) if @path - backup(backup) if backup + file path do + name(path) if path + copy_properties_from(new_resource, :backup, :group, :mode, :owner) content(content) if content? - group(group) if group - mode(mode) if mode - owner(owner) if owner action(action) only_if { manage_agent?(action) } end @@ -116,11 +108,12 @@ class Chef end def manage_service(action) + path = @path macosx_service label do - name(label) if label - service_name(label) if label - plist(@path) if @path - session_type(session_type) if session_type + name(new_resource.label) if new_resource.label + service_name(new_resource.label) if new_resource.label + plist(path) if path + copy_properties_from(new_resource, :session_type) action(action) only_if { manage_agent?(action) } end @@ -215,6 +208,11 @@ class Chef memo[val] = new_resource.send(key) if new_resource.send(key) end end + + # @api private + def path + @path = new_resource.path ? new_resource.path : gen_path_from_type + end end end end |