Class: Puppet::Util::NetworkDevice::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/util/network_device/base.rb

Direct Known Subclasses

Cisco::Device

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options = {}) ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/puppet/util/network_device/base.rb', line 10

def initialize(url, options = {})
  @url = URI.parse(url)

  @autoloader = Puppet::Util::Autoload.new(self, "puppet/util/network_device/transport")

  if @autoloader.load(@url.scheme)
    @transport = Puppet::Util::NetworkDevice::Transport.const_get(@url.scheme.capitalize).new(options[:debug])
    @transport.host = @url.host
    @transport.port = @url.port || case @url.scheme ; when "ssh" ; 22 ; when "telnet" ; 23 ; end
    @transport.user = @url.user
    @transport.password = @url.password
  end
end

Instance Attribute Details

#transportObject

Returns the value of attribute transport.



8
9
10
# File 'lib/puppet/util/network_device/base.rb', line 8

def transport
  @transport
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/puppet/util/network_device/base.rb', line 8

def url
  @url
end