Class: Puppet::Util::NetworkDevice::F5::Facts
- Inherits:
-
Object
- Object
- Puppet::Util::NetworkDevice::F5::Facts
- Defined in:
- lib/puppet/util/network_device/f5/facts.rb
Instance Attribute Summary collapse
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
-
#initialize(transport) ⇒ Facts
constructor
A new instance of Facts.
- #parse_device_facts ⇒ Object
- #retrieve ⇒ Object
Constructor Details
#initialize(transport) ⇒ Facts
Returns a new instance of Facts.
5 6 7 |
# File 'lib/puppet/util/network_device/f5/facts.rb', line 5 def initialize(transport) @transport = transport end |
Instance Attribute Details
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
3 4 5 |
# File 'lib/puppet/util/network_device/f5/facts.rb', line 3 def transport @transport end |
Instance Method Details
#parse_device_facts ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/puppet/util/network_device/f5/facts.rb', line 14 def parse_device_facts facts = { :operatingsystem => :F5 } if response = @transport.call('/mgmt/tm/cm/device') and items = response['items'] result = items.first else Puppet.warning("Did not receive device details. iControl REST requires Administrator level access.") return facts end #'group_id', #'pva_version', #'uptime', [ :baseMac, :chassisId, :fullPath, :hostname, :managementIp, :marketingName, :partition, :platformId, :timeZone, :version ].each do |fact| facts[fact] = result[fact.to_s] end # Map F5 names to expected standard names. facts[:fqdn] = facts[:hostname] facts[:macaddress] = facts[:baseMac] facts[:operatingsystemrelease] = facts[:version] facts[:ipaddress] = facts[:managementIp] facts[:productname] = facts[:marketingName] facts[:interfaces] = 'mgmt' facts[:ipaddress_mgmt] = facts[:ipaddress] facts[:macaddress_mgmt] = facts[:macaddress] return facts end |
#retrieve ⇒ Object
9 10 11 12 |
# File 'lib/puppet/util/network_device/f5/facts.rb', line 9 def retrieve facts = {} facts.merge(parse_device_facts) end |