[TC-6] WIP adds non-interactive mode to traffic_ops postinstall#126
[TC-6] WIP adds non-interactive mode to traffic_ops postinstall#126PeterRyder wants to merge 35 commits intoapache:masterfrom PeterRyder:WIP-cfg-postinstall
Conversation
…fault mode of operation
…cops_perl_library
dangogh
left a comment
There was a problem hiding this comment.
Please remove sharing of package variables and find a better way to get that info to the modules..
traffic_ops/build/traffic_ops.spec
Outdated
| if [ "$1" = "1" ]; then | ||
| # see postinstall, the .reconfigure file triggers init(). | ||
| /bin/touch %{PACKAGEDIR}/.reconfigure | ||
| #/bin/touch %{PACKAGEDIR}/.reconfigure |
There was a problem hiding this comment.
best to just remove the line rather than comment it out with no explaining comment.. It's still in the history of the file.
There was a problem hiding this comment.
Removed because reconfigure is now a command line option - removed line from spec file
traffic_ops/install/bin/input.json
Outdated
| @@ -0,0 +1,169 @@ | |||
| { | |||
| "/opt/traffic_ops/app/conf/production/database.conf":[ | |||
There was a problem hiding this comment.
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" ); |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
No reason to use "our" -- here -- sharing package variables makes it hard to follow the code.
-Removed trailing spaces in input.json -Renamed postinstall-new to postinstall for easier diff
| "config_var":"common_name" | ||
| }, | ||
| { | ||
| "RSA Passphrase":"password", |
There was a problem hiding this comment.
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.
… defaulting to yes
…ut input parameters
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