[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-27 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-trafficcontrol/pull/126


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-09 Thread dewrich
Github user dewrich commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95186410
  
--- Diff: traffic_ops/install/bin/input.json ---
@@ -67,5 +67,102 @@
 },
 {
   "LDAP Search Base":"",
-  "input.json"  169  L,
-  4044  C
\ No newline at end of file
+  "config_var":"search_base"
+}
+  ],
+  "/opt/traffic_ops/install/data/json/users.json":[
+{
+  "Administration username for Traffic Ops":"root",
+  "config_var":"tmAdminUser"
+},
+{
+  "Password for the admin user":"default",
+  "config_var":"tmAdminPw",
+  "hidden":"1"
+}
+  ],
+  "/opt/traffic_ops/install/data/profiles/":[
+
+  ],
+  "/opt/traffic_ops/install/data/json/openssl_configuration.json":[
+{
+  "Do you want to generate a certificate?":"yes",
+  "config_var":"genCert"
+},
+{
+  "Country Name (2 letter code)":"XX",
+  "config_var":"country"
+},
+{
+  "State or Province Name (full name)":"Default State",
+  "config_var":"state"
+},
+{
+  "Locality Name (eg, city)":"Default City",
+  "config_var":"locality"
+},
+{
+  "Organization Name (eg, company)":"Default Company Ltd",
+  "config_var":"company"
+},
+{
+  "Organizational Unit Name (eg, section)":"",
+  "config_var":"org_unit"
+},
+{
+  "Common Name (eg, your name or your server's 
hostname)":"example.com",
+  "config_var":"common_name"
+},
+{
+  "RSA Passphrase":"password",
--- End diff --

Passwords in files always worry me, we should maybe evaluate a command line 
option or have a separate file that can be stored locally to be safe.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-09 Thread PeterRyder
Github user PeterRyder commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95162579
  
--- Diff: traffic_ops/build/traffic_ops.spec ---
@@ -122,7 +122,7 @@ Built: %(date) by %{getenv: USER}
 # install
 if [ "$1" = "1" ]; then
   # see postinstall, the .reconfigure file triggers init().
-  /bin/touch %{PACKAGEDIR}/.reconfigure
+  #/bin/touch %{PACKAGEDIR}/.reconfigure
--- End diff --

Removed because reconfigure is now a command line option - removed line 
from spec file


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-06 Thread dangogh
Github user dangogh commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95028313
  
--- Diff: traffic_ops/install/lib/BuildPerlDeps.pm ---
@@ -0,0 +1,97 @@
+#!/usr/bin/perl
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+use lib qw(/opt/traffic_ops/install/lib /opt/traffic_ops/lib/perl5 
/opt/traffic_ops/app/lib);
+
+package BuildPerlDeps;
+
+use InstallUtils qw{ :all };
+
+use base qw{ Exporter };
+our @EXPORT_OK = qw{ build };
+our %EXPORT_TAGS = ( all => \@EXPORT_OK );
+
+sub build {
+my $opt_i = shift;
+
+my @dependencies = ( "expat-devel", "mod_ssl", "mkisofs", "libpcap", 
"libpcap-devel", "libcurl", "libcurl-devel", "mysql-server", "mysql-devel", 
"openssl", "openssl-devel", "cpan", "gcc", "make", "pkgconfig", "automake", 
"autoconf", "libtool", "gettext", "libidn-devel" );
+
+my $msg = << 'EOF';
+
+This script will build and package the required Traffic Ops perl modules.
+In order to complete this operation, Development tools such as the gcc
+compiler will be installed on this machine.
+
+EOF
+
+$ENV{PERL_MM_USE_DEFAULT}= 1;
+$ENV{PERL_MM_NONINTERACTIVE} = 1;
+$ENV{AUTOMATED_TESTING}  = 1;
+
+my $result;
+
+if ( $ENV{USER} ne "root" ) {
+errorOut("You must run this script as the root user");
+}
+
+logger( $msg, "info" );
+
+chdir("/opt/traffic_ops/app");
+
+if ( defined $opt_i && $opt_i == 1 ) {
+if ( !-x "/usr/bin/yum" ) {
+errorOut("You must install 'yum'");
+}
+
+logger( "Installing dependencies", "info" );
+$result = execCommand( "/usr/bin/yum", "-y", "install", 
@dependencies );
+if ( $result != 0 ) {
+errorOut("Dependency installation failed, look through the 
output and correct the problem");
+}
+logger( "Building perl modules", "info" );
+
+$result = execCommand( "/usr/bin/cpan", "pi_custom_log=" . 
$::cpanLogFile, "-if", "YAML" );
--- End diff --

Noticed this in most of the lib/ files -- please don't use main-package 
variables ($::cpanLogFile) in a module -- that ties the module to a specific 
main script..   Instead,  find a clean way to set the variable within this 
package from the main script.   If there are a number of variables,  consider 
creating a function in the module to set variables within the package.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-06 Thread dangogh
Github user dangogh commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95027416
  
--- Diff: traffic_ops/install/bin/input.json ---
@@ -0,0 +1,169 @@
+{  
+  "/opt/traffic_ops/app/conf/production/database.conf":[  
--- End diff --

minor nit -- each line ends with a space..   Please remove trailing spaces 
since lots of editors will remove them and cause unnecessary diffs


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-06 Thread dangogh
Github user dangogh commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95029632
  
--- Diff: traffic_ops/install/bin/postinstall-new ---
@@ -0,0 +1,781 @@
+#!/usr/bin/perl
--- End diff --

Go ahead and replace the postinstall script that's there -- we have it in 
the git history.   That will allow us to review the changes directly without 
having to diff offline.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-06 Thread dangogh
Github user dangogh commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95027237
  
--- Diff: traffic_ops/build/traffic_ops.spec ---
@@ -122,7 +122,7 @@ Built: %(date) by %{getenv: USER}
 # install
 if [ "$1" = "1" ]; then
   # see postinstall, the .reconfigure file triggers init().
-  /bin/touch %{PACKAGEDIR}/.reconfigure
+  #/bin/touch %{PACKAGEDIR}/.reconfigure
--- End diff --

best to just remove the line rather than comment it out with no explaining 
comment..   It's still in the history of the file.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2017-01-06 Thread dangogh
Github user dangogh commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/126#discussion_r95029992
  
--- Diff: traffic_ops/install/bin/postinstall-new ---
@@ -0,0 +1,781 @@
+#!/usr/bin/perl
+
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+use lib qw(/opt/traffic_ops/install/lib /opt/traffic_ops/install/lib/perl5 
/opt/traffic_ops/app/local/lib/perl5 /opt/traffic_ops/app/lib);
+$ENV{PATH} = "/opt/traffic_ops/install/bin:$ENV{PATH}";
+$ENV{PERL5LIB} = 
"/opt/traffic_ops/install/lib:/opt/traffic_ops/install/lib/perl5:/opt/traffic_ops/app/local/lib/perl5:/opt/traffic_ops/app/lib";
+
+use strict;
+use warnings;
+
+use Safe;
+use POSIX;
+use File::Basename qw{dirname};
+use File::Path qw{make_path};
+use InstallUtils qw{ :all };
+use BuildPerlDeps qw{ :all };
+use GenerateCert qw{ :all };
+use ProfileCleanup qw { :all };
+use Digest::SHA1 qw(sha1_hex);
+use Data::Dumper qw(Dumper);
+use Scalar::Util qw(looks_like_number);
+use Getopt::Long;
+
+# paths of the output configuration files
+our $databaseConfFile = 
"/opt/traffic_ops/app/conf/production/database.conf";
--- End diff --

No reason to use "our" -- here -- sharing package variables makes it hard 
to follow the code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #126: [TC-6] WIP adds non-interactive ...

2016-12-07 Thread PeterRyder
GitHub user PeterRyder opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/126

[TC-6] WIP adds non-interactive mode to traffic_ops postinstall

Initial PR for non-interactive traffic ops postinstall. Along with changing 
the postinstall file, some of the helper files such as 
build_trafficops_perl_library and generateCerts have been moved to /lib and 
made into perl modules

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/PeterRyder/incubator-trafficcontrol 
WIP-cfg-postinstall

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/126.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #126


commit 8db47fdb78d2d74c8f1d3082885756251d85b783
Author: peryder 
Date:   2016-11-09T22:05:21Z

Work in progress of automating postinstall

commit 1c22e37b64b1b06b78cd7e1864ac3e83a6219083
Author: peryder 
Date:   2016-11-09T22:10:00Z

Reverted changes not relevant to new postinstall

commit 4d5070b02615791332158a1b347ef3fd389daca3
Author: peryder 
Date:   2016-11-14T19:16:49Z

Several minor updates to sanityCheck

commit aa1369d633772ca9d520bbdfe3d71026429e1c3e
Author: peryder 
Date:   2016-11-14T20:47:00Z

Formatting changes

commit 7a2f761b114ac41a70b154394f1f0a28d7bf1dab
Author: peryder 
Date:   2016-11-15T16:16:09Z

More updates to postinstall for handling logic flow

commit 2b5e6f98f07a354fde3f037876822b98d82d2b4f
Author: peryder 
Date:   2016-11-15T18:56:52Z

Changed command line argument -i to -a and interactive mode is now default 
mode of operation

commit b9bf24d35bba3f6a50340c2fe7076bf33b35bc7c
Author: peryder 
Date:   2016-11-15T18:58:17Z

Fixed formatting

commit 675f6d943278c06f9023735a0121aa9836feae13
Author: peryder 
Date:   2016-11-22T21:27:35Z

Added logging and outputs config file which can be used as input

commit 53136c2a1f79bb5ea9c923b03e2f96c593af4093
Author: peryder 
Date:   2016-12-01T22:05:28Z

Updated to include full new postinstall with new perl modules

commit a5bdbb076c9a08f232ca7b9b5c8d570dea2e16a7
Author: peryder 
Date:   2016-12-02T18:51:43Z

Many minor tweaks - better logging, gzip logs, and comments

commit 180848bcafebb656023424b0d17540c60394cd05
Author: peryder 
Date:   2016-12-02T19:28:25Z

Removed comcast copyright line

commit 1d2c2ed9a4b1975ea561891ea160ef723e173039
Author: peryder 
Date:   2016-12-05T19:13:13Z

Fixed dependencies not being downloaded by adding -y to yum install

commit 3f949d0b37a3d997ab4ddfaad2c5eb76a24cf9c0
Author: peryder 
Date:   2016-12-05T23:52:37Z

Added apache license to added files

commit 35dbd4f13277445d62f465316cfc656d125c2c8f
Author: peryder 
Date:   2016-12-07T15:06:20Z

Minor changes to formatting and reverted changes made to 
build_trafficops_perl_library

commit 193a7f353a703f31f789c52e32f3c9d2cb46b149
Author: peryder 
Date:   2016-12-07T15:09:39Z

Reset build_trafficops_perl_library

commit 74c5e12cfd91a64366bc26e995325dc47daa52dd
Author: peryder 
Date:   2016-12-07T15:11:17Z

Formatted input.json

commit bc4e9096d26bad952208e70a25f135be161772ef
Author: peryder 
Date:   2016-12-07T15:18:49Z

Perltidy on all files

commit d4fa565ec6eb4b6b1397474bb43c6c195965b3d0
Author: peryder 
Date:   2016-12-07T15:21:01Z

Added apache license to ProfileCleanup

commit 48bbcf607d0496c673d3b33a0dcf9085215cf897
Author: peryder 
Date:   2016-12-07T15:22:34Z

Added apache license to postinstall-new-integrated

commit 85dc6ee77ce1b304bf49df18af92227ae1bef9d3
Author: peryder 
Date:   2016-12-07T15:59:30Z

Changed filename to postinstall-new

commit 2c95bf7545edabe84a1bfd226f44042770574397
Author: peryder 
Date:   2016-12-07T16:55:50Z

Changed params to cpan to match open source




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---