[bin/agent] Use MAC from Admin interface
Issue: https://mirantis.jira.com/browse/PRD-2165 Tested by hands. Change-Id: I290f8348f70141cdf3f81416f571dd61ab931798
This commit is contained in:
parent
90f3da425e
commit
fc2f834244
16
bin/agent
16
bin/agent
|
@ -364,6 +364,21 @@ class NodeAgent
|
|||
nil
|
||||
end
|
||||
|
||||
def _master_mac detailed_data
|
||||
detailed_data.each do |k, v|
|
||||
if k.to_s =~ /^interfaces$/
|
||||
detailed_data[k].each do |i|
|
||||
begin
|
||||
net = IPAddr.new "#{i[:ip]}/#{i[:netmask]}"
|
||||
return i[:mac] if net.include? @api_ip
|
||||
rescue
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
def _data
|
||||
res = {
|
||||
:mac => (@os[:macaddress] rescue nil),
|
||||
|
@ -374,6 +389,7 @@ class NodeAgent
|
|||
detailed_data = _detailed
|
||||
res.merge!({
|
||||
:ip => ((_master_ip detailed_data or @os[:ipaddress]) rescue nil),
|
||||
:mac => ((_master_mac detailed_data or @os[:mac]) rescue nil),
|
||||
:manufacturer => _manufacturer,
|
||||
:platform_name => _product_name,
|
||||
:meta => detailed_data
|
||||
|
|
Loading…
Reference in New Issue