find stack by name
This commit is contained in:
parent
53a1e23864
commit
44ad70b01b
@ -56,8 +56,8 @@ module Devops
|
||||
Devops::Db.connector.stack(id)
|
||||
end
|
||||
|
||||
def delete_stack id
|
||||
stack = self.stack(id)
|
||||
def delete_stack name
|
||||
stack = self.stack(naem)
|
||||
stack.delete_stack_in_cloud!
|
||||
Devops::Db.connector.stack_servers_delete(id)
|
||||
Devops::Db.connector.stack_delete(id)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
module Connectors
|
||||
class Stack < Base
|
||||
include Helpers::InsertCommand,
|
||||
Helpers::ShowCommand,
|
||||
# Helpers::ShowCommand,
|
||||
Helpers::ListCommand,
|
||||
Helpers::DeleteCommand,
|
||||
Helpers::UpdateCommand
|
||||
@ -18,6 +18,13 @@ module Connectors
|
||||
collection.update({"_id" => id}, {"$set" => {"run_list" => run_list}})
|
||||
end
|
||||
|
||||
def stack(name, options={})
|
||||
query = {'name' => name}.merge(options)
|
||||
bson = collection.find(query).to_a.first
|
||||
raise RecordNotFound.new("'#{id}' not found") unless bson
|
||||
model_from_bson(bson)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def model_from_bson(bson)
|
||||
|
||||
@ -219,7 +219,7 @@ module Provider
|
||||
}
|
||||
)
|
||||
body = response.body
|
||||
out << "Body: #{body.inspect}"
|
||||
out << "Body: #{body.inspect}\n"
|
||||
stack.id = body['StackId']
|
||||
out << "Stack id: #{stack.id}\n"
|
||||
rescue Excon::Errors::Conflict => e
|
||||
|
||||
Loading…
Reference in New Issue
Block a user