Fix bug.
This commit is contained in:
parent
b4b1280a37
commit
6051cb7a40
|
@ -135,12 +135,12 @@ namespace :create_site do
|
||||||
cert_file_store_path = site_cert.cert_file.file.file
|
cert_file_store_path = site_cert.cert_file.file.file
|
||||||
crt_file_content = exec_ssh_command_by_sudo_and_see_output(ssh,"cat #{crt_file_path}",false).select{|s| s.present?}.join("\n").strip.split(/(\r\n|\n)/).select{|s| s.present?}.join("\n")
|
crt_file_content = exec_ssh_command_by_sudo_and_see_output(ssh,"cat #{crt_file_path}",false).select{|s| s.present?}.join("\n").strip.split(/(\r\n|\n)/).select{|s| s.present?}.join("\n")
|
||||||
FileUtils.mkdir_p(File.dirname(cert_file_store_path)) unless Dir.exist?(File.dirname(cert_file_store_path))
|
FileUtils.mkdir_p(File.dirname(cert_file_store_path)) unless Dir.exist?(File.dirname(cert_file_store_path))
|
||||||
File.open(site_cert.cert_file.file.file,'w+'){|f| f.write(crt_file_content)}
|
File.open(cert_file_store_path,'w+'){|f| f.write(crt_file_content)}
|
||||||
site_cert["private_key"] = File.basename(private_key_path)
|
site_cert["private_key"] = File.basename(private_key_path)
|
||||||
private_key_store_path = site_cert.private_key.file.file
|
private_key_store_path = site_cert.private_key.file.file
|
||||||
private_key_content = exec_ssh_command_by_sudo_and_see_output(ssh,"cat #{private_key_path}",false).select{|s| s.present?}.join("\n").strip.split(/(\r\n|\n)/).select{|s| s.present?}.join("\n")
|
private_key_content = exec_ssh_command_by_sudo_and_see_output(ssh,"cat #{private_key_path}",false).select{|s| s.present?}.join("\n").strip.split(/(\r\n|\n)/).select{|s| s.present?}.join("\n")
|
||||||
FileUtils.mkdir_p(File.dirname(private_key_store_path)) unless Dir.exist?(File.dirname(private_key_path))
|
FileUtils.mkdir_p(File.dirname(private_key_store_path)) unless Dir.exist?(File.dirname(private_key_store_path))
|
||||||
File.open(site_cert.private_key.file.file,'w+'){|f| f.write(private_key_content)}
|
File.open(private_key_store_path,'w+'){|f| f.write(private_key_content)}
|
||||||
site_cert.source_paths = [crt_file_path,private_key_path]
|
site_cert.source_paths = [crt_file_path,private_key_path]
|
||||||
site_cert.is_certbot = private_key_path.include?("letsencrypt")
|
site_cert.is_certbot = private_key_path.include?("letsencrypt")
|
||||||
site_cert.save
|
site_cert.save
|
||||||
|
|
Loading…
Reference in New Issue