Module: Staypuft::Concerns::HostInterfaceManagement
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/staypuft/concerns/host_interface_management.rb
Instance Method Summary collapse
- #clean_vlan_interfaces ⇒ Object
- #interfaces_identifiers ⇒ Object
- #make_all_interfaces_managed ⇒ Object
- #network_query ⇒ Object
- #primary_interface_is_bonded? ⇒ Boolean
Instance Method Details
#clean_vlan_interfaces ⇒ Object
10 11 12 |
# File 'app/models/staypuft/concerns/host_interface_management.rb', line 10 def clean_vlan_interfaces self.interfaces.virtual.map(&:destroy) end |
#interfaces_identifiers ⇒ Object
14 15 16 17 18 |
# File 'app/models/staypuft/concerns/host_interface_management.rb', line 14 def interfaces_identifiers interfaces = [ self.primary_interface ] interfaces += self.respond_to?(:interfaces) ? self.interfaces.where("type <> 'Nic::BMC'").physical.map(&:identifier) : [] interfaces end |
#make_all_interfaces_managed ⇒ Object
20 21 22 23 24 25 |
# File 'app/models/staypuft/concerns/host_interface_management.rb', line 20 def make_all_interfaces_managed self.interfaces.each do |interface| interface.managed = true interface.save! end end |
#network_query ⇒ Object
27 28 29 |
# File 'app/models/staypuft/concerns/host_interface_management.rb', line 27 def network_query @network_query || NetworkQuery.new(self.hostgroup.deployment, self) end |
#primary_interface_is_bonded? ⇒ Boolean
31 32 33 34 35 36 37 |
# File 'app/models/staypuft/concerns/host_interface_management.rb', line 31 def primary_interface_is_bonded? self.bond_interfaces.any? do |bond| bond.attached_devices_identifiers.any? do |interface_identifier| self.has_primary_interface? ? self.primary_interface == interface_identifier : false end end end |