ConsulHelper#running_version timing issue
Getting the following on a new cluster install
================================================================================
Error executing action `run` on resource 'ruby_block[warn pending consul restart]'
================================================================================
Errno::ECONNREFUSED
-------------------
Failed to open TCP connection to localhost:8500 (Connection refused - connect(2) for "localhost" port 8500)
Cookbook Trace:
---------------
/opt/gitlab/embedded/cookbooks/cache/cookbooks/consul/libraries/consul_helper.rb:149:in `get_api'
/opt/gitlab/embedded/cookbooks/cache/cookbooks/consul/libraries/consul_helper.rb:138:in `running_version'
/opt/gitlab/embedded/cookbooks/cache/cookbooks/consul/recipes/enable_daemon.rb:53:in `block (2 levels) in from_file'
Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/consul/recipes/enable_daemon.rb
43: ruby_block 'warn pending consul restart' do
44: block do
45: message = <<~MESSAGE
46: The version of the running consul service is different than what is installed.
47: Please restart consul to start the new version:
48:
49: https://docs.gitlab.com/ee/administration/consul.html#restart-consul
50: MESSAGE
51: LoggingHelper.warning(message)
52: end
53: only_if { consul_helper.running_version != consul_helper.installed_version }
54: end
Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/consul/recipes/enable_daemon.rb:43:in `from_file'
So it looks like gitlab-ctl status consul is succeeding, but consul isn't actually up and listening on the port yet.
It might make sense to wait a little bit if the port isn't responding yet. Otherwise, maybe just warn and move on?
Except where I've messed something else up, the error tends to clear when I re-run reconfigure.