[
https://issues.apache.org/jira/browse/TC-6?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15805948#comment-15805948
]
ASF GitHub Bot commented on TC-6:
---------------------------------
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.
> Traffic Ops postinstall: non-interactive configuration
> ------------------------------------------------------
>
> Key: TC-6
> URL: https://issues.apache.org/jira/browse/TC-6
> Project: Traffic Control
> Issue Type: Improvement
> Components: Traffic Ops
> Affects Versions: 1.8.0
> Reporter: Dan Kirkwood
> Assignee: Dan Kirkwood
> Attachments: Automated_Postinstall_for_Traffic_Ops_v4.docx
>
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> Traffic Ops postinstall currently requires interactive user input. This
> makes it difficult to install exactly the same way each time, and can be
> error prone. It also makes installation within a docker container difficult.
> There should be a way to get this same input from a file that can be
> configured ahead of time.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)