salt-call publish.runner with arguments from a minion

327 views
Skip to first unread message

Edu Herraiz

unread,
Mar 17, 2015, 12:31:13 PM3/17/15
to salt-...@googlegroups.com
Hello,

I have a functional custom runnner with 3 arguments.
I can run the runner in the master, and works properly:

salt-run myrunner.function arg1 arg2 127.0.0.1

The problem is I can't found the way to publish the runner from a minion.

I' tried a lot of combinations, like:

salt-call publish.runner myrunner.function 'arg1,arg2,127.0.0.1' timeout=300

salt
-call publish.runner myrunner.function 'arg1 arg2 127.0.0.1' timeout=300

salt
-call publish.runner myrunner.function arg1 arg2 127.0.0.1 timeout=300

salt
-call publish.runner myrunner.function arg='arg1','arg2','127.0.0.1' timeout=300

salt
-call publish.runner myrunner.function arg=['arg1','arg2','127.0.0.1'] timeout=300

salt
-call publish.runner myrunner.function arg="['arg1','arg2','127.0.0.1']" timeout=300

but always I have the same error (in the master logs):

2015-03-17 17:23:13,828 [salt.master      ][ERROR   ] Error in function minion_runner:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/salt/master.py", line 1336, in run_func
    ret = getattr(self, func)(load)
  File "/usr/local/lib/python2.7/dist-packages/salt/master.py", line 1206, in minion_runner
    return self.masterapi.minion_runner(clear_load)
  File "/usr/local/lib/python2.7/dist-packages/salt/daemons/masterapi.py", line 803, in minion_runner
    return runner.run()
  File "/usr/local/lib/python2.7/dist-packages/salt/runner.py", line 234, in run
    self.opts['fun'], self.opts['arg'], self.opts)
  File "/usr/local/lib/python2.7/dist-packages/salt/runner.py", line 123, in cmd
    return self.functions[fun](*args, **kwargs)
TypeError: restore() takes exactly 3 arguments (1 given)


In the documentation is not clear how we can use the publish.runner with arguments.
It is possible?

Thank you

Stephen Spencer

unread,
Mar 17, 2015, 8:05:21 PM3/17/15
to salt-...@googlegroups.com
What does your peer configuration look like?

-S

--
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/d/optout.



--
You know, I used to think it was awful that life was so unfair. Then I thought, wouldn't it be much worse if life were fair, and all the terrible things that happen to us come because we actually deserve them? So, now I take great comfort in the general hostility and unfairness of the universe.
Message has been deleted

Edu Herraiz

unread,
Mar 18, 2015, 11:18:50 AM3/18/15
to salt-...@googlegroups.com
Looks like:

peer_run:
    myhost
*:
        
- myrunner.*


It seems like the runner is executed, but can't read the arguments.

- Edu

Carolyn Van Slyck

unread,
Mar 18, 2015, 5:23:19 PM3/18/15
to salt-...@googlegroups.com
I am running into the same problem. The minion is allowed to execute the runner, and it is attempting to execute it on the master but is failing when parsing the arguments.

What is the correct syntax to pass arguments publish.runner?

Carolyn Van Slyck

unread,
Mar 20, 2015, 10:09:40 AM3/20/15
to salt-...@googlegroups.com
I was never able to figure out the syntax and since it is a custom runner, I simply changed my method signature to take a single argument which I then split

e.g.

salt
-call publish.runner mycoolrunner.dostuff 'launch_codes,gps_coordinates'

def dostuff(arg)
    codes
, gps = arg.split(',')
   
# ... fire le missiles

Colton Myers

unread,
Mar 31, 2015, 6:17:46 PM3/31/15
to salt-...@googlegroups.com
It looks like there's probably a bug here. Could one of you please create an issue on Github? Glad you found a workaround in the meantime.

--
Colton Myers
Platform Engineer, SaltStack
@basepi on Github/Twitter/IRC
signature.asc

Edu Herraiz

unread,
May 7, 2015, 10:35:10 AM5/7/15
to salt-...@googlegroups.com
Seems like the error was reported: https://github.com/saltstack/salt/issues/22136
Reply all
Reply to author
Forward
0 new messages