I tried Michael's suggestion above and when running it from the command
line, it does complete successfully.  It returns 0 when the user exists and
1 when it doesn't.  Does that make sense?  Anyway, inserting the pipe back
into it produces the same error as before.  It's perplexing...

Thanks,

Drew


On Thu, Feb 25, 2010 at 9:21 AM, Andrew Hamilton <andrew...@gmail.com>wrote:

> Thanks for the replies and other possibilities.  I'm using version 0.25.2
> of puppet.  I did a different kind of workaround mostly by doing the same
> thing with a straight psql command with no pipe.  ie.
>
> "/usr/bin/psql -c 'select * from pg_user where usename = 'myuser'"
>
> This at least seems to not error, however it still tried to create the user
> even though it existed on subsequent runs of puppetd --test.  So still not
> quite getting what I expect.  I'm going to try Michael's suggestion and see
> if it has something to do with the formatting of the return value.
>
> Drew
>
>
> On Thu, Feb 25, 2010 at 7:31 AM, jcbollinger <john.bollin...@stjude.org>wrote:
>
>> Have you checked out what that command does when you run it from the
>> command line?  Does it complete successfully?  What is the return
>> code?
>>
>> Possibility 1: Your version of Puppet (you didn't say which) is not
>> correctly preserving the inner single quotation marks around '$name
>> *|'.  This seems unlikely, but I'm having trouble seeing why else the
>> command would actually fail, as opposed to returning *some* result,
>> even if it were the wrong one.  Michael's suggestion of changing the
>> output format might provide a workaround in that case.  Alternatively,
>> if you're not on the latest Puppet then you could try upgrading.
>>
>> Possibility 2: (?) The fact that the command runs without error when
>> you remove the (pipe) rules out pretty much everything else I came up
>> with.
>>
>> Do note, by the way, that the 'unless' command is buggy in any event,
>> because it will return the wrong result when there is an existing
>> database with a name suffix that matches your database's name.
>> Depending on the psql output details, there may be other possibilities
>> for unintended matches.  That in itself would be an excellent reason
>> to look into taking tighter control of the psql output format, or else
>> inserting an additional filter between psql and grep (which could be
>> another grep).  If your database name contains regex metacharacters
>> (e.g. '.'), then that also would present a possibility of unintended
>> matches.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to puppet-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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