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

Puppet run hangs at "service consul-template status" #2

Closed ghost closed 9 years ago

ghost commented 9 years ago

==> frontend1: Info: Class[Consul_template::Run_service]: Scheduling refresh of Service[consul-template] ==> frontend1: Debug: Executing '/sbin/service consul-template status'

Looking at the init.d script, it calls consul-template binary with info param, which, according to consul-template CLI, doesn't exist. So the puppet run hangs and just stays there. Maybe the status check should test if the consul-template is running by checking for pid?

More info on environment: Running puppet apply on clean Centos 6.5 puppetlabs VM with puppet 3.4.2.

gdhbashton commented 9 years ago

Thanks for the heads-up - I only put the module together for CentOS 7 with systemd - I'll have a look at the operation on CentOS 6.5 - pull requests welcome :)

gdhbashton commented 9 years ago

Thanks for the contribution :) The module was heavily based on solarkennedy's consul module, hence the errant info command on sysv to try to get status...

mrh666 commented 9 years ago

Hi there,

I run Puppet on Centos 6.6 and I've got the same issue. I made a changes to templates/consul-template.sysv.erb (as per https://raw.githubusercontent.com/gdhbashton/puppet-consul_template/master/templates/consul-template.sysv.erb) and did update of consul-template to 0.9.0. But now I've got a new issue, every puppet run there is new copy of consul template is running:

[root@node-172 ~]# ps xa | grep consul-template
 34202 ?        S      0:00 /bin/bash /etc/init.d/consul-template start
 34205 ?        S      0:00 runuser -s /bin/bash consul-t -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/local/bin/consul-template -config /etc/consul-template/config.json
 34206 ?        Ss     0:00 bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/local/bin/consul-template -config /etc/consul-template/config.json
 34208 ?        Sl     0:00 /usr/local/bin/consul-template -config /etc/consul-template/config.json
 34886 ?        S      0:00 /bin/bash /etc/init.d/consul-template start
 34889 ?        S      0:00 runuser -s /bin/bash consul-t -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/local/bin/consul-template -config /etc/consul-template/config.json
 34890 ?        Ss     0:00 bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/local/bin/consul-template -config /etc/consul-template/config.json
 34892 ?        Sl     0:00 /usr/local/bin/consul-template -config /etc/consul-template/config.json
 35569 ?        S      0:00 /bin/bash /etc/init.d/consul-template start
 35572 ?        S      0:00 runuser -s /bin/bash consul-t -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/local/bin/consul-template -config /etc/consul-template/config.json
 35573 ?        Ss     0:00 bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/local/bin/consul-template -config /etc/consul-template/config.json
 35575 ?        Sl     0:00 /usr/local/bin/consul-template -config /etc/consul-template/config.json
 35753 pts/0    S+     0:00 grep consul-template

Puppet output:

Info: /Stage[main]/Consul_template::Config/File[/etc/consul-template/couch-nodes.list]: Filebucketed /etc/consul-template/couch-nodes.list to puppet with sum 63b04207f1e09cddff2c4e90f170d023
Debug: /Stage[main]/Consul_template::Config/File[/etc/consul-template/couch-nodes.list]: Removing existing file for replacement with absent
Notice: /Stage[main]/Consul_template::Config/File[/etc/consul-template/couch-nodes.list]/ensure: removed
Debug: /Stage[main]/Consul_template::Config/File[/etc/consul-template/couch-nodes.list]: The container /etc/consul-template will propagate my refresh event
Debug: /etc/consul-template: The container Class[Consul_template::Config] will propagate my refresh event
Debug: Exec[make_consul_template_dir_writable](provider=posix): Executing 'chmod 0777 consul-template'
Debug: Executing 'chmod 0777 consul-template'
Notice: /Stage[main]/Couchbasebd/Exec[make_consul_template_dir_writable]/returns: executed successfully
Debug: /Stage[main]/Couchbasebd/Exec[make_consul_template_dir_writable]: The container Class[Couchbasebd] will propagate my refresh event
Debug: Exec[concat_consul-template/config.json](provider=posix): Executing check '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/consul-template_config.json/fragments.concat.out" -d "/var/lib/puppet/concat/consul-template_config.json" -t'
Debug: Executing '/var/lib/puppet/concat/bin/concatfragments.sh -o "/var/lib/puppet/concat/consul-template_config.json/fragments.concat.out" -d "/var/lib/puppet/concat/consul-template_config.json" -t'
Debug: Prefetching crontab resources for cron
Debug: Class[Consul_template::Config]: The container Stage[main] will propagate my refresh event
Info: Class[Consul_template::Config]: Scheduling refresh of Class[Consul_template::Run_service]
Info: Class[Consul_template::Run_service]: Scheduling refresh of Service[consul-template]
Debug: Executing '/sbin/service consul-template status'
Debug: Executing '/sbin/chkconfig consul-template'
Debug: Executing '/sbin/service consul-template start'
Debug: Executing '/sbin/chkconfig consul-template'
Notice: /Stage[main]/Consul_template::Run_service/Service[consul-template]/ensure: ensure changed 'stopped' to 'running'
Debug: /Stage[main]/Consul_template::Run_service/Service[consul-template]: The container Class[Consul_template::Run_service] will propagate my refresh event
Info: /Stage[main]/Consul_template::Run_service/Service[consul-template]: Unscheduling refresh on Service[consul-template]
Debug: Class[Consul_template::Run_service]: The container Stage[main] will propagate my refresh event

I assume, that is happens because of wrong service status output:

[root@node-172 ~]# service consul-template status
Process not running.

How to fix consul-template.sysv.erb to get a correct status?