Skip to content

Commit

Permalink
issues/51: redundancy with ask_for_or_generate_password removed
Browse files Browse the repository at this point in the history
  • Loading branch information
NorseGaud committed Jun 5, 2018
1 parent 807e4a7 commit 80f2b99
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/capistrano/postgresql/psql_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def psql_on_db(db_name, *args)
args.unshift("-U #{fetch(:pg_system_user)}") if fetch(:pg_without_sudo) # Add the :pg_system_user to psql command since we aren't using sudo anymore
cmd = [ :psql, "-d #{db_name}", *args ]
cmd = [ :sudo, "-u #{fetch(:pg_system_user)}", *cmd ] unless fetch(:pg_without_sudo)
puts "Executing #{cmd.flatten}"
test *cmd.flatten
#test :sudo, "-u #{fetch(:pg_system_user)} psql -d #{db_name}", *args
end
Expand Down
2 changes: 1 addition & 1 deletion lib/capistrano/postgresql/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Capistrano
module Postgresql
VERSION = '4.9.1'
VERSION = '4.9.2'
end
end
2 changes: 0 additions & 2 deletions lib/capistrano/tasks/postgresql.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'capistrano/postgresql/helper_methods'
require 'capistrano/postgresql/password_helpers'
require 'capistrano/postgresql/psql_helpers'

include Capistrano::Postgresql::HelperMethods
include Capistrano::Postgresql::PasswordHelpers
include Capistrano::Postgresql::PsqlHelpers
Expand Down Expand Up @@ -136,7 +135,6 @@ namespace :postgresql do
if test "[ -e #{archetype_database_yml_file} ]" # Archetype already exists. Just update values that changed. Make sure we don't overwrite it to protect generated passwords.
Net::SCP.upload!(self.host.hostname, self.host.user,StringIO.new(pg_template(true, download!(archetype_database_yml_file))),archetype_database_yml_file)
else
ask_for_or_generate_password if fetch(:pg_password).nil? || fetch(:pg_ask_for_password) == true # Avoid setting a random password or one from user prompt
execute :mkdir, '-pv', File.dirname(archetype_database_yml_file)
Net::SCP.upload!(self.host.hostname,self.host.user,StringIO.new(pg_template),archetype_database_yml_file)
end
Expand Down

0 comments on commit 80f2b99

Please sign in to comment.