Method: KnifeCloudstack::CsStackCreate#public_ip_for_host

Defined in:
lib/chef/knife/cs_stack_create.rb

#public_ip_for_host(name) ⇒ Object



265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/chef/knife/cs_stack_create.rb', line 265

def public_ip_for_host(name)
  return nil unless name
  @public_ip_cache ||= {}

  if !@public_ip_cache[name] then
    server = connection.get_server(name)
    return nil unless server

    ip = connection.get_server_public_ip(server)
    @public_ip_cache[name] = ip if ip
  end

  @public_ip_cache[name]
end