saltstack / saltstack/salt

SaltRenderError when reactor gets salt.managed diff?

Open
#51,730 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed severity-low
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue/Question

A salt.manage state copies a file.

Is the reactor unable to parse salt.managed diff?

Setup

This is minionconf.sls, it copies a file minionconf.conf to the minion:

minionconf_file:
  file.managed:
    - source: salt://minionconf.conf
    - name: /salt/conf/minion.d/minionconf.conf
    - fire_event: True

This is file minionconf.conf

ping_interval: 90
random_startup_delay: 30

This is the minionconf_reactor.sls

minionconf_reaction:
  runner.minionconf_runner.main:
    - arg:
      - {{ data }}

This is the error:

2019-02-20 16:33:20,957 [salt.utils.reactor:101 ][ERROR   ][24341] Failed to render "/srv/salt/reactor/minionconf_reactor.sls":
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/utils/reactor.py", line 92, in render_reaction
    data=data)
  File "/usr/lib/python2.7/dist-packages/salt/state.py", line 383, in render_template
    **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/template.py", line 93, in compile_template
    ret = render(input_data, saltenv, sls, **render_kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/renderers/yaml.py", line 59, in render
    raise SaltRenderError(exc)
SaltRenderError: while parsing a flow mapping
  in "<unicode string>", line 4, column 466:
     ...  u'__run_num__': 0, u'changes': {u'diff': u'--- \n+++ \n@@ -1 +1 ...
                                         ^
expected ',' or '}', but got ':'
  in "<unicode string>", line 4, column 538:
     ... ping_interval: 1\n+ping_interval: 90\n+random_startup_delay: 30\ ...


Workaround

Added show_changes: False to file.managed

Versions Report

salt-run --versions-report
Salt Version:
Salt: 2018.3.3

Dependency Versions:
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 2.2
docker-py: Not Installed
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.9 (default, Sep 25 2018, 20:42:16)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5

System Versions:
dist: debian 8.11
locale: UTF-8
machine: x86_64
release: 3.16.0-6-amd64
system: Linux
version: debian 8.11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with salt/utils/reactor.py at render_reaction and follow the call into salt/template.py and salt/renderers/yaml.py. Reproduce the provided file.managed and reactor SLS with show_changes enabled; done means the reactor renders the event data without SaltRenderError while preserving the diff.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.