This commit is contained in:
amartynov 2015-09-11 12:22:58 +03:00
parent f9b9682c6d
commit c7ea85c84c
5 changed files with 14 additions and 2 deletions

View File

@ -18,6 +18,7 @@ module Devops
body = parser.deploy
names = body["names"]
tags = body["tags"] || []
run_list = body["run_list"]
dir = DevopsConfig.config[:report_dir_v2]
files = []
jid = nil
@ -33,6 +34,7 @@ module Devops
end
begin
deploy_info = create_deploy_info(s, project, body["build_number"])
deploy_info["run_list"] = run_list if run_list
uri = Worker.start_async(DeployWorker, @request,
server_attrs: s.to_hash,
@ -70,6 +72,7 @@ module Devops
body = parser.deploy
names = body["names"]
tags = body["tags"] || []
run_list = body["run_list"]
status = []
owner = parser.current_user
@deploy_info_buf = {}
@ -83,6 +86,7 @@ module Devops
end
begin
deploy_info = create_deploy_info(s, project, body["build_number"])
deploy_info["run_list"] = run_list if run_list
res = Devops::Executor::ServerExecutor.new(s, out).deploy_server_with_tags(tags, deploy_info)
status.push(res)
rescue DeployInfoError => e

View File

@ -10,6 +10,8 @@ module Devops
names = check_array(r["names"], "Parameter 'names' should be a not empty array of strings")
tags = check_array(r["tags"], "Parameter 'tags' should be an array of strings", String, true)
build_number = check_string(r["build_number"], "Parameter 'build_number' should be a not empty string", true)
rl = check_array(r["run_list"], "Parameter 'run_list' should be an array of string", String, true)
Validators::Helpers::RunList.new(rl).validate! unless rl.nil?
r
end

View File

@ -34,7 +34,8 @@ module Devops
body = create_object_from_json_body
check_string(body["name"], "Parameter 'name' must be a not empty string")
check_array(body["deploy_envs"], "Parameter 'deploy_envs' must be a not empty array of objects", Hash)
# check_array(body["run_list"], "Parameter 'run_list' must be a not empty array of string", String, false, true)
rl = check_array(body["run_list"], "Parameter 'run_list' should be an array of string", String, true)
Validators::Helpers::RunList.new(rl).validate! unless rl.nil?
Devops::Model::Project.new(body)
end

View File

@ -16,7 +16,8 @@ module Devops
# {
# "names": [], -> array of servers names to run chef-client
# "tags": [], -> array of tags to apply on each server before running chef-client
# "build_number": "" -> string, build number to deploy
# "build_number": "", -> string, build number to deploy
# "run_list": [], -> array of strings to set run_list for chef-client
# }
#
# * *Returns* : text stream

View File

@ -365,6 +365,10 @@ module Devops
def create_run_list out, deploy_info
out << "\nGenerate run list hook...\n"
if deploy_info["run_list"]
out << "Deploy info already contains 'run_list': #{deploy_info["run_list"].join(",")}\n"
return
end
out << "Project run list: #{@project.run_list.join(", ")}\n"
out << "Deploy environment run list: #{@deploy_env.run_list.join(", ")}\n"
out << "Server run list: #{@server.run_list.join(", ")}\n"