5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/models/hostgroup_extensions.rb', line 5
def snapshot!(host_hash)
image = nil
begin
if @host=::Host::Managed.create!(host_hash)
until @host.build == false
logger.debug "Sleeping for host build state: #{@host.build}"
sleep 10
@host = uncached { Host.find(@host.id) }
end
logger.debug "Done waiting - #{@host.build}"
image = @host.snapshot!
raise unless @host.destroy
end
rescue Exception => e
logger.debug e.message
raise e
end
return image
end
|