mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Allow managing empty files
Without this patch, specifying an empty file like this: empty-file: file.managed: - name: /tmp/empty - contents: '' Did not actually ensure that the file was empty, since the check for content sources didn't separate between unset values and the empty string.
This commit is contained in:
parent
4008e1719a
commit
c6244b46ac
1 changed files with 2 additions and 1 deletions
|
@ -1385,8 +1385,9 @@ def managed(name,
|
|||
'name': name,
|
||||
'result': True}
|
||||
|
||||
content_sources = (contents, contents_pillar, contents_grains)
|
||||
contents_count = len(
|
||||
[x for x in (contents, contents_pillar, contents_grains) if x]
|
||||
[x for x in content_sources if x is not None]
|
||||
)
|
||||
|
||||
if source and contents_count > 0:
|
||||
|
|
Loading…
Add table
Reference in a new issue