mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Added IP lookup functionality for /vm/hostname (#154)
This commit is contained in:
parent
19c4bfa34b
commit
4e2a1fb62c
1 changed files with 9 additions and 0 deletions
|
|
@ -459,6 +459,15 @@ module Vmpooler
|
|||
result[params[:hostname]]['disk'] = rdata['disk'].split(':')
|
||||
end
|
||||
|
||||
# Look up IP address of the hostname
|
||||
begin
|
||||
ipAddress = TCPSocket.gethostbyname(params[:hostname])[3]
|
||||
rescue
|
||||
ipAddress = ""
|
||||
end
|
||||
|
||||
result[params[:hostname]]['ip'] = ipAddress
|
||||
|
||||
if config['domain']
|
||||
result[params[:hostname]]['domain'] = config['domain']
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue