On Thu, 2011-06-30 at 00:44 -0700, James Turnbull wrote:
> Hi all
> 
> Yet again the indirector bewilders me. :)
> 
> I'm trying work out where this comes from:
> 
> $ sudo curl -k -H "Accept: yaml" 
> https://pelin.lovedthanlost.net:8140/production/certificate_requests/absenta.lovedthanlost.net

I thought SSL only supported format was "s" (ie full content of the pem
as string). I'm surprised it even works when asking for yaml.

> Which returns:
> 
> ---
>    - !ruby/object:Puppet::SSL::CertificateRequest
>      content: !ruby/object:OpenSSL::X509::Request {}
>      expiration: 2011-06-30 01:01:52.924789 -07:00
>      name: absenta.lovedthanlost.net
> 
> I think it's in lib/puppet/ssl/host.rb but can't for the life of me work 
> out where in here I would customise this output? I'd like to add any 
> attributes defined on the CSR to the output.

All the SSL indirector stuff is actually using the SslFile indirection.
When using find (which is what you're doing above), it returns an
instance of Puppet::SSL::CertificateRequest that has been yamlized.
The openssl object you're looking for is in the content field.

Now if you want to return something specific when asking for yaml, you
need to store them in some instance variables of
Puppet::SSL::CertificateRequest, and then define a to_yaml_properties
method to list the only instance variables you want to export to YAML.
You might also be able to define to_yaml in this class and return the
yaml you really want to export.

HTH,
-- 
Brice Figureau
Follow the latest Puppet Community evolutions on www.planetpuppet.org!

-- 
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