class Chef::Resource::Link
Public Class Methods
new(name, run_context=nil)
click to toggle source
Calls superclass method
Chef::Resource.new
# File lib/chef/resource/link.rb, line 34 def initialize(name, run_context=nil) verify_links_supported! super @resource_name = :link @to = nil @action = :create @link_type = :symbolic @target_file = name @allowed_actions.push(:create, :delete) @provider = Chef::Provider::Link end
Public Instance Methods
group(arg=nil)
click to toggle source
# File lib/chef/resource/link.rb, line 71 def group(arg=nil) set_or_return( :group, arg, :regex => Chef::Config[:group_valid_regex] ) end
link_type(arg=nil)
click to toggle source
# File lib/chef/resource/link.rb, line 62 def link_type(arg=nil) real_arg = arg.kind_of?(String) ? arg.to_sym : arg set_or_return( :link_type, real_arg, :equal_to => [ :symbolic, :hard ] ) end
owner(arg=nil)
click to toggle source
# File lib/chef/resource/link.rb, line 79 def owner(arg=nil) set_or_return( :owner, arg, :regex => Chef::Config[:user_valid_regex] ) end
path()
click to toggle source
make link quack like a file (XXX: not for public consumption)
# File lib/chef/resource/link.rb, line 88 def path @target_file end
target_file(arg=nil)
click to toggle source
# File lib/chef/resource/link.rb, line 54 def target_file(arg=nil) set_or_return( :target_file, arg, :kind_of => String ) end
to(arg=nil)
click to toggle source
# File lib/chef/resource/link.rb, line 46 def to(arg=nil) set_or_return( :to, arg, :kind_of => String ) end
Private Instance Methods
verify_links_supported!()
click to toggle source
# File lib/chef/resource/link.rb, line 93 def verify_links_supported! # On certain versions of windows links are not supported. Make # sure we are not on such a platform. if Chef::Platform.windows? require 'chef/win32/file' begin Chef::ReservedNames::Win32::File.verify_links_supported! rescue Chef::Exceptions::Win32APIFunctionNotImplemented => e Chef::Log.fatal("Link resource is not supported on this version of Windows") raise e end end end