fixed chef_node_name for stack server

This commit is contained in:
Anton Martynov 2015-08-20 21:55:44 +03:00
parent 8e3c277976
commit 49422a5f73
3 changed files with 26 additions and 16 deletions

View File

@ -14,16 +14,23 @@ module StackCommands
sleep sleep_time
stack.sync_details!
puts stack.stack_status
if stack.stack_status != 'CREATE_IN_PROGRESS'
case
when 'CREATE_IN_PROGRESS'
out << "."
out.flush
when 'CREATE_COMPLETE'
mongo.stack_update(stack)
out << "\nStack '#{stack.id}' status is now #{stack.stack_status}\n"
out.flush
break
return 0
when 'ROLLBACK_COMPLETE'
out << "\nStack '#{stack.id}' status is rolled back\n"
return 1
else
out << "\nUnknown status: '#{stack.stack_status}'"
return 2
end
out << "."
out.flush
end
out << "\n"
rescue StandardError => e
logger.error e.message
out << "Error: #{e.message}\n"

View File

@ -151,9 +151,9 @@ module Devops
bootstrap_options = [
"-x #{@server.remote_user}",
"-i #{options[:cert_path]}",
"--json-attributes '#{attributes.to_json}'",
"-N #{@server.chef_node_name}"
"--json-attributes '#{attributes.to_json}'"
]
bootstrap_options.push "-N #{@server.chef_node_name}" if @server.chef_node_name
bootstrap_options.push "--sudo" unless @server.remote_user == "root"
bootstrap_options.push "-t #{options[:bootstrap_template]}" if options[:bootstrap_template]
rl = options[:run_list]

View File

@ -28,7 +28,8 @@ class StackBootstrapWorker < Worker
# stack.owner = attrs['owner']
mongo.stack_insert(stack)
sync_bootstrap_proc.call(out, stack, mongo)
r = sync_bootstrap_proc.call(out, stack, mongo)
if r == 0
out << "\nStack '#{stack.name}' has been created\n"
out.flush
servers = persist_stack_servers!(stack, provider)
@ -40,6 +41,7 @@ class StackBootstrapWorker < Worker
end
end
end
end
private
@ -66,6 +68,7 @@ class StackBootstrapWorker < Worker
server = ::Devops::Model::Server.new(server_attrs)
mongo.server_insert(server)
server.chef_node_name = provider.create_default_chef_node_name(server)
server
end
end