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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Base.



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

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

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

  if @autoloader.load(@url.scheme, Puppet.lookup(:current_environment))
    @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.



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

def transport
  @transport
end

#urlObject

Returns the value of attribute url.



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

def url
  @url
end