1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[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

This commit is contained in:
Patrick Debois 2011-09-12 18:22:37 +03:00
parent 40826101d7
commit 7e1bc34f29

View file

@ -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