debugMinor
SaltStack Reactor fails with exception
Viewed 0 times
failsexceptionwithsaltstackreactor
Problem
I have the next conf files for salt reactor:
When I send API request and run salt-runner.events, I get the next error:
Any thoughts?
- reactor.conf
- 'salt/netapi/hook/cd':
- /srv/reactor/dev.sls
- dev.sls
# vim: sts=2 ts=2 sw=2 et ai
{% set payload = data.get('post') %}
{% set master = [grains.fqdn] %}
core|api|{{ master }}|jenkins-cd:
runner.state.orchestrate:
- tgt: {{ master }}
- mods: myreactor.deploy
- pillar:
temp_var_transmit: {{ payload }}- deploy.sls
{% set payload = salt.pillar.get('temp_var_transmit') %}
{% set master = [grains.fqdn] %}
my_state:
salt.function:
- name: cmd.run
- tgt: {{ master }}
- arg:
- "salt-run state.orch my-reactor.cd_state pillar='{\"temp_var_transmit\":{\"host\":\"{{payload['host']}}\",\"artifact_id\":\"{{payload['artifact_id']}}\",\"artifact_version\":\"{{payload['artifact_version']}}\"}}'"
{% endfor %}- cd_state.sls
{% set data = salt.pillar.get('temp_var_transmit') %}
my_deploy:
salt.state:
- tgt: {{ member }}
- expr_form: compound
- sls: '{{ data.artifact_id }}_{{ data.artifact_version }}'
- queue: true
- test: {{ dry_run_mode }}When I send API request and run salt-runner.events, I get the next error:
jid": "20180119065728472630",
"return": "Exception occurred in runner state.orchestrate: Traceback (most recent call last):\n File \"/usr/lib/python2.7/dist-packages/salt/client/mixins.py\", line 395, in _low\n data['return'] = self.functions[fun](*args, **kwargs)\nTypeError: orchestrate() argument after ** must be a mapping, not list\n",
"success": false,
"user": "Reactor"Any thoughts?
Solution
I was able to find the root of issue. The problem was in the configuration of salt master. After every change of reactor config, I must run
P.S. regarding mentioned error, it occurred because I used kwarg in dev.sls for pillar and represented pillar as list:
Kwarg can not contain a list in this case. It may contain key:value format only. So the correct way is either use without kwarg as I did or remove hyphen near pillar.
salt-call state.highstate command on master to sync reactor source code changes with it. I missed this step and thus my reactor config differed from my original source code in IDE. So once I ran mentioned command, everything became in sync. Thanks everybody for help! P.S. regarding mentioned error, it occurred because I used kwarg in dev.sls for pillar and represented pillar as list:
> kwarg:
> - pillar:
> temp_var_transmit: {{ payload }}Kwarg can not contain a list in this case. It may contain key:value format only. So the correct way is either use without kwarg as I did or remove hyphen near pillar.
Code Snippets
> kwarg:
> - pillar:
> temp_var_transmit: {{ payload }}Context
StackExchange DevOps Q#3126, answer score: 1
Revisions (0)
No revisions yet.