#840: refactored
This commit is contained in:
parent
9574b710b2
commit
ca21238de2
@ -119,17 +119,15 @@ module Devops
|
||||
|
||||
# TODO: check bootstrap template name
|
||||
def bootstrap_server_stream out
|
||||
s, rl, bt = prepare_bootstrap_server
|
||||
options = prepare_bootstrap_server
|
||||
s = options.delete[:server]
|
||||
status = []
|
||||
cert = Devops::Db.connector.key s.key
|
||||
DevopsLogger.logger.debug "Bootstrap certificate path: #{cert.path}"
|
||||
#bootstrap s, out, cert.path, logger
|
||||
options = {
|
||||
:bootstrap_template => bt,
|
||||
:cert_path => cert.path,
|
||||
:run_list => rl
|
||||
}
|
||||
r = two_phase_bootstrap s, options, out
|
||||
options[:cert_path] = cert.path
|
||||
executor = Devops::Executor::ServerExecutor.new(s, out)
|
||||
r = executor.two_phase_bootstrap(options)
|
||||
str = nil
|
||||
r = if check_server(s)
|
||||
Devops::Db.connector.server_set_chef_node_name s
|
||||
@ -148,17 +146,16 @@ module Devops
|
||||
end
|
||||
|
||||
def bootstrap_server
|
||||
server, rl, bootstrap_template = prepare_bootstrap_server
|
||||
dir = DevopsConfig[:report_dir_v2]
|
||||
files = []
|
||||
uri = URI.parse(@request.url)
|
||||
options = prepare_bootstrap_server
|
||||
s = options.delete[:server]
|
||||
options[:provider_name] = s.provider
|
||||
options[:server_attrs] = s.to_mongo_hash
|
||||
options[:owner] = parser.current_user
|
||||
# dir = DevopsConfig[:report_dir_v2]
|
||||
# files = []
|
||||
# uri = URI.parse(@request.url)
|
||||
|
||||
uri = Worker.start_async(BootstrapWorker, @request,
|
||||
provider_name: server.provider,
|
||||
server_attrs: server.to_mongo_hash,
|
||||
bootstrap_template: bootstrap_template,
|
||||
owner: parser.current_user
|
||||
)
|
||||
uri = Worker.start_async(BootstrapWorker, @request, options)
|
||||
|
||||
sleep 1
|
||||
[uri]
|
||||
@ -171,6 +168,7 @@ module Devops
|
||||
rl = body["run_list"]
|
||||
t = body["bootstrap_template"]
|
||||
s = Devops::Db.connector.server_by_instance_id(id)
|
||||
res = {server: s}
|
||||
|
||||
p = Devops::Db.connector.check_project_auth s.project, s.deploy_env, parser.current_user
|
||||
d = p.deploy_env(s.deploy_env)
|
||||
@ -181,9 +179,11 @@ module Devops
|
||||
unless t.nil?
|
||||
templates = get_templates
|
||||
halt_response("Invalid bootstrap template '#{t}', available values: #{templates.join(", ")}", 400) unless templates.include?(t)
|
||||
s[:bootstrap_template] = t
|
||||
end
|
||||
s.chef_node_name = name || provider.create_default_chef_node_name(s)
|
||||
return s, rl || d.run_list, t
|
||||
res[:run_list] = rl || d.run_list
|
||||
return res
|
||||
end
|
||||
|
||||
def unbootstrap_server id
|
||||
|
||||
@ -215,7 +215,11 @@ module Devops
|
||||
bootstrap_options
|
||||
end
|
||||
|
||||
def prepare_two_phase_bootstrap options
|
||||
end
|
||||
|
||||
def two_phase_bootstrap options
|
||||
prepare_two_phase_bootstrap(options)
|
||||
# bootstrap phase
|
||||
begin
|
||||
provider = @server.provider_instance
|
||||
|
||||
Loading…
Reference in New Issue
Block a user