I was playing around with the generate() function and was wondering if anyone was making us of it. The current way I''m attempting to use it is to determine what the homedir of a given user is. I have: --- $homedir = generate("/bin/sh", "-c", "grep ^${name} /etc/passwd | cut -d: -f6") --- which returns what I expect it to return except that it preserves the newline at the end so it makes using $homedir useless. Other than throwing another sed at the end of that line anyone have any suggestions? Is this the normal behavior for generate? I haven''t been able to find many other recipes where people are using it. C -- stickm@gmail.com -==< Stick >==- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Dec 4, 2007, at 12:29 PM, Chris MacLeod wrote:> I was playing around with the generate() function and was wondering > if anyone was making us of it.I use generate() to produce shared secret passpharses. It''s particularly useful for me with our backup software, where the same passphrase needs to be configured on multiple hosts. generate just calls a small shell script that talks to an sqlite database and spits back the passphrase. Cheers, -- Jeff McCune Systems Manager The Ohio State University Department of Mathematics _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
any issues with newlines or are you eliminating them via your script? On 12/4/07, Jeff McCune <mccune@math.ohio-state.edu> wrote:> > On Dec 4, 2007, at 12:29 PM, Chris MacLeod wrote: > > I was playing around with the generate() function and was wondering if > anyone was making us of it. > > > > I use generate() to produce shared secret passpharses. > It''s particularly useful for me with our backup software, where the same > passphrase needs to be configured on multiple hosts. > > > generate just calls a small shell script that talks to an sqlite database > and spits back the passphrase. > > Cheers, > -- > Jeff McCune > Systems Manager > The Ohio State University > Department of Mathematics > > > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users > >-- stickm@gmail.com -==< Stick >==- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 04 December 2007, Chris MacLeod wrote:> I was playing around with the generate() function and was wondering if > anyone was making us of it. > The current way I''m attempting to use it is to determine what the homedir > of a given user is. > I have: > > --- > $homedir = generate("/bin/sh", "-c", "grep ^${name} /etc/passwd | cut -d: > -f6") > --- > which returns what I expect it to return except that it preserves the > newline at the end so it makes using $homedir useless. > > Other than throwing another sed at the end of that line anyone have any > suggestions? Is this the normal behavior for generate? > I haven''t been able to find many other recipes where people are using it.Since this runs on the server I''m not sure it will really do what you want. To solve your problem at hand, I''d just implement chomp() though. Regards, David - -- The primary freedom of open source is not the freedom from cost, but the free- dom to shape software to do what you want. This freedom is /never/ exercised without cost, but is available /at all/ only by accepting the very different costs associated with open source, costs not in money, but in time and effort. - -- http://www.schierer.org/~luke/log/20070710-1129/on-forks-and-forking -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHVbUn/Pp1N6Uzh0URAgO8AJ9E2DSh4wcvhJsBJTb6igleRx2YkQCfe7gj JDVnBg8h0moI7dUGp7XhYcM=2ZRO -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David Schmitt wrote:> On Tuesday 04 December 2007, Chris MacLeod wrote: >> I was playing around with the generate() function and was wondering if >> anyone was making us of it. >> The current way I''m attempting to use it is to determine what the homedir >> of a given user is. >> I have: > >> --- >> $homedir = generate("/bin/sh", "-c", "grep ^${name} /etc/passwd | cut -d: >> -f6") >> --- >> which returns what I expect it to return except that it preserves the >> newline at the end so it makes using $homedir useless. > >> Other than throwing another sed at the end of that line anyone have any >> suggestions? Is this the normal behavior for generate? >> I haven''t been able to find many other recipes where people are using it. > > Since this runs on the server I''m not sure it will really do what you want. > > To solve your problem at hand, I''d just implement chomp() though. >I agree with David - I''d look at a fact or series of facts perhaps? You could crudely do lots of $home_${name} facts fairly easily by parsing the /etc/passwd file or I am sure you could knock up something more elegant quite quickly. Regards James Turnbull - -- James Turnbull <james@lovedthanlost.net> - --- Author of Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) Hardening Linux (http://www.amazon.com/gp/product/1590594444/) - --- PGP Key (http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x0C42DF40) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHVbit9hTGvAxC30ARAh4rAJ9kHy5aR1DkrwWqY0v/Yz6EoKB7jwCfUjEo x31bLUyFj4IPzoQf+PPqTXU=M8K8 -----END PGP SIGNATURE-----
well I don''t want to set facts for all 300+ users that I might need to determine their homedirectory and I don''t believe that I can get a fact based on an argument. to address David''s point it doesn''t really matter that generate is run on the server b/c all my users are in nis so asking that question on the server is valid. C On 12/4/07, James Turnbull <james@lovedthanlost.net> wrote:> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > David Schmitt wrote: > > On Tuesday 04 December 2007, Chris MacLeod wrote: > >> I was playing around with the generate() function and was wondering if > >> anyone was making us of it. > >> The current way I''m attempting to use it is to determine what the > homedir > >> of a given user is. > >> I have: > > > >> --- > >> $homedir = generate("/bin/sh", "-c", "grep ^${name} /etc/passwd | cut > -d: > >> -f6") > >> --- > >> which returns what I expect it to return except that it preserves the > >> newline at the end so it makes using $homedir useless. > > > >> Other than throwing another sed at the end of that line anyone have any > >> suggestions? Is this the normal behavior for generate? > >> I haven''t been able to find many other recipes where people are using > it. > > > > Since this runs on the server I''m not sure it will really do what you > want. > > > > To solve your problem at hand, I''d just implement chomp() though. > > > > I agree with David - I''d look at a fact or series of facts perhaps? You > could crudely do lots of $home_${name} facts fairly easily by parsing > the /etc/passwd file or I am sure you could knock up something more > elegant quite quickly. > > Regards > > James Turnbull > > - -- > James Turnbull <james@lovedthanlost.net> > - --- > Author of Pro Nagios 2.0 > (http://www.amazon.com/gp/product/1590596099/) > > Hardening Linux > (http://www.amazon.com/gp/product/1590594444/) > - --- > PGP Key (http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x0C42DF40) > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (Darwin) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFHVbit9hTGvAxC30ARAh4rAJ9kHy5aR1DkrwWqY0v/Yz6EoKB7jwCfUjEo > x31bLUyFj4IPzoQf+PPqTXU> =M8K8 > -----END PGP SIGNATURE----- > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >-- stickm@gmail.com -==< Stick >==- _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
I use generate to check whether the "primary user" (a fact we wrote) is in a certain LDAP group or not, and that''s how we''re essentially doing the equivalent of the upcoming environments feature. _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Chris MacLeod wrote:> well I don''t want to set facts for all 300+ users that I might need to > determine their homedirectory and I don''t believe that I can get a fact > based on an argument.I said it was crude. :) And yes - you can''t set them based on an argument. But thinking about it what''s the overhead of setting 300 facts? That''s a partly rhetorical question as I don''t know the answer myself - *adds another thing to the list of things he wants to performance test*. I know that seems a somewhat crude and hack''ish solution but it would work. Regards James Turnbull _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users