55
56
57
58
59
60
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
|
# File 'lib/chef/knife/cs_server_stop.rb', line 55
def run
@name_args.each do |hostname|
server = connection.get_server(hostname)
if !server then
ui.error("Server '#{hostname}' not found")
next
end
puts "\n"
msg("Name", server['name'])
msg("Public IP", connection.get_server_public_ip(server) || '?')
msg("Service", server['serviceofferingname'])
msg("Template", server['templatename'])
msg("Domain", server['domain'])
msg("Zone", server['zonename'])
msg("State", server['state'])
puts "\n"
if config[:cloudstack_force_stop]
ui.confirm("Do you really want to force stop this server")
print "#{ui.color("Forcefully stopping", :magenta)}"
connection.stop_server(hostname,config[:cloudstack_force_stop])
else
ui.confirm("Do you really want to stop this server")
print "#{ui.color("Stopping", :magenta)}"
connection.stop_server(hostname)
end
puts "\n"
ui.msg("Stopped server #{hostname}")
end
end
|