#840: new deploy_info parameter 'json_file'

This commit is contained in:
amartynov 2015-11-06 16:11:28 +03:00
parent 84822598a2
commit 74a9530888

View File

@ -353,14 +353,20 @@ module Devops
cmd = "chef-client --no-color"
if deploy_info["use_json_file"]
deploy_info.delete("use_json_file")
@out << "Deploy Input Parameters:\n"
json = JSON.pretty_generate(deploy_info)
@out.puts json
file = "#{@server.project}_#{@server.deploy_env}_#{Time.new.to_i}"
json = nil
dir = DevopsConfig.config[:project_info_dir]
file = deploy_info["json_file"] || "#{@server.project}_#{@server.deploy_env}_#{Time.new.to_i}"
path = File.join(dir, file)
if File.exists?(path)
json = File.read(path)
else
json = JSON.pretty_generate(deploy_info)
File.open(File.join(dir, file), "w") do |f|
f.write json
end
end
@out << "Deploy Input Parameters:\n"
@out.puts json
@out.flush
cmd << " -j http://#{DevopsConfig.config[:address]}:#{DevopsConfig.config[:port]}/#{DevopsConfig.config[:url_prefix]}/v2.0/deploy/data/#{file}"
else