Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

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

Closed
PeterRyder wants to merge 35 commits intoapache:masterfrom
PeterRyder:WIP-cfg-postinstall
Closed

[TC-6] WIP adds non-interactive mode to traffic_ops postinstall#126
PeterRyder wants to merge 35 commits intoapache:masterfrom
PeterRyder:WIP-cfg-postinstall

Conversation

@PeterRyder
Copy link
Contributor

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

Copy link
Member

@dangogh dangogh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove sharing of package variables and find a better way to get that info to the modules..

if [ "$1" = "1" ]; then
# see postinstall, the .reconfigure file triggers init().
/bin/touch %{PACKAGEDIR}/.reconfigure
#/bin/touch %{PACKAGEDIR}/.reconfigure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -0,0 +1,169 @@
{
"/opt/traffic_ops/app/conf/production/database.conf":[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

}
logger( "Building perl modules", "info" );

$result = execCommand( "/usr/bin/cpan", "pi_custom_log=" . $::cpanLogFile, "-if", "YAML" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@@ -0,0 +1,781 @@
#!/usr/bin/perl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

use Getopt::Long;

# paths of the output configuration files
our $databaseConfFile = "/opt/traffic_ops/app/conf/production/database.conf";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

peryder added 2 commits January 9, 2017 09:24
-Removed trailing spaces in input.json
-Renamed postinstall-new to postinstall for easier diff
"config_var":"common_name"
},
{
"RSA Passphrase":"password",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@asfgit asfgit closed this in dccfdd8 Jan 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants