systembell/salt-consul

consul.* config not taking effect

ketzacoatl opened this issue · 1 comments

Hello,

I am running into a problem with the module, I'd like to believe it is my configuration, but my debugging has me still questioning.

I have put my salt-consul config into /etc/salt/minions.d/consul.conf, and to confirm the details make it the module, I have modified the _connect() function as such:

def _connect(host='localhost', port=8500, consistency='default', token=None, **kwargs):
    '''
    Returns an instance of the consul client
    '''
    if not host:
        host = __salt__['config.option']('consul.host')
    if not port:
        port = __salt__['config.option']('consul.port')
    if not consistency:
        consistency = __salt__['config.option']('consul.consistency')
    if not token:
        token = __salt__['config.option']('consul.token')
    print  __salt__['config.option']('consul.host')
    print kwargs
    return consul.Consul(host, port, consistency)

In this way, we can confirm what host and kwargs the function receives. I see:

# salt-call --local consul.node_list                     
10.10.51.27
{'__pub_fun': 'consul.node_list', '__pub_jid': '20150426065652016147', '__pub_pid': 4641, '__pub_tgt': 'salt-call'}
[INFO    ] Starting new HTTP connection (1): localhost

Even though host is 10.10.51.27, salt-consul sets up a new HTTP connection to localhost. This then fails.

If I pass in the host via the command line.. I get better results:

# salt-call --local consul.node_list host=10.10.51.27      
10.10.51.27
{'__pub_fun': 'consul.node_list', '__pub_jid': '20150426070154263532', '__pub_pid': 4678, '__pub_tgt': 'salt-call'}
[INFO    ] Starting new HTTP connection (1): 10.10.51.27
local:
    |_
      ----------
      ip-10-10-30-24:
          10.10.30.24
...

Any ideas what is going wrong here?

Thanks for the heads-up @ketzacoatl, I'll take a look.