Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/2.0.x 59e2e0e58 -> a83bc41ff


[TC-381] postinstall errors if "secrets" is missing from cdn.conf

Also added a question for number of workers


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

Branch: refs/heads/2.0.x
Commit: 2e419cb8a87b5073a86f46abaf2eb11d146c5b2e
Parents: 59e2e0e
Author: hbeatty <hbea...@users.noreply.github.com>
Authored: Mon Jun 12 15:26:50 2017 -0400
Committer: Eric Friedrich <fri...@apache.org>
Committed: Thu Jun 15 10:17:09 2017 -0400

----------------------------------------------------------------------
 traffic_ops/install/bin/_postinstall | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/2e419cb8/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall 
b/traffic_ops/install/bin/_postinstall
index 2cfc3b2..812a04e 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -208,8 +208,17 @@ sub generateCdnConf {
         $cdnConf = Safe->new->rdo($fileName) or errorOut("Error loading 
$fileName: $@");
     }
     if ( lc $cdnConfiguration{genSecret} =~ /^y(?:es)?/ ) {
-        my @secrets   = @{ $cdnConf->{secrets} };
+        my @secrets;
         my $newSecret = InstallUtils::randomWord();
+
+        if (defined($cdnConf->{secrets})) {
+            @secrets   = @{ $cdnConf->{secrets} };
+            $cdnConf->{secrets} = \@secrets;
+            InstallUtils::logger( "Secrets found in cdn.conf file", "debug" );
+        } else {
+            $cdnConf->{secrets} = \@secrets;
+            InstallUtils::logger( "No secrets found in cdn.conf file", "debug" 
);
+        }
         unshift @secrets, InstallUtils::randomWord();
         if ( $cdnConfiguration{keepSecrets} > 0 && $#secrets > 
$cdnConfiguration{keepSecrets} - 1 ) {
 
@@ -217,7 +226,9 @@ sub generateCdnConf {
             $#secrets = $cdnConfiguration{keepSecrets} - 1;
         }
     }
+    $cdnConf->{hypnotoad}{workers} = $cdnConfiguration{workers};
     InstallUtils::writePerl( $fileName, $cdnConf );
+    InstallUtils::logger( "CDN configuration has been saved", "info" );
 }
 
 # userInput: The entire input config file which is either user input or the 
defaults
@@ -420,6 +431,10 @@ sub getDefaults {
             {
                 "Number of secrets to keep?" => "10",
                 "config_var"                 => "keepSecrets"
+            },
+            {
+                "Number of workers?" => "96",
+                "config_var"         => "workers"
             }
         ],
         $ldapConfFile => [

Reply via email to