Class: Construqt::Flavour::Ubuntu::EtcNetworkInterfaces
- Inherits:
-
Object
- Object
- Construqt::Flavour::Ubuntu::EtcNetworkInterfaces
- Defined in:
- lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb
Defined Under Namespace
Classes: Entry
Instance Method Summary collapse
- #commit ⇒ Object
- #get(iface) ⇒ Object
-
#initialize(result) ⇒ EtcNetworkInterfaces
constructor
A new instance of EtcNetworkInterfaces.
Constructor Details
#initialize(result) ⇒ EtcNetworkInterfaces
Returns a new instance of EtcNetworkInterfaces.
220 221 222 223 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 220 def initialize(result) @result = result @entries = {} end |
Instance Method Details
#commit ⇒ Object
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/construqt/flavour/ubuntu/flavour_ubuntu_result.rb', line 367 def commit # binding.pry out = [@entries['lo']] clazzes = {} @entries.values.each do |entry| name = entry.iface.clazz#.name[entry.iface.clazz.name.rindex(':')+1..-1] #puts "NAME=>#{name}:#{entry.iface.clazz.name.rindex(':')+1}:#{entry.iface.clazz.name}:#{entry.name}" clazzes[name] ||= [] clazzes[name] << entry end ['device', 'bond', 'vlan', 'bridge', 'gre'].each do |type| out += (clazzes[type]||[]).select{|i| !out.first || i.name != out.first.name }.sort{|a,b| a.name<=>b.name } end out.flatten.compact.inject("") { |r, entry| r += entry.commit; r } end |