69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/kiel.rb', line 69
def create_task step, steps
task = Rake::Task::define_task( step[ :task ] => steps.collect{ | s | s[ :task ] } ) do | task, arguments |
tags = build_tags step, steps
if cloud.exists? tags
puts "image \'#{step[ :name ]}\' already up to date and exists:"
tags.each{ | key, value | puts "\'#{key}\' => \'#{value}\'" }
else
puts "starting instance for: \'#{step[ :name ]}\'"
instance = cloud.start_instance initial_image_id( step, steps )
puts "instance for: \'#{step[ :name ]}\' started."
begin
dns_name = cloud.dns_name instance
expand_step = step.dup.merge( setup_name: expand_path( step[ :setup_name ] ) )
puts "excuting installation for: \'#{step[ :name ]}\'"
setup.execute expand_step, dns_name
puts "installation for: \'#{step[ :name ]}\' done."
puts "storing image for: \'#{step[ :name ]}\'"
cloud.store_image instance, tags
puts "image for: \'#{step[ :name ]}\' stored"
rescue
cloud.stop_instance instance
raise
end
end
end
task.add_description( step[ :description ] ) if step.key? :description
task
end
|