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