On 2/20/2009 4:52 PM, Brad Dixon wrote:
> Hello:
> 
> I'd like to ensure that I've set-up various gconf settings for users.
> I cobbled together this little sad definition:
> 
>   define gconf($type, $value, $user) {
>     exec{"set $name to $value":
>       command => "/bin/su $user -c '/usr/bin/gconftool-2
> --config-source xml:readwrite:/home/$user/.gconf --type=$type --set
> $name \"$value\"'",
>     }
>   }
> 
> used like this:
> 
>     gconf{"/apps/gnome-terminal/profiles/Default/font":
>       type => "string",
>       value => "Monospace 16",
>       user => "rbdixon",
>     }
> 
> It all seems a little verbose. Any suggestions on how to improve this?

I can see setting a default type of "string", perhaps:

   define gconf($type="string", $value, $user) {
   ...

but other than that, I don't know how much less verbose you could make 
it and still have it be reasonably complete. However, you could (and 
probably should) put all the common gconf defines into classes that you 
can apply as a group:

   class site_gnome_terminal_settings {
     gconf("/apps/gnome-terminal/profiles/Default/font":
       value => "Monospace 16",
       user  => "rbdixon",
     }
     ....
   }

Not that it helps with verbosity, but you'll want to include an 'unless' 
parameter in the exec to make it idempotent. Otherwise, it'll run every 
time puppet does. If gconftool also lets you query values, then you can 
probably grep the user, name, and value strings from its output and do 
it pretty cleanly.

-- 
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to