Class: PuppetX::Puppetlabs::Transport::Vsphere
- Inherits:
-
Object
- Object
- PuppetX::Puppetlabs::Transport::Vsphere
- Defined in:
- lib/puppet_x/puppetlabs/transport/vsphere.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#vim ⇒ Object
Returns the value of attribute vim.
Instance Method Summary collapse
- #close ⇒ Object
- #connect ⇒ Object
-
#initialize(opts) ⇒ Vsphere
constructor
A new instance of Vsphere.
Constructor Details
#initialize(opts) ⇒ Vsphere
Returns a new instance of Vsphere.
9 10 11 12 13 14 15 16 17 |
# File 'lib/puppet_x/puppetlabs/transport/vsphere.rb', line 9 def initialize(opts) @name = opts[:name] = opts[:options] || {} @options = .inject({}){|h, (k, v)| h[k.to_sym] = v; h} @options[:host] = opts[:server] @options[:user] = opts[:username] @options[:password] = opts[:password] Puppet.debug("#{self.class} initializing connection to: #{@options[:host]}") end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/puppet_x/puppetlabs/transport/vsphere.rb', line 7 def name @name end |
#vim ⇒ Object
Returns the value of attribute vim.
6 7 8 |
# File 'lib/puppet_x/puppetlabs/transport/vsphere.rb', line 6 def vim @vim end |
Instance Method Details
#close ⇒ Object
23 24 25 26 |
# File 'lib/puppet_x/puppetlabs/transport/vsphere.rb', line 23 def close Puppet.debug("#{self.class} closing connection to: #{@options[:host]}") @vim.close if @vim end |
#connect ⇒ Object
19 20 21 |
# File 'lib/puppet_x/puppetlabs/transport/vsphere.rb', line 19 def connect @vim ||= RbVmomi::VIM.connect(@options) end |