# File lib/puppet/provider/nameservice/directoryservice.rb, line 258 258: def self.get_exec_preamble(ds_action, resource_name = nil) 259: # JJM 2007-07-24 260: # DSCL commands are often repetitive and contain the same positional 261: # arguments over and over. See http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/additionalfeatures/chapter_10_section_9.html 262: # for an example of what I mean. 263: # This method spits out proper DSCL commands for us. 264: # We EXPECT name to be @resource[:name] when called from an instance object. 265: 266: # 10.4 doesn't support the -plist option for dscl, and 10.5 has a 267: # different format for the -url output with objects with spaces in 268: # their values. *sigh*. Use -url for 10.4 in the hope this can be 269: # deprecated one day, and use -plist for 10.5 and higher. 270: case self.get_macosx_version_major 271: when "10.4" 272: command_vector = [ command(:dscl), "-url", "." ] 273: when "10.5", "10.6" 274: command_vector = [ command(:dscl), "-plist", "." ] 275: end 276: # JJM: The actual action to perform. See "man dscl" 277: # Common actiosn: -create, -delete, -merge, -append, -passwd 278: command_vector << ds_action 279: # JJM: get_ds_path will spit back "Users" or "Groups", 280: # etc... Depending on the Puppet::Type of our self. 281: if resource_name 282: command_vector << "/%s/%s" % [ get_ds_path, resource_name ] 283: else 284: command_vector << "/%s" % [ get_ds_path ] 285: end 286: # JJM: This returns most of the preamble of the command. 287: # e.g. 'dscl / -create /Users/mccune' 288: return command_vector 289: end