Created
January 2, 2015 21:57
-
-
Save paha/4541c5fd03e37487df9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Custom runner: cs | |
... | |
def meta_get(name, node_keys): | |
log.debug('Requested keys for meta_get: {0}'.format(node_keys)) | |
cs_node = _get_cs_node(name) | |
if not cs_node: | |
log.debug('{0} CS node is missing, returning values as "unknown"\ | |
'.format(name)) | |
data = {k: 'unknown' for k in node_keys} | |
return data | |
data = {k: str(cs_node[k]) if k in cs_node else 'unknown' for k in node_keys} | |
log.debug('{0} node requested metadata: {1}'.format(name, data)) | |
return data | |
... | |
sls that uses the runner calling it via peer communication: | |
update_grains = ['kernel'] | |
... | |
{% set meta_args = ['name='~ minion_fqdn ~',node_keys='~ update_grains ] %} | |
{% set cs_metadata = salt['publish.runner']('cs.meta_get', meta_args, timeout=20) %} | |
... | |
The second argument doesnt seen to get there: | |
2015-01-02 21:43:27,581 [salt.master ][ERROR ] Error in function minion_runner: | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/salt/master.py", line 1329, in run_func | |
ret = getattr(self, func)(load) | |
File "/usr/lib/python2.7/dist-packages/salt/master.py", line 1199, in minion_runner | |
return self.masterapi.minion_runner(clear_load) | |
File "/usr/lib/python2.7/dist-packages/salt/daemons/masterapi.py", line 782, in minion_runner | |
return runner.run() | |
File "/usr/lib/python2.7/dist-packages/salt/runner.py", line 238, in run | |
self.opts['fun'], self.opts['arg'], self.opts) | |
File "/usr/lib/python2.7/dist-packages/salt/runner.py", line 122, in cmd | |
return self.functions[fun](*args, **kwargs) | |
TypeError: meta_get() takes exactly 2 arguments (1 given) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment