trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dang...@apache.org
Subject [03/27] incubator-trafficcontrol git commit: updated to fix the insert admin sequence
Date Tue, 09 May 2017 18:30:38 GMT
updated to fix the insert admin sequence


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a021bcd5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a021bcd5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a021bcd5

Branch: refs/heads/master
Commit: a021bcd5136479bd41413fb3f5a96348493f8270
Parents: 16b300c
Author: Dewayne Richardson <dewrich@apache.org>
Authored: Wed May 3 10:47:54 2017 -0600
Committer: Dan Kirkwood <dangogh@gmail.com>
Committed: Tue May 9 18:28:58 2017 +0000

----------------------------------------------------------------------
 traffic_ops/install/bin/_postinstall | 65 ++++---------------------------
 1 file changed, 7 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a021bcd5/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index 3c1b8c0..77d28f3 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -35,6 +35,7 @@ use Getopt::Long;
 
 use InstallUtils qw{ :all };
 use GenerateCert qw{ :all };
+use Database qw{ connect };
 
 # paths of the output configuration files
 my $databaseConfFile = "/opt/traffic_ops/app/conf/production/database.conf";
@@ -516,18 +517,6 @@ sub getDefaults {
             {
                 "DNS sub-domain for which your CDN is authoritative" => "cdn1.kabletown.net",
                 "config_var"                                         => "dns_subdomain"
-            },
-            {
-                "TrafficServer Drive Prefix" => "/dev/sd",
-                "config_var"                 => "driver_prefix"
-            },
-            {
-                "TrafficServer RAM Drive Prefix" => "/dev/ram",
-                "config_var"                     => "ram_drive_prefix"
-            },
-            {
-                "TrafficServer RAM Drive Letters (comma separated)" => "0,1,2,3,4,5,6,7",
-                "config_var"                                        => "ram_drive_letters"
             }
         ]
     };
@@ -568,14 +557,13 @@ QUERY
 
     # Skip the insert if the admin 'username' is already there.
     my $sha1_passwd = sha1_hex( $adminconf->{"password"} );
-
     my $insert_admin = <<"ADMIN";
-    insert into tm_user (username, role, local_passwd) 
-                values  ("$adminconf->{"username"}", 
+    insert into tm_user (username, role, local_passwd, confirm_local_passwd)
+                values  ('$adminconf->{"username"}',
                         (select id from role where name = 'admin'),
-                         "$sha1_passwd",
-                        "$sha1_passwd" ))
-                ON CONFLICT (profile, parameter) DO NOTHING ON CONFLICT (username) DO NOTHING;"
+                         '$sha1_passwd',
+                        '$sha1_passwd' )
+                        ON CONFLICT (username) DO NOTHING;
 ADMIN
     $dbh->do($insert_admin);
 
@@ -654,35 +642,6 @@ sub setupCertificates {
 }
 
 #------------------------------------
-sub connect_to_database {
-    my $databaseConfFile = shift;
-    my $todbconf = shift;
-
-    my $dbconf = InstallUtils::readJson($databaseConfFile);
-
-    # Check if the Postgres db is used and set the admin database to be "postgres"
-    my $dbName = $dbconf->{type};
-    if ( $dbconf->{type} eq "Pg" ) {
-        $dbName = "traffic_ops";
-    }
-
-    $ENV{PGUSER}     = $todbconf->{"pgUser"};
-    $ENV{PGPASSWORD} = $todbconf->{"pgPassword"};
-
-    my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $dbconf->{type}, $dbName, $dbconf->{hostname},
$dbconf->{port} );
-    my $dbh = DBI->connect( $dsn, $todbconf->{"pgUser"}, $todbconf->{"pgPassword"}
);
-    if ($dbh) {
-        InstallUtils::logger( "Database connection succeeded", "info" );
-    }
-    else {
-        InstallUtils::logger( "Error connecting to database", "error" );
-        exit(-1);
-    }
-   return $dbh;
-
-}
-
-#------------------------------------
 sub insert_parameters {
     my $dbh = shift;
     my $paramconf = shift;
@@ -720,16 +679,6 @@ sub insert_parameters {
                 values ('geolocation6.polling.url', 'CRConfig.json', '$paramconf->{"tm.url"}/routing/GeoLiteCityv6.dat.gz')

                 ON CONFLICT (name, config_file, value) DO NOTHING;
 
-    -- RAM Prefix
-    insert into parameter (name, config_file, value) 
-                values ('RAM_Drive_Prefix', 'storage.config', '$paramconf->{"ram_drive_prefix"}')

-                ON CONFLICT (name, config_file, value) DO NOTHING;
-
-    insert into parameter (name, config_file, value) 
-                values ('RAM_Drive_Letters', 'storage.config', '$paramconf->{"ram_drive_letters"}')

-                ON CONFLICT (name, config_file, value) DO NOTHING;
-
-
 INSERTS
     doInsert($dbh, $insert_stmt);
 }
@@ -897,7 +846,7 @@ sub main {
     setupMaxMind( $todbconf->{"maxmind"} );
     setupCertificates( $opensslconf );
 
-    my $dbh = connect_to_database($databaseConfFile, $todbconf);
+    my $dbh = Database::connect($databaseConfFile, $todbconf);
     setupDatabaseData( $dbh, $adminconf, $paramconf );
 
     InstallUtils::logger("Starting Traffic Ops", "info" );


Mime
View raw message