From 80f2b990149092a031b5ba4ff527fa02010e17c1 Mon Sep 17 00:00:00 2001 From: NorseGaud Date: Mon, 4 Jun 2018 23:58:27 -0400 Subject: [PATCH] issues/51: redundancy with ask_for_or_generate_password removed --- lib/capistrano/postgresql/psql_helpers.rb | 1 + lib/capistrano/postgresql/version.rb | 2 +- lib/capistrano/tasks/postgresql.rake | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/capistrano/postgresql/psql_helpers.rb b/lib/capistrano/postgresql/psql_helpers.rb index f669358..473e004 100644 --- a/lib/capistrano/postgresql/psql_helpers.rb +++ b/lib/capistrano/postgresql/psql_helpers.rb @@ -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 diff --git a/lib/capistrano/postgresql/version.rb b/lib/capistrano/postgresql/version.rb index a536036..d91b277 100644 --- a/lib/capistrano/postgresql/version.rb +++ b/lib/capistrano/postgresql/version.rb @@ -1,5 +1,5 @@ module Capistrano module Postgresql - VERSION = '4.9.1' + VERSION = '4.9.2' end end diff --git a/lib/capistrano/tasks/postgresql.rake b/lib/capistrano/tasks/postgresql.rake index 2a326f8..b234785 100644 --- a/lib/capistrano/tasks/postgresql.rake +++ b/lib/capistrano/tasks/postgresql.rake @@ -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 @@ -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