hashicorp / consul-template

Template rendering, notifier, and supervisor for @HashiCorp Consul and Vault data.
https://www.hashicorp.com/
Mozilla Public License 2.0
4.76k stars 782 forks source link

can't reload new configuration from disk on v0.18.0 #866

Closed hinsqueg closed 7 years ago

hinsqueg commented 7 years ago

When send the reload signal to v0.18.0 consul-template process, it does not load configuraion from the current disk files. It always uses the configurations which are loaded on startup.

Example 1:

  1. specify the _loglevel to info in the config file: /tmp/test.hcl
    log_level = "info"
  2. run consul-template:
    $ consul-template -config=/tmp/test.hcl -pid-file=/tmp/test.pid
  3. modify the '/tmp/test.hcl' content: set _loglevel to debug
    log_level = "debug"
  4. send reload signal to consul-template process, expect to see some 'debug' log output, but nothing changed.

Example 2:

  1. make an empty directory
    $ mkdir /tmp/testconfs
  2. run consul-template:
    $ consul-template -config=/tmp/testconfs -pid-file=/tmp/test.pid
  3. create an file: '/tmp/testconfs/log.hcl', content is below:
    log_level = "debug"
  4. send reload signal to consul-template process, expect to see some 'debug' log output, but nothing changed.
cmpex commented 7 years ago

Confirming this issue. I noticed this when I added a configuration file to the directory passed into -config and the new configuration file didn't get picked up by reload. Also confirmed by putting consul-template in debug log_level then tried change it to info.

Here is the debug log:

vagrant@default-az1-ubuntu-1204:~$ tail -f /var/log/consul-template/consul-template.log
2017/02/03 18:06:25.622001 [DEBUG] (runner) receiving dependency health.service(azaws-lb|passing)
2017/02/03 18:06:25.622027 [INFO] (runner) initiating run
2017/02/03 18:06:25.622032 [DEBUG] (runner) checking template 5e32af9f9a55314019cec5130f1e326b
2017/02/03 18:06:25.622696 [DEBUG] (runner) rendering "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az12.html"
2017/02/03 18:06:25.623939 [INFO] (runner) rendered "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az12.html"
2017/02/03 18:06:25.623950 [DEBUG] (runner) rendering "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az1.html"
2017/02/03 18:06:25.624916 [INFO] (runner) rendered "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az1.html"
2017/02/03 18:06:25.624928 [DEBUG] (runner) diffing and updating dependencies
2017/02/03 18:06:25.624935 [DEBUG] (runner) health.service(azaws-lb|passing) is still needed
2017/02/03 18:06:25.624941 [DEBUG] (runner) watching 1 dependencies
2017/02/03 18:06:48.516276 [DEBUG] (cli) receiving signal "hangup"
Reloading configuration...
2017/02/03 18:06:48.516639 [INFO] (runner) stopping
2017/02/03 18:06:48.516850 [DEBUG] (runner) stopping watcher
2017/02/03 18:06:48.516936 [DEBUG] (watcher) stopping all views
2017/02/03 18:06:48.517160 [INFO] (runner) creating new runner (dry: false, once: false)
2017/02/03 18:06:48.517414 [DEBUG] (runner) final config: {"Consul":{"Address":"consul-api.next-staging.services.azaws.net:80","Auth":{"Enabled":false,"Username":"","Password":""},"Retry":{"Attempts":5,"Backoff":250000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":false,"Key":"","ServerName":"","Verify":true},"Token":""},"Dedup":{"Enabled":false,"MaxStale":2000000000,"Prefix":"consul-template/dedup/","TTL":15000000000},"Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":[],"Custom":[],"Pristine":false,"Whitelist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":0},"KillSignal":2,"LogLevel":"debug","MaxStale":2000000000,"PidFile":"","ReloadSignal":1,"Syslog":{"Enabled":false,"Facility":"LOCAL0"},"Templates":[{"Backup":false,"Command":"","CommandTimeout":30000000000,"Contents":"","Destination":"/var/www/lb/next-staging-az12.html","Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":[],"Custom":[],"Pristine":false,"Whitelist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":30000000000},"Perms":420,"Source":"/var/www/consul-template/lb.html.ctmpl","Wait":{"Enabled":false,"Min":0,"Max":0},"LeftDelim":"","RightDelim":""},{"Backup":false,"Command":"","CommandTimeout":30000000000,"Contents":"","Destination":"/var/www/lb/next-staging-az1.html","Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":[],"Custom":[],"Pristine":false,"Whitelist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":30000000000},"Perms":420,"Source":"/var/www/consul-template/lb.html.ctmpl","Wait":{"Enabled":false,"Min":0,"Max":0},"LeftDelim":"","RightDelim":""}],"Vault":{"Address":"","Enabled":false,"RenewToken":true,"Retry":{"Attempts":5,"Backoff":250000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":true,"Key":"","ServerName":"","Verify":true},"UnwrapToken":false},"Wait":{"Enabled":false,"Min":0,"Max":0}}
2017/02/03 18:06:48.517675 [INFO] (runner) creating watcher
2017/02/03 18:06:48.517880 [INFO] (runner) starting
2017/02/03 18:06:48.518017 [DEBUG] (runner) running initial templates
2017/02/03 18:06:48.518148 [INFO] (runner) initiating run
2017/02/03 18:06:48.518259 [DEBUG] (runner) checking template 5e32af9f9a55314019cec5130f1e326b
2017/02/03 18:06:48.518581 [DEBUG] (runner) was not watching 1 dependencies
2017/02/03 18:06:48.518735 [DEBUG] (watcher) adding health.service(azaws-lb|passing)
2017/02/03 18:06:48.518910 [DEBUG] (runner) diffing and updating dependencies
2017/02/03 18:06:48.519045 [DEBUG] (runner) watching 1 dependencies
2017/02/03 18:06:48.517653 [INFO] (runner) received finish
2017/02/03 18:06:48.743547 [DEBUG] (runner) receiving dependency health.service(azaws-lb|passing)
2017/02/03 18:06:48.743788 [INFO] (runner) initiating run
2017/02/03 18:06:48.744092 [DEBUG] (runner) checking template 5e32af9f9a55314019cec5130f1e326b
2017/02/03 18:06:48.744569 [DEBUG] (runner) rendering "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az12.html"
2017/02/03 18:06:48.746002 [INFO] (runner) rendered "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az12.html"
2017/02/03 18:06:48.746135 [DEBUG] (runner) rendering "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az1.html"
2017/02/03 18:06:48.747236 [INFO] (runner) rendered "/var/www/consul-template/lb.html.ctmpl" => "/var/www/lb/next-staging-az1.html"
2017/02/03 18:06:48.747530 [DEBUG] (runner) diffing and updating dependencies
2017/02/03 18:06:48.747666 [DEBUG] (runner) health.service(azaws-lb|passing) is still needed
2017/02/03 18:06:48.747896 [DEBUG] (runner) watching 1 dependencies