You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When targeting file.serialize with merge_if_exists=True to a file that is improperly formatted, instead of displaying the error cause, salt will complain about a malformed state return.
This creates a malformed json file:
file.managed:
- name:/tmp/exception.json - contents: | { "foo": "bar", }This throws an exception instead of failing with cause description:
file.serialize:
- name:/tmp/exception.json- serializer:json- merge_if_exists:true- dataset:baz:true
Expected behavior
A clear and concise description of what went wrong: Failed to deserialize existing data: Expecting value: line 1 column 1 (char 0)
Screenshots
ID: This throws an exception instead of failing with cause description Function: file.serialize Name: /tmp/exception.json Result: False Comment: An exception occurred in this state: Malformed state return. Data must be a dictionary type. Changes:
Versions Report
Salt Version:
Salt: 3004Dependency Versions:
cffi: 1.14.6cherrypy: unknowndateutil: 2.8.0docker-py: Not Installedgitdb: 4.0.5gitpython: 3.1.12Jinja2: 2.11.3libgit2: Not InstalledM2Crypto: Not InstalledMako: 1.1.4msgpack: 1.0.2msgpack-pure: Not Installedmysql-python: Not Installedpycparser: 2.19pycrypto: Not Installedpycryptodome: 3.9.8pygit2: Not InstalledPython: 3.7.4 (default, Oct 12 2021, 12:57:44)python-gnupg: 0.4.4PyYAML: 5.4.1PyZMQ: 18.0.1smmap: 3.0.2timelib: 0.2.4Tornado: 4.5.3ZMQ: 4.3.1System Versions:
dist: darwin 21.3.0locale: UTF-8machine: x86_64release: 21.3.0system: Darwinversion: 10.16 x86_64
Additional context
Already diagnosed and found a fix, PR incoming:
Description
When targeting
file.serialize
withmerge_if_exists=True
to a file that is improperly formatted, instead of displaying the error cause, salt will complain about a malformed state return.Setup
M1 Mac, masterless minion (likely irrelevant)
Steps to Reproduce the behavior
Expected behavior
A clear and concise description of what went wrong:
Failed to deserialize existing data: Expecting value: line 1 column 1 (char 0)
Screenshots
Versions Report
Additional context
Already diagnosed and found a fix, PR incoming:
https://github.com/saltstack/salt/blob/1ebaed1ff0e1ccf5fb67050de19ce642ab8d28d2/salt/states/file.py#L7755-L7760s sets
ret
correctly, but still opts toreturn False
.The text was updated successfully, but these errors were encountered: