61
62
63
64
65
66
67
68
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
|
# File 'lib/collins_shell/provision.rb', line 61
def host tag, profile, contact
verify_profile(profile) if options.verify
config = get_collins_config
if config[:timeout] < 180 then
cclient = get_collins_client :timeout => 180
else
cclient = get_collins_client
end
asset = asset_get tag, options
if options.confirm then
printer = CollinsShell::AssetPrinter.new asset, self, :detailed => false
puts printer
require_yes "You are about to provision asset #{tag} as a #{profile}. ARE YOU SURE?", :red
end
progress_printer = Thread.new {
loop {
print "."
sleep(1)
}
}
status = call_collins cclient, "provision host" do |client|
say_status("starting", "Provisioning has started", :white)
client.provision tag, profile, contact, :activate => options.activate,
:pool => options.pool,
:primary_role => options.primary_role,
:secondary_role => options.secondary_role,
:suffix => options.suffix
end
progress_printer.terminate
puts()
if status then
say_success("Successfully provisioned asset")
asset = asset_get tag, options
printer = CollinsShell::AssetPrinter.new asset, self, :detailed => false
puts printer
asset_exec asset, options.exec, options.confirm
else
say_error("Failed to provision asset")
end
end
|