From 7e1bc34f2982df19dc5569ec4e776f6b6cbac854 Mon Sep 17 00:00:00 2001 From: Patrick Debois Date: Mon, 12 Sep 2011 18:22:37 +0300 Subject: [PATCH] [Libvirt] Enable to pass an libvirt_ip_command for looking up the mac -> ip_address . Using eval to allow for passing of mac address in ip_command --- lib/fog/libvirt/models/compute/server.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fog/libvirt/models/compute/server.rb b/lib/fog/libvirt/models/compute/server.rb index b01364223..1f518ebb1 100644 --- a/lib/fog/libvirt/models/compute/server.rb +++ b/lib/fog/libvirt/models/compute/server.rb @@ -292,8 +292,10 @@ module Fog # Aug 24 17:34:41 juno arpwatch: new station 10.247.4.137 52:54:00:88:5a:0a eth0.4 # Aug 24 17:37:19 juno arpwatch: changed ethernet address 10.247.4.137 52:54:00:27:33:00 (52:54:00:88:5a:0a) eth0.4 # Check if another ip_command string was provided - ip_command_global=@connection.ip_command.nil? ? "grep #{mac} /var/log/arpwatch.log|sed -e 's/new station//'|sed -e 's/changed ethernet address//g' |tail -1 |cut -d ':' -f 4-| cut -d ' ' -f 3" : @connection.ip_command - ip_command=options[:ip_command].nil? ? ip_command_global : options[:ip_command] + ip_command_global=@connection.ip_command.nil? ? 'grep #{mac} /var/log/arpwatch.log|sed -e "s/new station//"|sed -e "s/changed ethernet address//g" |tail -1 |cut -d ":" -f 4-| cut -d " " -f 3' : @connection.ip_command + ip_command_local=options[:ip_command].nil? ? ip_command_global : options[:ip_command] + + ip_command=eval(ip_command_local.dump) ip_address=nil