Permalink
Browse files

Get ip from /etc/network/interfaces

  • Loading branch information...
1 parent 1658f77 commit 6dd0bc02027b0721696a46ee2a8f55028f99cf17 @guanxiaohua2k6 guanxiaohua2k6 committed Mar 8, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 others/auto_register_node/node.rb
  2. +1 −1 others/auto_register_node/server_info_sender.rb
@@ -6,7 +6,7 @@ class Node < RPC::Agent
network = request[:network]
- ips = `ifconfig | grep "inet addr"`.split("\n").collect{|i| i.match(/addr:([0-9\.]+) /)[1]}
+ ips = `cat /etc/network/interfaces | grep "address"`.split("\n").collect{|i| i.match(/[0-9\.]+/)[0]}
min_ip = `ipcalc #{network} -b -n | grep HostMin`.match(/[0-9\.]+/)[0]
max_ip = `ipcalc #{network} -b -n | grep HostMax`.match(/[0-9\.]+/)[0]
min_ip_parts = min_ip.split(".").collect{|i| i.to_i}
@@ -18,7 +18,7 @@ def get_node_host_ips()
end
def get_hostname_and_ip(subnet)
- ips = `/sbin/ifconfig | grep "inet addr"`.split("\n").collect{|i| i.match(/addr:([0-9\.]+) /)[1]}
+ ips = `cat /etc/network/interfaces | grep "address"`.split("\n").collect{|i| i.match(/[0-9\.]+/)[0]}
min_ip = `TERM=xterm ipcalc #{subnet} -b -n | grep HostMin`.match(/[0-9\.]+/)[0]
max_ip = `TERM=xterm ipcalc #{subnet} -b -n | grep HostMax`.match(/[0-9\.]+/)[0]

0 comments on commit 6dd0bc0

Please sign in to comment.