claranet / puppet-consul_template

A Puppet module to manage the config and jobs of Consul Template from Hashicorp
Apache License 2.0
30 stars 89 forks source link

negative number of dependencies on second puppet run #41

Closed russellsimpkins-nyt closed 8 years ago

russellsimpkins-nyt commented 8 years ago

Maybe I'm not using this module correctly. I've configured a consul-watch like so:

# add consul_template  
class du_api::consul_template::config inherits du_api::params {
    consul_template::watch{'dbslayer-hosts':
      template      => "${module_name}/consul-hosts.tmpl.erb",
      destination   => '/var/nyt/db/hosts',
      command       => 'false'
    }
}

class du_api::consul_template inherits du_api::params {
  class{'du_api::consul_template::config':}
}

When I first run puppet - puppet agent --test - all is well.

Notice: /Stage[main]/Consul_template::Config/Concat[consul-template/config.json]/File[/etc/consul-template/config.json]/ensure: defined content as '{md5}48f2ee73dfec6f79936ef8c2c32c72d9'
Info: Concat[consul-template/config.json]: Scheduling refresh of Service[consul-template]
Info: Class[Consul_template::Config]: Scheduling refresh of Class[Consul_template::Service]
Info: Class[Consul_template::Service]: Scheduling refresh of Service[consul-template]
Notice: /Stage[main]/Consul_template::Service/Service[consul-template]/ensure: ensure changed 'stopped' to 'running'
Info: /Stage[main]/Consul_template::Service/Service[consul-template]: Unscheduling refresh on Service[consul-template]

When I run the agent a second time, puppet gets into a failure loop:

Info: Computing checksum on file /etc/consul-template/config.json
Info: FileBucket got a duplicate file {md5}48f2ee73dfec6f79936ef8c2c32c72d9
Info: /Stage[main]/Consul_template::Config/File[/etc/consul-template/config.json]: Filebucketed /etc/consul-template/config.json to puppet with sum 48f2ee73dfec6f79936ef8c2c32c72d9
Notice: /Stage[main]/Consul_template::Config/File[/etc/consul-template/config.json]/ensure: removed
Warning: /etc/consul-template: appears to have a negative number of dependencies
Warning: consul-template/config.json: appears to have a negative number of dependencies
Warning: /Stage[main]/Du_api::Consul_template::Config/Consul_template::Watch[dbslayer-hosts]/File[/etc/consul-template/dbslayer-hosts.ctmpl]: appears to have a negative number of dependencies
Warning: Concat[consul-template/config.json]: appears to have a negative number of dependencies
Warning: /Stage[main]/Consul_template::Config/Concat[consul-template/config.json]/File_concat[consul-template/config.json]: appears to have a negative number of dependencies
Warning: consul-template/config.json: appears to have a negative number of dependencies
Warning: /Stage[main]/Consul_template::Config/File[/etc/consul-template/config.json]: appears to have a negative number of dependencies
Warning: consul-template/config.json: appears to have a negative number of dependencies
Warning: /etc/consul-template: appears to have a negative number of dependencies
Warning: Concat::Fragment[dbslayer-hosts.ctmpl]: appears to have a negative number of dependencies
Warning: Consul_template::Watch[dbslayer-hosts]: appears to have a negative number of dependencies

After the notice, that warning block gets repeated in an infiite loop and i'm forced to kill the puppet agent. Have you seen anything like this before?

russellsimpkins-nyt commented 8 years ago

It appears the default value of true for purge_config_dir caused this problem. If I set it to false, there is no nasty error, e.g.

class { 'consul_template': purge_config_dir => false }