You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/10/05 22:42:09 UTC

[GitHub] [trafficcontrol] ocket8888 opened a new pull request #5107: Fix Traffic Ops looking for influxdb.conf in the wrong place

ocket8888 opened a new pull request #5107:
URL: https://github.com/apache/trafficcontrol/pull/5107


   ## What does this PR (Pull Request) do?
   
   - [x] This PR fixes #4292 
   
   With this PR, Traffic Ops will look for influxdb.conf in `./conf/$MOJO_MODE/` if `influxdb_conf_path` is not given in `cdn.conf` and the `MOJO_MODE` environment variable is set to any non-empty string.
   
   ## Which Traffic Control components are affected by this PR?
   - Traffic Ops
   
   ## What is the best way to verify this PR?
   Set `MOJO_MODE`, then start Traffic Ops from somewhere such that there is a valid influxdb.conf at `./conf/$MOJO_MODE/influxdb.conf`, then verify that the therein contained was picked up by Traffic Ops by requesting some endpoint that needs Traffic Stats and watching the logs output.
   
   ## If this is a bug fix, what versions of Traffic Control are affected?
   - 4.1.0
   - master
   
   ## The following criteria are ALL met by this PR
   - [x] This PR includes tests OR I have explained why tests are unnecessary
   - [x] This PR includes documentation OR I have explained why documentation is unnecessary
   - [x] This PR includes an update to CHANGELOG.md OR such an update is not necessary
   - [x] This PR includes any and all required license headers
   - [x] This PR ensures that database migration sequence is correct OR this PR does not include a database migration
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY**


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5107: Fix Traffic Ops looking for influxdb.conf in the wrong place

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5107:
URL: https://github.com/apache/trafficcontrol/pull/5107#discussion_r500414636



##########
File path: traffic_ops/traffic_ops_golang/config/config.go
##########
@@ -298,7 +298,19 @@ func LoadConfig(cdnConfPath string, dbConfPath string, riakConfPath string, appV
 
 	idbPath := cfg.InfluxDBConfPath
 	if idbPath == "" {
-		idbPath = filepath.Join(filepath.Dir(cdnConfPath), "influxdb.conf")
+		var mojoMode string
+		for _, v := range os.Environ() {

Review comment:
       Why not `os.Getenv("MOJO_MODE")` instead?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rawlinp merged pull request #5107: Fix Traffic Ops looking for influxdb.conf in the wrong place

Posted by GitBox <gi...@apache.org>.
rawlinp merged pull request #5107:
URL: https://github.com/apache/trafficcontrol/pull/5107


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5107: Fix Traffic Ops looking for influxdb.conf in the wrong place

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5107:
URL: https://github.com/apache/trafficcontrol/pull/5107#discussion_r500624169



##########
File path: docs/source/admin/traffic_ops.rst
##########
@@ -324,7 +324,7 @@ This file deals with the configuration parameters of running Traffic Ops itself.
 	:workers:           This is used only by the `Legacy Perl Script`_, and sets the number of concurrent HTTP server workers allowed.
 
 :inactivity_timeout: This was used by the `Legacy Perl Script`_ to set timeouts on idle client connections to Traffic Ops - the exact operation (and even units) of this configuration option is unknown. `traffic_ops_golang`_ ignores this field.
-:influx_db_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.
+:influxdb_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is to first check if the :envvar:`MOJO_MODE` environment variable is set. If it is, then Traffic Ops will look in the current working directory for a subdirectory named ``conf/``, then inside that for a subdirectory with the name that is the value of the :envvar:`MOJO_MODE` variable, and inside that directory for a file named ``influxdb.conf``. If :envvar:`MOJO_MODE` is *not* set, then Traffic Ops will look for a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.

Review comment:
       Should we emulate that? In 4.1.0 TO will look default to that last behavior by checking the `cdn.conf` directory. Using an implicit `MOJO_MODE` when it's not set effectively walks that back - and might make it harder to break away from `MOJO_MODE` in the future, if only slightly.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #5107: Fix Traffic Ops looking for influxdb.conf in the wrong place

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #5107:
URL: https://github.com/apache/trafficcontrol/pull/5107#discussion_r503478900



##########
File path: docs/source/admin/traffic_ops.rst
##########
@@ -324,7 +324,7 @@ This file deals with the configuration parameters of running Traffic Ops itself.
 	:workers:           This is used only by the `Legacy Perl Script`_, and sets the number of concurrent HTTP server workers allowed.
 
 :inactivity_timeout: This was used by the `Legacy Perl Script`_ to set timeouts on idle client connections to Traffic Ops - the exact operation (and even units) of this configuration option is unknown. `traffic_ops_golang`_ ignores this field.
-:influx_db_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.
+:influxdb_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is to first check if the :envvar:`MOJO_MODE` environment variable is set. If it is, then Traffic Ops will look in the current working directory for a subdirectory named ``conf/``, then inside that for a subdirectory with the name that is the value of the :envvar:`MOJO_MODE` variable, and inside that directory for a file named ``influxdb.conf``. If :envvar:`MOJO_MODE` is *not* set, then Traffic Ops will look for a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.

Review comment:
       after taking, apparently, nearly a week to think about it, I think I'd like to leave the logic as-is. Because hopefully we're looking at excising the Perl entirely and it feels weird to have remnants like this still hanging around.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5107: Fix Traffic Ops looking for influxdb.conf in the wrong place

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5107:
URL: https://github.com/apache/trafficcontrol/pull/5107#discussion_r500630760



##########
File path: docs/source/admin/traffic_ops.rst
##########
@@ -324,7 +324,7 @@ This file deals with the configuration parameters of running Traffic Ops itself.
 	:workers:           This is used only by the `Legacy Perl Script`_, and sets the number of concurrent HTTP server workers allowed.
 
 :inactivity_timeout: This was used by the `Legacy Perl Script`_ to set timeouts on idle client connections to Traffic Ops - the exact operation (and even units) of this configuration option is unknown. `traffic_ops_golang`_ ignores this field.
-:influx_db_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.
+:influxdb_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is to first check if the :envvar:`MOJO_MODE` environment variable is set. If it is, then Traffic Ops will look in the current working directory for a subdirectory named ``conf/``, then inside that for a subdirectory with the name that is the value of the :envvar:`MOJO_MODE` variable, and inside that directory for a file named ``influxdb.conf``. If :envvar:`MOJO_MODE` is *not* set, then Traffic Ops will look for a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.

Review comment:
       I would if it were me, since that was the pre-existing behavior, but I don't feel too strongly about changing the default location.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5107: Fix Traffic Ops looking for influxdb.conf in the wrong place

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5107:
URL: https://github.com/apache/trafficcontrol/pull/5107#discussion_r500617226



##########
File path: docs/source/admin/traffic_ops.rst
##########
@@ -324,7 +324,7 @@ This file deals with the configuration parameters of running Traffic Ops itself.
 	:workers:           This is used only by the `Legacy Perl Script`_, and sets the number of concurrent HTTP server workers allowed.
 
 :inactivity_timeout: This was used by the `Legacy Perl Script`_ to set timeouts on idle client connections to Traffic Ops - the exact operation (and even units) of this configuration option is unknown. `traffic_ops_golang`_ ignores this field.
-:influx_db_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.
+:influxdb_conf_path: An optional field which gives `traffic_ops_golang`_ the absolute or relative path to an `influxdb.conf`_ file. Default if not specified is to first check if the :envvar:`MOJO_MODE` environment variable is set. If it is, then Traffic Ops will look in the current working directory for a subdirectory named ``conf/``, then inside that for a subdirectory with the name that is the value of the :envvar:`MOJO_MODE` variable, and inside that directory for a file named ``influxdb.conf``. If :envvar:`MOJO_MODE` is *not* set, then Traffic Ops will look for a file named ``influxdb.conf`` in the same directory as this ``cdn.conf`` file.

Review comment:
       This reminds me, in Perl if `MOJO_MODE` was unset, it would assume `MOJO_MODE=development`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org