Check permissions for secrets file
Old versions of the installer created this file as root, making it impossible to change it as a regular user. So for old installations we need to make sure we've got write access to this file. We're using `sudo` because in these applications the installer gives `sudo` access to the deploy user, so everything works fine with the default configuration.
This commit is contained in:
@@ -136,9 +136,15 @@ task :smtp_ssl_and_delay_jobs_secrets do
|
||||
within current_path do
|
||||
with rails_env: fetch(:rails_env) do
|
||||
tasks_file_path = "lib/tasks/secrets.rake"
|
||||
shared_secrets_path = "#{shared_path}/config/secrets.yml"
|
||||
|
||||
unless test("[ -e #{current_path}/#{tasks_file_path} ]")
|
||||
begin
|
||||
unless test("[ -w #{shared_secrets_path} ]")
|
||||
execute "sudo chown `whoami` #{shared_secrets_path}"
|
||||
execute "chmod u+w #{shared_secrets_path}"
|
||||
end
|
||||
|
||||
execute "cp #{release_path}/#{tasks_file_path} #{current_path}/#{tasks_file_path}"
|
||||
|
||||
execute :rake, "secrets:smtp_ssl_and_delay_jobs"
|
||||
|
||||
Reference in New Issue
Block a user