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