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:

test/unit/nics/managed_test.rb
assert_equal new_domain, nic.domain
end
test "#inheriting_mac respects interface mac" do
h = FactoryGirl.build(:host, :managed)
h.primary_interface.mac = '11:22:33:44:55:66'
assert_equal '11:22:33:44:55:66', h.primary_interface.inheriting_mac
end
test "#inheriting_mac respects interface mac even if attached_to is specified" do
h = FactoryGirl.build(:host, :managed)
h.primary_interface.mac = '11:22:33:44:55:66'
h.primary_interface.identifier = 'eth0'
n = h.interfaces.build :mac => '66:55:44:33:22:11', :attached_to => 'eth0'
assert_equal '66:55:44:33:22:11', n.inheriting_mac
end
test "#inheriting_mac inherits mac if own mac is nil" do
h = FactoryGirl.build(:host, :managed)
h.primary_interface.mac = '11:22:33:44:55:66'
h.primary_interface.identifier = 'eth0'
n = h.interfaces.build :mac => nil, :attached_to => 'eth0'
assert_equal '11:22:33:44:55:66', n.inheriting_mac
end
test "#inheriting_mac inherits mac if own mac is empty" do
h = FactoryGirl.build(:host, :managed)
h.primary_interface.mac = '11:22:33:44:55:66'
h.primary_interface.identifier = 'eth0'
n = h.interfaces.build :mac => '', :attached_to => 'eth0'
assert_equal '11:22:33:44:55:66', n.inheriting_mac
end
private
def setup_primary_nic_with_name(name, opts = {})

Also available in: Unified diff