Class: Puppet::Util::NetworkDevice::Cisco_nexus::Device
- Inherits:
-
Simple::Device
- Object
- Simple::Device
- Puppet::Util::NetworkDevice::Cisco_nexus::Device
- Defined in:
- lib/puppet/util/network_device/cisco_nexus/device.rb
Overview
Translates from puppet’s credential store to nodeutil’s environment
Instance Method Summary collapse
- #facts ⇒ Object
-
#initialize(url_or_config, _options = {}) ⇒ Device
constructor
A new instance of Device.
- #parse_device_facts ⇒ Object
Constructor Details
#initialize(url_or_config, _options = {}) ⇒ Device
Returns a new instance of Device.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/puppet/util/network_device/cisco_nexus/device.rb', line 7 def initialize(url_or_config, ={}) super unless Cisco::Environment.environments.empty? Cisco::Node.reset_instance # Clears the previous environment from nodeutil caches end Cisco::Environment.add_env('default', host: config['address'], port: config['port'], transport: config['transport'], verify_mode: config['verify_mode'], username: config['username'], password: config['password'], ) end |
Instance Method Details
#facts ⇒ Object
22 23 24 |
# File 'lib/puppet/util/network_device/cisco_nexus/device.rb', line 22 def facts @facts ||= parse_device_facts end |
#parse_device_facts ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/puppet/util/network_device/cisco_nexus/device.rb', line 26 def parse_device_facts require 'facter/cisco_nexus' facts = {} facts['operatingsystem'] = 'nexus' facts['cisco_node_utils'] = CiscoNodeUtils::VERSION facts['cisco'] = Facter::CiscoNexus.platform_facts facts['hostname'] = Cisco::NodeUtil.node.host_name facts['operatingsystemrelease'] = facts['cisco']['images']['full_version'] facts end |