Re: generate with spaces?

Gary Richardson
Wed, 23 Jan 2008 20:52:31 -0000

Brilliant. That did the trick.
Thanks!

On Jan 23, 2008 11:47 AM, Chris MacLeod <stickm@gmail.com> wrote:

> Generate doesn''t shell out in a traditional sense.  I''m
not quite yet a
> ruby guy so I''m not very good at explaining what it really does,
but I do
> something like this to work around it.
> generate("/bin/sh", "-c", "grep ^${name}
/etc/passwd | cut -d: -f6")
>
> C
>
> On 1/23/08, Gary Richardson <gary.richardson@gmail.com> wrote:
>
> > Hi,
> >
> > I''ve been using puppet for about a week and a half now, and
it''s
> > definitely making my life a lot easier. I''m using 0.24.1 and
I''ve run
> > into a small snag.
> >
> > I''m trying to write some code to make sure user home
directories exist
> > for users in LDAP. I''m trying to get their uid, gid and home
directory from
> > getent with something like:
> >
> > $uid      = generate("/usr/bin/getentfield passwd $title 3")
> >
> >
> >
> > getentfield is a bash script that basically does a getent $1 $2 | cut
-d
> > : -f $3.
> >
> >
> > When I try running the generate, I get:
> >
> >
> > Generators can only contain alphanumerics, file separators, and dashes
> >
> >
> >
> > I figured it might be a variable interpolation thing, so I tried
taking
> > $title out. I got the same error on the same line number.
> >
> >
> > Then I tried a plain generate("/usr/bin/getentfield") and it
executed.
> >
> >
> > Are spaces really not allowed in generate calls? Doesn''t that
sort of
> > make generate useless? I''m guessing/hoping it''s a
typo in a regex
> > somewhere..
> >
> >
> > If there''s a better way to get external information,
I''d gladly use that
> > instead..
> >
> >
> > Thanks!
> >
> > _______________________________________________
> > Puppet-users mailing list
> > Puppet-users@madstop.com
> > https://mail.madstop.com/mailman/listinfo/puppet-users
> >
> >
>
>
> --
> stickm@gmail.com
> -==< Stick >==-