Custom external pillar not loading.

1,472 views
Skip to first unread message

Mike Zupan

unread,
Mar 5, 2014, 12:44:07 PM3/5/14
to salt-...@googlegroups.com
I'm having issues getting a custom pillar to load. 

ext_pillar:
   - cmd_json: 'echo {\"arg\":\"value\"}'

Then my dir looks like

[mike@ops /usr/share/pyshared/salt/pillar]$ ls /usr/share/pyshared/salt/pillar
cmd_json.py  cobbler.py     etcd.py        hiera.py     libvirt.py  pillar_ldap.py  reclass_adapter.py
cmd_yaml.py  django_orm.py  git_pillar.py  __init__.py  mongo.py    puppet.py       virtkey.py

So I have an etcd.py file in the same dir cmd_json is and that works

etcd.py

# -*- coding: utf-8 -*-

# Import python libs
import logging
import urllib
import json

# Import salt libs
import salt.utils
from salt._compat import string_types

# Set up logging
log = logging.getLogger(__name__)


def ext_pillar(minion_id, pillar, url):
    log.info("Querying etcd at %r for information for %r", url, minion_id)

    try:
        response = urllib.urlopen(url);
        data = json.loads(response.read())

        out = {'recurly': []}
        for node in data['node']['nodes']:
            out['recurly'].append(node['value'])
    except Exception:
        log.exception(
            'Could not connect to etcd.'
        )
        return {}


    return out



In my master I get the following


[INFO    ] Executing command 'echo {\\"arg\\":\\"value\\"}' in directory '/root'
[DEBUG   ] output: {"arg":"value"}
[CRITICAL] Specified ext_pillar interface etcd is unavailable

So cmd_json is loading but my etcd isn't I don't see much else in the debug output to say why

thanks!

Colton Myers

unread,
Mar 6, 2014, 4:49:05 PM3/6/14
to salt-...@googlegroups.com
Did you restart your master after you put that file there?

--
Colton Myers


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mike Zupan

unread,
Mar 6, 2014, 5:34:01 PM3/6/14
to salt-...@googlegroups.com
I figured out the error.. even though the ubuntu package puts the pillars in /usr/share/pyshared/salt/pillar it doesn’t include that as a search path. I used the right location and it worked

thanks

Mike Zupan

Senior Linux Engineer | Recurly


mi...@recurly.com

P 917-645-2315

recurly.com

You received this message because you are subscribed to a topic in the Google Groups "Salt-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/salt-users/j-h30kWBR5w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to salt-users+...@googlegroups.com.

Seth House

unread,
Mar 6, 2014, 11:22:59 PM3/6/14
to salt-...@googlegroups.com
If you specify the ``extension_modules`` setting in your master config
you can put a "pillar" folder in that folder and not have to put
things in your system path.
Reply all
Reply to author
Forward
0 new messages