On Thursday, August 22, 2013 8:43:10 PM UTC-5, Matt Wise wrote:
>
> Hey everyone, I could use some help with a custom plugin we've written. We 
> have a plugin for Puppet that makes SOAP calls out to a remote API service (
> http://secretserveronline.com), returning passwords, SSL keys, etc for 
> us. The original code was written using pure HTTP GET calls, but I re-wrote 
> the plugin to use the SOAP API because the remote service is slowly 
> removing their GET-based API calls.
>
> Because the Ruby SOAP library is so slow at interpreting WSDL files, I 
> wrote the Puppet Function so that it checks if an existing 'Thycotic' 
> object has been instantiated before creating a new one. If an existing one 
> is there, it just uses it. This prevents creating new 'Thycotic' objects 
> for every single call to the function, and speeds the puppet compilation up 
> quite a bit when you call the plugin many times. (We have some manifests 
> that use this plugin 30+ times for different keys, passwords, etc).
>
> The problem I'm running into is this:
>
> Fri Aug 23 01:28:09 +0000 2013 Puppet (err): Could not retrieve catalog 
> from remote server: *Error 400 on SERVER: undefined method `has_key?' for 
> nil:NilClass* at 
> /mnt/puppet/staging/puppet-base/modules/specific/auth/manifests/eng_users.pp:27
>  
> on node ...
>
>

That error message seems to be saying that you are trying to invoke a 
method named 'has_key?' on a nil object.  In the code you referenced, you 
are invoking a method by that name on the object referenced by variable 
'secret' -- not on the one referenced by 'thycotic'.  You get 'secret' from 
'thycotic' via

 

>     # Now request our secret
>>     secret = $thycotic.getSecret(secret_id)
>
>
>

It seems reasonable to guess that in some cases the provided 'secret_id' 
does not correspond to any available secret, and in such cases 
'getSecret()' returns nil.  You must catch that case and do something 
appropriate with it if you want to avoid the error you are getting.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to