Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file.managed: contents_pillar and pillar.file_tree with keep_newline is broken in 2018.3.3 #50221

Closed
tkaehn opened this issue Oct 25, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@tkaehn
Copy link

commented Oct 25, 2018

Description of Issue/Question

Using contents_pillar and pillar.file_tree with keep_newline is broken in 2018.3.3 and results in removing lines.

Probably file.managed is broken as pillar.get shows the newlines (please see below).

Setup and steps to reproduce

root@minion:~# cat /etc/salt/minion.d/file_tree_pillar.conf 
ext_pillar:
  - file_tree:
      root_dir: /srv/pillar/file_tree
      follow_dir_links: False
      keep_newline: True

root@minion:~# cat /srv/salt/motd.sls 
---
/etc/motd:
  file.managed:
    - contents_pillar: motd

root@minion:~# cp /srv/pillar/file_tree/hosts/minion/motd /etc/motd 

root@minion:~# wc -l /srv/pillar/file_tree/hosts/minion/motd /etc/motd 
 3 /srv/pillar/file_tree/hosts/minion/motd
 3 /etc/motd
 6 total

root@minion:~# salt-call --output=json pillar.get motd
{
    "local": "abc\n\n\n"
}

root@minion:~# salt-call state.apply motd test=False
local:
----------
          ID: /etc/motd
    Function: file.managed
      Result: True
     Comment: File /etc/motd updated
     Started: 10:47:58.830950
    Duration: 24.08 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -1,3 +1 @@
                   abc
                  -
                  -

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:  24.080 ms

root@minion:~# wc -l /srv/pillar/file_tree/hosts/minion/motd /etc/motd
 3 /srv/pillar/file_tree/hosts/minion/motd
 1 /etc/motd
 4 total

Versions Report

root@minion:~# salt-call --versions-report
Salt Version:
           Salt: 2018.3.3
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          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.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1
 
System Versions:
           dist: debian 9.5 
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-7-amd64
         system: Linux
        version: debian 9.5 
@Ch3LL

This comment has been minimized.

Copy link
Contributor

commented Oct 25, 2018

I was able to bisect this to this commit 3fef112 particularly when i reverted the change in salt/states/file.py it started working

looks like we need to get this fixed up and might be related to whatever the fix is in #50219

@rallytime

This comment has been minimized.

Copy link
Contributor

commented Oct 25, 2018

@dwoz Can you fix this one as well?

@dwoz

This comment has been minimized.

Copy link
Contributor

commented Nov 6, 2018

This is still an issue in the latest 2018.3 branch.

@tkaehn

This comment has been minimized.

Copy link
Author

commented Feb 26, 2019

Problem still exists 2019.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.