On May 5, 2012, at 7:48 AM, Philip Brown wrote:

> 
> 
> On Saturday, May 5, 2012 6:42:31 AM UTC-7, Philip Brown wrote:
> 
> 
> *Almost* done with this beastie!  Now I just have to force it to return 
> "true" when things already look good!
> ruby is wierd. sigh.   I have
> @resource[:value]    claiming its value is "true"
> and the output of a command, in variable 'output', claming its value is 
> "true".
> BUT...
> 
>     if output == @resource[:value]
>       Puppet.debug "svcprop value is desired value. sysprop return true"
>       return true
>     end
> 
> is NOT returning true. "exists?" falling through and returning false. sighh...
> 
> bah. had to call .strip  on the output. Works!
> 
> Now the only major ugliness left, is that on successful trigger, the 
> --verbose output is:
> notice: /Stage[main]//Sysprop[network/smtp:sendmail]/ensure: created
> 
> I'd rather it said something different from "ensure: created" . A custom 
> message would be nice.
> But I suppose I dont have any control over that.

It's great to hear you got it all working.  I agree that it can be difficult 
figuring out when things are truly equal - I recommend using something like:

Puppet.debug "property value is #{output.inspect}, should be 
#{@resource[:value].inspect}"

The 'inspect' calls will make sure you know exactly what you have - whether 
it's a string, symbol, boolean, etc.  You can still be confused with quoting 
sometimes, but it's usually much clearer this way.

You can set a custom message with the change_to_s method; see exec.rb for an 
example.

-- 
Luke Kanies | http://about.me/lak | http://puppetlabs.com/ | +1-615-594-8199

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to