You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ne...@apache.org on 2017/03/08 23:15:45 UTC
[1/7] incubator-trafficcontrol git commit: Fixed yml file for
admin.pl with correct inputs for psql
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master dd4deb919 -> f90fa69df
Fixed yml file for admin.pl with correct inputs for psql
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e086d1f7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e086d1f7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e086d1f7
Branch: refs/heads/master
Commit: e086d1f7613776bbe73498409f73a46f3d158ab1
Parents: 5fd9f4c
Author: PeterRyder <pe...@gmail.com>
Authored: Tue Feb 7 13:44:00 2017 -0500
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Mar 8 16:15:20 2017 -0700
----------------------------------------------------------------------
traffic_ops/install/bin/postinstall | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e086d1f7/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index ec54221..024a659 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -184,7 +184,7 @@ sub generateDbConf {
open( my $fh, '>', $toDBFileName ) or errorOut("Can't write to $toDBFileName!");
print $fh "production:\n";
print $fh " driver: $dbconf{type}\n";
- print $fh " open: tcp:$dbconf{hostname}:$dbconf{port}*$dbconf{dbname}/$dbconf{user}/$dbconf{password}\n";
+ print $fh " open: host=$dbconf{hostname} port=$dbconf{port} user=$dbconf{user} password=$dbconf{password} dbname=$dbconf{dbname} sslmode=disable\n";
close $fh;
return \%todbconf;
[5/7] incubator-trafficcontrol git commit: changed database driver to
Pg
Posted by ne...@apache.org.
changed database driver to Pg
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/bd79a22f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/bd79a22f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/bd79a22f
Branch: refs/heads/master
Commit: bd79a22f45555bcdf37ca202b643a20b7a502c32
Parents: 6316bb3
Author: PeterRyder <pe...@gmail.com>
Authored: Mon Feb 6 17:13:07 2017 -0500
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Mar 8 16:15:20 2017 -0700
----------------------------------------------------------------------
traffic_ops/install/bin/input.json | 2 +-
traffic_ops/install/bin/postinstall | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd79a22f/traffic_ops/install/bin/input.json
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/input.json b/traffic_ops/install/bin/input.json
index 85c4d03..f381a5f 100644
--- a/traffic_ops/install/bin/input.json
+++ b/traffic_ops/install/bin/input.json
@@ -1,7 +1,7 @@
{
"/opt/traffic_ops/app/conf/production/database.conf":[
{
- "Database type":"pg",
+ "Database type":"Pg",
"config_var":"type"
},
{
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/bd79a22f/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index ecffe08..634a405 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -88,7 +88,7 @@ my $automatic = 0;
my $defaultInputs;
sub getDbDriver {
- return "pg";
+ return "Pg";
}
sub getInstallPath {
@@ -574,7 +574,7 @@ sub setupDatabase {
InstallUtils::logger( "Database initialization succeeded", "info" );
}
- my $dsn = sprintf( "DBI:mysql:%s:%s:%s", "mysql", $dbconf->{"hostname"}, $dbconf->{"port"} );
+ my $dsn = sprintf( "DBI:Pg:%s:%s:%s", "Pg", $dbconf->{"hostname"}, $dbconf->{"port"} );
my $dbh = DBI->connect( $dsn, $todbconf->{"dbAdminUser"}, $todbconf->{"dbAdminPw"} );
if ($dbh) {
InstallUtils::logger("Database connection succeeded", "info");
[3/7] incubator-trafficcontrol git commit: Check connection to
database
Posted by ne...@apache.org.
Check connection to database
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/6316bb33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/6316bb33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/6316bb33
Branch: refs/heads/master
Commit: 6316bb33586b7b5e240bfc86ee307c076aec5023
Parents: 9729d23
Author: PeterRyder <pe...@gmail.com>
Authored: Mon Feb 6 17:06:13 2017 -0500
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Mar 8 16:15:20 2017 -0700
----------------------------------------------------------------------
traffic_ops/install/bin/postinstall | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/6316bb33/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index 0c1d51b..ecffe08 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -22,6 +22,7 @@ use strict;
use warnings;
use Safe;
+use DBI;
use POSIX;
use File::Basename qw{dirname};
use File::Path qw{make_path};
@@ -558,6 +559,9 @@ sub setupDatabase {
my $todbconf = shift;
my $opensslconf = shift;
my $setupMaxmind = shift;
+ my $databaseConfFile = shift;
+
+ my $dbconf = InstallUtils::readJson( $databaseConfFile );
InstallUtils::logger( "Setting up database", "info" );
chdir("/opt/traffic_ops/app");
@@ -570,6 +574,18 @@ sub setupDatabase {
InstallUtils::logger( "Database initialization succeeded", "info" );
}
+ my $dsn = sprintf( "DBI:mysql:%s:%s:%s", "mysql", $dbconf->{"hostname"}, $dbconf->{"port"} );
+ my $dbh = DBI->connect( $dsn, $todbconf->{"dbAdminUser"}, $todbconf->{"dbAdminPw"} );
+ if ($dbh) {
+ InstallUtils::logger("Database connection succeeded", "info");
+ # Success!
+ $dbh->disconnect();
+ }
+ else {
+ InstallUtils::logger("Error connecting to database", "error");
+ exit(-1)
+ }
+
if ( $setupMaxmind =~ /^y(?:es)?/ ) {
InstallUtils::logger( "Downloading Maxmind data", "info" );
chdir("/opt/traffic_ops/app/public/routing");
@@ -750,7 +766,7 @@ sub main {
# if reconfigure is set then setup the database
if ($reconfigure) {
- setupDatabase( $todbconf, $opensslconf, $todbconf->{"maxmind"} );
+ setupDatabase( $todbconf, $opensslconf, $todbconf->{"maxmind"}, $databaseConfFile );
}
InstallUtils::logger( "Starting Traffic Ops", "info" );
[4/7] incubator-trafficcontrol git commit: Removed openssl file and
now pass data directly to GenerateCert
Posted by ne...@apache.org.
Removed openssl file and now pass data directly to GenerateCert
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9729d236
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9729d236
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9729d236
Branch: refs/heads/master
Commit: 9729d23677c3b8d2d4431d6e2e1335ff72fda7ff
Parents: dd4deb9
Author: PeterRyder <pe...@gmail.com>
Authored: Mon Feb 6 10:51:43 2017 -0500
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Mar 8 16:15:20 2017 -0700
----------------------------------------------------------------------
traffic_ops/install/bin/postinstall | 26 +++------------
traffic_ops/install/lib/GenerateCert.pm | 50 +++++++---------------------
2 files changed, 17 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9729d236/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index 7e13007..0c1d51b 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -270,17 +270,7 @@ sub generateOpenSSLConf {
my $userInput = shift;
my $fileName = shift;
- if ( !defined $userInput->{$fileName} ) {
- InstallUtils::logger( "No OpenSSL Configuration - questions will be asked", "info" );
-
- # write an empty config so openssl does not use an old file
- InstallUtils::writeJson( $fileName, my %emptyConfig );
- return;
- }
-
my %config = getConfig( $userInput, $fileName );
-
- InstallUtils::writeJson( $fileName, \%config );
return \%config;
}
@@ -408,7 +398,6 @@ sub getDefaults {
"config_var" => "password",
"hidden" => "true"
}
-
],
$dbConfFile => [
{
@@ -568,7 +557,6 @@ sub getDefaults {
sub setupDatabase {
my $todbconf = shift;
my $opensslconf = shift;
- my $genCert = shift;
my $setupMaxmind = shift;
InstallUtils::logger( "Setting up database", "info" );
@@ -600,7 +588,7 @@ sub setupDatabase {
InstallUtils::logger( "Failed to copy coverage zone file", "error" );
}
- if ( lc $genCert =~ /^y(?:es)?/ ) {
+ if ( lc $opensslconf->{"genCert"} =~ /^y(?:es)?/ ) {
if ( -x "/usr/bin/openssl" ) {
InstallUtils::logger( "Installing SSL Certificates", "info" );
$result = GenerateCert::createCert($opensslconf);
@@ -662,8 +650,9 @@ sub main {
InstallUtils::initLogger( $debug, $logFile );
+ print("unzipping log\n");
if ( -f "$logFile.gz" ) {
- InstallUtils::execCommand( "/bin/gunzip", "$logFile.gz" );
+ InstallUtils::execCommand( "/bin/gunzip", "-f", "$logFile.gz" );
}
InstallUtils::logger( "Starting postinstall", "info" );
@@ -687,7 +676,7 @@ sub main {
return;
}
- InstallUtils::logger( "Postinstall " . ( defined $reconfigure ? "in" : "not" ) . " in reconfigure mode", "info" );
+ InstallUtils::logger( "Postinstall " . ( $reconfigure ? "" : "not " ) . "in reconfigure mode", "info" );
InstallUtils::rotateLog($cpanLogFile);
@@ -761,12 +750,7 @@ sub main {
# if reconfigure is set then setup the database
if ($reconfigure) {
- if ($automatic) {
- setupDatabase( $todbconf, $opensslConfFile, $opensslconf->{"genCert"}, $todbconf->{"maxmind"} );
- }
- else {
- setupDatabase( $todbconf, 0, $opensslconf->{"genCert"}, $todbconf->{"maxmind"} );
- }
+ setupDatabase( $todbconf, $opensslconf, $todbconf->{"maxmind"} );
}
InstallUtils::logger( "Starting Traffic Ops", "info" );
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9729d236/traffic_ops/install/lib/GenerateCert.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/install/lib/GenerateCert.pm b/traffic_ops/install/lib/GenerateCert.pm
index 644e482..cad3782 100644
--- a/traffic_ops/install/lib/GenerateCert.pm
+++ b/traffic_ops/install/lib/GenerateCert.pm
@@ -114,14 +114,12 @@ sub execOpenssl {
return $result;
}
+
+# creates a certificate with parameters used from postinstall passed into $config
sub createCert {
# the file used for ssl configuration
- my $opensslconf = shift;
-
- if ( !defined $opensslconf ) {
- InstallUtils::logger( "No input file - running openssl configuration in interactive mode", "info" );
- }
+ my $config = shift;
InstallUtils::logger( $msg, "info" );
@@ -130,50 +128,26 @@ sub createCert {
my $params;
my $passphrase;
- # load the parameters for the certificate
- if ( defined $opensslconf ) {
- my $config = InstallUtils::readJson($opensslconf);
- if ( defined $config->{country} ) {
+ # create the string of parameters
+ $params = "/C=$config->{country}/ST=$config->{state}/L=$config->{locality}/O=$config->{company}/OU=$config->{org_unit}/CN=$config->{common_name}/";
- # the parameters to auto generate the certificate
- $params = "/C=$config->{country}/ST=$config->{state}/L=$config->{locality}/O=$config->{company}/OU=$config->{org_unit}/CN=$config->{common_name}/";
-
- $passphrase = $config->{rsaPassword};
- }
- }
+ $passphrase = $config->{rsaPassword};
InstallUtils::logger( "The server key has been generated", "info" );
- if ($params) {
- if ( execOpenssl( "Generating an RSA Private Server Key", "genrsa", "-des3", "-out", "server.key", "-passout", "pass:$passphrase", "1024" ) != 0 ) {
- exit 1;
- }
- if ( execOpenssl( "Creating a Certificate Signing Request (CSR)", "req", "-new", "-key", "server.key", "-out", "server.csr", "-passin", "pass:$passphrase", "-subj", $params ) != 0 ) {
- exit 1;
- }
+ if ( execOpenssl( "Generating an RSA Private Server Key", "genrsa", "-des3", "-out", "server.key", "-passout", "pass:$passphrase", "1024" ) != 0 ) {
+ exit 1;
}
- else {
- if ( execOpenssl( "Generating an RSA Private Server Key", "genrsa", "-des3", "-out", "server.key", "1024" ) != 0 ) {
- exit 1;
- }
- if ( execOpenssl( "Creating a Certificate Signing Request (CSR)", "req", "-new", "-key", "server.key", "-out", "server.csr") != 0 ) {
- exit 1;
- }
+ if ( execOpenssl( "Creating a Certificate Signing Request (CSR)", "req", "-new", "-key", "server.key", "-out", "server.csr", "-passin", "pass:$passphrase", "-subj", $params ) != 0 ) {
+ exit 1;
}
InstallUtils::logger( "The Certificate Signing Request has been generated", "info" );
InstallUtils::execCommand( "/bin/mv", "server.key", "server.key.orig" );
- if ($params) {
- if ( execOpenssl( "Removing the pass phrase from the server key", "rsa", "-in", "server.key.orig", "-out", "server.key", "-passin", "pass:$passphrase" ) != 0 ) {
- exit 1;
- }
- }
- else {
- if ( execOpenssl( "Removing the pass phrase from the server key", "rsa", "-in", "server.key.orig", "-out", "server.key") != 0 ) {
- exit 1;
- }
+ if ( execOpenssl( "Removing the pass phrase from the server key", "rsa", "-in", "server.key.orig", "-out", "server.key", "-passin", "pass:$passphrase" ) != 0 ) {
+ exit 1;
}
InstallUtils::logger( "The pass phrase has been removed from the server key", "info" );
[6/7] incubator-trafficcontrol git commit: Corrected database
connection and removed hardcoded getDbDriver function
Posted by ne...@apache.org.
Corrected database connection and removed hardcoded getDbDriver function
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/72f5b25b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/72f5b25b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/72f5b25b
Branch: refs/heads/master
Commit: 72f5b25bf81a4f3756b3763568cd091fbec0e696
Parents: bd79a22
Author: PeterRyder <pe...@gmail.com>
Authored: Tue Feb 7 11:14:23 2017 -0500
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Mar 8 16:15:20 2017 -0700
----------------------------------------------------------------------
traffic_ops/install/bin/postinstall | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/72f5b25b/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index 634a405..0ec3273 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -87,10 +87,6 @@ my $inputFile = "";
my $automatic = 0;
my $defaultInputs;
-sub getDbDriver {
- return "Pg";
-}
-
sub getInstallPath {
my $relPath = shift;
return join( '/', "/tmp/traffic_ops", $relPath );
@@ -187,7 +183,7 @@ sub generateDbConf {
# No YAML library installed, but this is a simple file..
open( my $fh, '>', $toDBFileName ) or errorOut("Can't write to $toDBFileName!");
print $fh "production:\n";
- print $fh " driver: ", getDbDriver() . "\n";
+ print $fh " driver: $dbconf{type}\n";
print $fh " open: tcp:$dbconf{hostname}:$dbconf{port}*$dbconf{dbname}/$dbconf{user}/$dbconf{password}\n";
close $fh;
@@ -563,18 +559,7 @@ sub setupDatabase {
my $dbconf = InstallUtils::readJson( $databaseConfFile );
- InstallUtils::logger( "Setting up database", "info" );
- chdir("/opt/traffic_ops/app");
- my $result = InstallUtils::execCommand( "/usr/bin/perl", "db/admin.pl", "--env=production", "setup" );
-
- if ( $result != 0 ) {
- errorOut("Database initialization failed");
- }
- else {
- InstallUtils::logger( "Database initialization succeeded", "info" );
- }
-
- my $dsn = sprintf( "DBI:Pg:%s:%s:%s", "Pg", $dbconf->{"hostname"}, $dbconf->{"port"} );
+ my $dsn = sprintf( "DBI:%s:dbname=%s", $dbconf->{"type"}, $dbconf->{"dbname"} );
my $dbh = DBI->connect( $dsn, $todbconf->{"dbAdminUser"}, $todbconf->{"dbAdminPw"} );
if ($dbh) {
InstallUtils::logger("Database connection succeeded", "info");
@@ -586,6 +571,17 @@ sub setupDatabase {
exit(-1)
}
+ InstallUtils::logger( "Setting up database", "info" );
+ chdir("/opt/traffic_ops/app");
+ my $result = InstallUtils::execCommand( "/usr/bin/perl", "db/admin.pl", "--env=production", "setup" );
+
+ if ( $result != 0 ) {
+ errorOut("Database initialization failed");
+ }
+ else {
+ InstallUtils::logger( "Database initialization succeeded", "info" );
+ }
+
if ( $setupMaxmind =~ /^y(?:es)?/ ) {
InstallUtils::logger( "Downloading Maxmind data", "info" );
chdir("/opt/traffic_ops/app/public/routing");
[2/7] incubator-trafficcontrol git commit: Changed default port to
5432, the postgres default
Posted by ne...@apache.org.
Changed default port to 5432, the postgres default
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/5fd9f4c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/5fd9f4c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/5fd9f4c5
Branch: refs/heads/master
Commit: 5fd9f4c56d0911a8f4ca12472f2ae0e0612a2e7e
Parents: 72f5b25
Author: PeterRyder <pe...@gmail.com>
Authored: Tue Feb 7 11:20:59 2017 -0500
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Mar 8 16:15:20 2017 -0700
----------------------------------------------------------------------
traffic_ops/install/bin/input.json | 2 +-
traffic_ops/install/bin/postinstall | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5fd9f4c5/traffic_ops/install/bin/input.json
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/input.json b/traffic_ops/install/bin/input.json
index f381a5f..c2a347c 100644
--- a/traffic_ops/install/bin/input.json
+++ b/traffic_ops/install/bin/input.json
@@ -13,7 +13,7 @@
"config_var":"hostname"
},
{
- "Database port number":"3306",
+ "Database port number":"5432",
"config_var":"port"
},
{
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5fd9f4c5/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index 0ec3273..ec54221 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -371,7 +371,7 @@ sub getDefaults {
return {
$databaseConfFile => [
{
- "Database type" => "pg",
+ "Database type" => "Pg",
"config_var" => "type"
},
{
@@ -383,7 +383,7 @@ sub getDefaults {
"config_var" => "hostname"
},
{
- "Database port number" => "3306",
+ "Database port number" => "5432",
"config_var" => "port"
},
{
[7/7] incubator-trafficcontrol git commit: This closes #255
Posted by ne...@apache.org.
This closes #255
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f90fa69d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f90fa69d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f90fa69d
Branch: refs/heads/master
Commit: f90fa69df7f64729ee18780e9cd37d5f4a1a1be6
Parents: e086d1f
Author: Dave Neuman <ne...@apache.org>
Authored: Wed Mar 8 16:15:36 2017 -0700
Committer: Dave Neuman <ne...@apache.org>
Committed: Wed Mar 8 16:15:36 2017 -0700
----------------------------------------------------------------------
----------------------------------------------------------------------