You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by fr...@apache.org on 2017/04/20 18:40:05 UTC
[16/44] incubator-trafficcontrol git commit: fixed usage and removed
the update_pgpass subroutine
fixed usage and removed the update_pgpass subroutine
(cherry picked from commit 35e549b9bb031e9fee7d0ec511b54b99d4eec506)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/8d80eedd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/8d80eedd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/8d80eedd
Branch: refs/heads/2.0.x
Commit: 8d80eedda75ec0c136c07d09676ca07c2fff28ee
Parents: a2459cd
Author: Dewayne Richardson <de...@apache.org>
Authored: Thu Apr 13 13:05:53 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Wed Apr 19 15:35:19 2017 -0600
----------------------------------------------------------------------
traffic_ops/app/db/admin.pl | 26 +-------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8d80eedd/traffic_ops/app/db/admin.pl
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/admin.pl b/traffic_ops/app/db/admin.pl
index e8391b8..383832c 100755
--- a/traffic_ops/app/db/admin.pl
+++ b/traffic_ops/app/db/admin.pl
@@ -39,7 +39,7 @@ my $usage = "\n"
. " defined in the dbconf.yml, as well as the database names.\n\n"
. "NOTE: \n"
. "Postgres Superuser: The 'postgres' superuser needs to be created to run $PROGRAM_NAME and setup databases.\n"
- . "If the 'postgres' superuser hasn't been created or password has been set then run the following commands accordingly. \n\n"
+ . "If the 'postgres' superuser has not been created or password has not been set then run the following commands accordingly. \n\n"
. "Create the 'postgres' user (if not created):\n"
. " \$ createuser postgres\n\n"
. "Set the 'postgres' user password:\n"
@@ -223,7 +223,6 @@ sub create_user {
if ( system(qq{psql -h $host_ip -p $host_port -U $db_super_user -tAc "$cmd"}) != 0 ) {
die "Can't create user $db_user\n";
}
- update_pgpass($db_user, $db_password);
}
sub drop_user {
@@ -254,26 +253,3 @@ sub reverse_schema {
);
}
-sub update_pgpass {
-
- my ($username, $password) = @_;
-
- my $rfh; # read file handle
- my $pgpass = "$HOME/.pgpass";
- my $wfh; # write file handle
- open($wfh, '>>', $pgpass) or die "Could not open file '$pgpass' $!";
- open($rfh, '<', $pgpass) or die "Could not open file '$pgpass' $!";
- my $user_plus_password = "$username:$password";
- my $foo = sprintf("%s:%s\n", $username, $password);
- if (! grep{/$user_plus_password/} <$rfh>){
- print $wfh "*:*:*:$user_plus_password\n";
- print "Updated $HOME/.pgpass\n";
- }
-
- # tighten the permission for security and Postgres
- chmod 0600, $wfh or die "Couldn't chmod $wfh $!";
-
- close $wfh;
- close $rfh;
-}
-