Re: [Puppet Users] Re: How to escape exec command parameters?

2012-02-15 Thread Peter Valdemar Mørch
On Wed, Feb 15, 2012 at 6:49 PM, jcbollinger wrote: > $v = $::some_unsafe_value > $v_safe = inline_template("<% require 'shellwords' %><%= > shellwords.escape(v) %>") Cool. It *is* possible. Didn't think to consider using a template... > Overall, however, I suspect that you are probing a rather

[Puppet Users] Re: How to escape exec command parameters?

2012-02-15 Thread Peter Valdemar Mørch
Thanks, John, for your reply also on this matter! On Feb 15, 3:16 pm, jcbollinger wrote: > It seems like this should do the trick: > puppet -e '$v="xyz" exec { f: command => "/bin/echo v is \'$v\'", > logoutput => true }' :-) Yeah, that would take care of these particular instances. Now imagine

[Puppet Users] Undocumented feature: puppet --noop

2012-02-14 Thread Peter Valdemar Mørch
http://docs.puppetlabs.com/man/apply.html does not mention a --noop parameter, but it works: capmon@peter:~> puppet apply --noop -e 'file { "/tmp/foo": ensure => present }' notice: /Stage[main]//File[/tmp/foo]/ensure: is absent, should be present (noop) Can I rely on this in future versions? If s

[Puppet Users] How to escape exec command parameters?

2012-02-14 Thread Peter Valdemar Mørch
If I have a "simple" variable value, this works fine: capmon@peter:~> puppet -e '$v="xyz" exec { f: command => "/bin/echo v is $v", logoutput => true }' notice: /Stage[main]//Exec[f]/returns: v is xyz notice: /Stage[main]//Exec[f]/returns: executed successfully But how do I escape "bad" values of

[Puppet Users] exec: How to logoutput => on_failure and get STDERR too?

2012-02-14 Thread Peter Valdemar Mørch
When a *nix command fails, it most often prints an error to STDERR: capmon@peter:~> /bin/rm /nonexist /bin/rm: cannot remove `/nonexist': No such file or directory exec's logoutput => true doesn't capture STDERR by default: capmon@peter:~> puppet -e 'exec { e: command => "/bin/rm /nonexist", lo

Re: [Puppet Users] Re: Newbie: Confused about where to start managing users...

2012-02-12 Thread Peter Valdemar Mørch
On Thu, Feb 9, 2012 at 6:07 PM, jcbollinger wrote: > It precisely describes the user configuration you want to achieve, and > the 'allowdupe' should enable it to work. Supposing that users 'fred' > and 'barney' are initially present with swapped UIDs, you should > transiently have a situation whe

Re: [Puppet Users] Re: Newbie: Confused about where to start managing users...

2012-02-08 Thread Peter Valdemar Mørch
On Wed, Feb 8, 2012 at 4:23 PM, jcbollinger wrote: > To give you a good answer, I need to understand this a bit better, and > I'm having trouble with that statement.  On Unix-like systems the user > name is the primary identifier, and UIDs are only secondary.  It is > even possible for two or more

Re: [Puppet Users] Newbie: Confused about where to start managing users...

2012-02-08 Thread Peter Valdemar Mørch
On Wed, Feb 8, 2012 at 3:12 PM, Dan White wrote: > First trick with users across multiple machines is to have the same userid > for the same login. I'm not sure I understand. I read this as a suggestion to make it impossible to rename a user. "First trick is to change the requirements" ;-) Did

[Puppet Users] Newbie: Confused about where to start managing users...

2012-02-08 Thread Peter Valdemar Mørch
Hi, Being a newbie, I'm trying to wrap my head around puppet. Here are my first stumbling blocks: We have an output from a database which is essentially a list of users that we want to manage in the uid 2001-2999 range: * No other users may be present in that range (puppet should delete them) *