Project

General

Profile

« Previous | Next » 

Revision 712bd3ea

Added by Marek Hulán about 9 years ago

Fixes #9615 - Adds inheriting_mac method

Using this method we can find out the MAC of interface to which this
interface is attached to. This can be used in provisioning template when
we check for real interface name.

(cherry picked from commit 5ad3c4f34b50fb1ac6d9f26e71e183813ab1c96f)

View differences:

app/models/nic/base.rb
class Jail < ::Safemode::Jail
allow :managed?, :subnet, :virtual?, :mac, :ip, :identifier, :attached_to,
:link, :tag, :domain, :vlanid, :bond_options, :attached_devices, :mode,
:attached_devices_identifiers, :primary, :provision
:attached_devices_identifiers, :primary, :provision, :inheriting_mac
end
def type_name
......
self.deep_clone(:except => [:name, :mac, :ip])
end
# if this interface does not have MAC and is attached to other interface,
# we can fetch mac from this other interface
def inheriting_mac
if self.mac.nil? || self.mac.empty?
self.host.interfaces.detect { |i| i.identifier == self.attached_to }.try(:mac)
else
self.mac
end
end
protected
def uniq_fields_with_hosts

Also available in: Unified diff