servers info for stack

This commit is contained in:
amartynov 2015-08-18 20:01:17 +03:00
parent c55f69bd75
commit 15b66e116b
4 changed files with 17 additions and 19 deletions

View File

@ -20,9 +20,10 @@ module StackCommands
out.flush
break
end
out << "Next try...\n"
out << "."
out.flush
end
out << "\n"
rescue StandardError => e
logger.error e.message
out << "Error: #{e.message}\n"

View File

@ -21,7 +21,7 @@ module Connectors
def stack(name, options={})
query = {'name' => name}.merge(options)
bson = collection.find(query).to_a.first
raise RecordNotFound.new("'#{id}' not found") unless bson
raise RecordNotFound.new("'#{name}' not found") unless bson
model_from_bson(bson)
end

View File

@ -255,21 +255,17 @@ module Provider
end
def stack_servers(stack)
=begin
r = cloud_formation.list_stack_resources({'StackName' => stack.name}).body['StackResourceSummaries'] #stack_resources(stack)
pp r
s = r.map{|r| pp r; compute.servers.get(r['PhysicalResourceId'])}
pp s
s
=end
list = compute.describe_instances({'tag-key' => 'aws:cloudformation:stack-id', 'tag-value' => stack.id}).body["reservationSet"]
pp list
list.map{|l| pp l; convert_server(l["instancesSet"][0])}
=begin
list.select{|l| l["instancesSet"][0]["instanceState"]["name"].to_s != "terminated"}.map do |server|
list.map do |l|
i = l["instancesSet"][0]
{
'name' => i["tagSet"]["Name"],
'_id' => i["instanceId"],
'key_name' => i["keyName"],
'private_ip' => i["privateIpAddress"],
'public_ip' => i["ipAddress"],
}
end
=end
end
def create_default_stack_name s

View File

@ -55,10 +55,11 @@ class StackBootstrapWorker < Worker
'project' => project.id,
'deploy_env' => deploy_env.identifier,
'remote_user' => mongo.image(deploy_env.image).remote_user,
'key' => extended_info.key_name || provider.ssh_key,
'_id' => extended_info.id,
'chef_node_name' => extended_info.name,
'private_ip' => extended_info.addresses.values.first.first['addr'],
'key' => extended_info["key_name"] || provider.ssh_key,
'_id' => extended_info["id"],
'chef_node_name' => extended_info["name"],
'private_ip' => extended_info["private_ip"],
'public_ip' => extended_info["public_ip"],
'created_by' => stack.owner,
'run_list' => stack.run_list || [],
'stack' => stack.id