lib/cloudstack-cli/commands/stack.rb in cloudstack-cli-0.9.1 vs lib/cloudstack-cli/commands/stack.rb in cloudstack-cli-0.10.0

- old
+ new

@@ -7,11 +7,11 @@ projectid = find_project(stack["project"])['id'] if stack["project"] jobs = [] client.verbose = false stack["servers"].each do |instance| instance["name"].gsub(', ', ',').split(',').each do |name| - server = client.get_server(name: name, project_id: projectid) + server = client.get_server(name, project_id: projectid) if server say "Server #{name} (#{server["state"]}) already exists.", :yellow jobs << { id: 0, name: "Create server #{name}", @@ -66,10 +66,15 @@ option :force, description: "destroy without asking", type: :boolean, default: false, aliases: '-f' + option :expunge, + description: "expunge servers immediately", + type: :boolean, + default: false, + aliases: '-E' def destroy(stackfile) stack = parse_stackfile(stackfile) projectid = find_project(stack["project"])['id'] if stack["project"] client.verbose = false servers = [] @@ -82,11 +87,14 @@ servers.each do |name| server = client(quiet: true).get_server(name, project_id: projectid) if server jobs << { id: client.destroy_server( - server['id'], false + server['id'], { + sync: true, + expunge: options[:expunge] + } )['jobid'], name: "Destroy server #{name}" } end end @@ -114,6 +122,6 @@ def string_to_array(string) string ? string.gsub(', ', ',').split(',') : nil end end -end \ No newline at end of file +end