Neil and John,

You guys both agree on using individual files and I was thinking of how I 
could do this.  If I have one file or three, it may not be a big deal to do 
individually, but some applications could need dozens or more.  

I don't know if it is possible, some searching makes me believe it isn't, 
but I'll share my thought.

Can you do something like a for loop in a bash script.  So it would be 
something like...


for files in .../module_name/Preferences/  # get a list of files and 
folders in the Preferences subfolder on the Puppet Master
  file { '/System/Library/User 
Template/English.lproj/Library/Preferences/${files}':  #Directory on Puppet 
agent, the variable would make this a unique resource and it would work for 
a file and folder
  source => "puppet:///modules/${module_name}/Preferences/${files}", # 
Since it is looping every file on the Puppet Master would match perfectly 
to the same exact file/folder on the agent.  No duplicate declaration.
done

John,

I think I understand what your code is trying to do, but am not sure I 
understand how to implement.  I think that $preference_sources is making a 
list of paths (puppet paths) to the Preferences folder of each module, and 
I know that sourceselect all means that it will use all sources instead of 
stopping at the first match.  I also see that the preferences_sources is 
being created from a regex expression that I don't completely understand, 
though that shouldn't matter in getting this to work.  

Is this still a defined type?  Should class mac_managed_preferences be 
defined or are we making a new class for each applications preferences 
(assuming that's the $applications variable in the class name)?  I tried it 
as a defined type, and I once again got it to work with one application but 
not two.  Which makes sense as two applications are calling it.  If it is a 
unique class and not a defined type, then wouldn't this class apply 
preferences for applications on machines that don't have them?   

If it still is a defined type, then this is the code that caused a 
duplicate declaration below.  Perhaps a syntax issue?   This is the only 
syntax where I could get things to run.  If this code is for a unique 
class, then I think I need a bit more description in how it is to work.  

class managed_preferences {}
  define mac_managed_preferences ($application) {
  include managed_preferences

  $preference_sources = regsubst($application, '^.*$', 
'puppet:///modules/\0/Preferences')

  file { '/System/Library/User Template/English.lproj/Library/Preferences':
   ensure => 'directory',

    owner => 'root',
    group => 'wheel',
    mode => '0600',
    recurse => true,
    source => $preference_sources,
    sourceselect => 'all'
  }
}






-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/dcec0f04-da8c-4ca1-a824-c58944da9683%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to