Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get ip from /etc/network/interfaces

  • Loading branch information...
commit 6dd0bc02027b0721696a46ee2a8f55028f99cf17 1 parent 1658f77
Xiaohua Guan guanxiaohua2k6 authored
2  others/auto_register_node/node.rb
View
@@ -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}
2  others/auto_register_node/server_info_sender.rb
View
@@ -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]
Please sign in to comment.
Something went wrong with that request. Please try again.