On Wed, Mar 5, 2014 at 11:56 AM, Shook Shivers <[email protected]>wrote:

> I get Error: Could not prefetch zenoss_device provider 'zenoss_device':
> undefined local variable or method `resource' for
> Puppet::Type::Zenoss_device::ProviderZenoss_device:Class when using the
> following
>
> def self.prefetch(r)
>         @transport ||=
> PuppetX::Puppetlabs::Transport.retrieve(:resource_ref =>
> resource[:transport], :catalog => resource.catalog, :provider => 'vsphere')
>
>     p "#{r}"
>   end
>

You should wrap the transport in a method. The reason Transport.retrieve
exists is to allow all providers to reuse the same connection to the same
servers (matters more for ssh than something stateless like REST). The
provider indicate what type of transport, and in this case this starts a
vsphere connection specified here:

https://github.com/vmware/vmware-vcenter/blob/master/lib/puppet_x/puppetlabs/transport/vsphere.rb

This is unlikely what you want based on the description below.

The above is only for testing purposes
>
> Im writing a type provider for zenoss my first so please be kind and im
> trying to access the  resource hash but cannot
>
> All id like to know is what module (is it the provider) that will allow me
> to access this resource hash
>
> I tried accessing it from within a provider but that does not work
> "resource[:transport]".
>
> Im using a usefull hack from https://github.com/vmware/vmware-vmware_libwhere 
> instead of using a SSH as a connector im using a Rest class i created
> for connecting to a Zenoss master
>
> I guess the issue here is how do I use this transport type provider
>
> Any clues anyone??
>

So if you want to use rest calls look at the vshield example:
https://github.com/vmware/vmware-vshield/blob/master/lib/puppet_x/puppetlabs/transport/vshield.rb

There's another prototype with WinRM:
https://github.com/nanliu/puppet-winrm

Originally I decided to split the transport provider to multiple modules,
since the module author would have much better understanding of their
requirements. At this point, maybe a standalone transport modules makes
more sense. My goal is to have a module that:

1. provides several built in transport such as ssh, rest, winrm,
(suggestions?)
2. allows multiple provider to pass credential (currently specified in the
resource, but should allow device.conf and perhaps others on client
encrypted credentials).
3. ???

I'm happy to collaborate if your module is opensource, or consult if this
is private. Just email me. Thanks,

Nan

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/CACqVBqCvws4a4mHzOgqhTBY%3DZzOkv7e1xd3sZ8VKPKCDwPqxhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to