{"action":"opened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/47714","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/47714/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/47714/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/47714/events","html_url":"https://github.com/saltstack/salt/issues/47714","id":324223154,"number":47714,"title":"state.apply test=True returns inverted diff","user":{"login":"NewEvolution","id":591490,"avatar_url":"https://avatars1.githubusercontent.com/u/591490?v=4","gravatar_id":"","url":"https://api.github.com/users/NewEvolution","html_url":"https://github.com/NewEvolution","followers_url":"https://api.github.com/users/NewEvolution/followers","following_url":"https://api.github.com/users/NewEvolution/following{/other_user}","gists_url":"https://api.github.com/users/NewEvolution/gists{/gist_id}","starred_url":"https://api.github.com/users/NewEvolution/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NewEvolution/subscriptions","organizations_url":"https://api.github.com/users/NewEvolution/orgs","repos_url":"https://api.github.com/users/NewEvolution/repos","events_url":"https://api.github.com/users/NewEvolution/events{/privacy}","received_events_url":"https://api.github.com/users/NewEvolution/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-17T23:46:25Z","updated_at":"2018-05-17T23:46:25Z","closed_at":null,"author_association":"NONE","body":"### Description of Issue/Question\r\nWhen applying changes via `file.managed` in state with the `test=True` flag set, the diff shows the opposite of what changes will be made, i.e. the line to be removed is shown with a `+` and the line to be added is shown with a `-`\r\n\r\n### Setup\r\nCan be reproduced with arbitrary file content changes in `file.managed` managed files.\r\n\r\n### Steps to Reproduce Issue\r\nApply a state: `salt --state-output=changes 'graylog.*' state.apply state/linux/graylog test=True`\r\nRelevant output:\r\n```\r\n----------\r\n          ID: /etc/graymongo/mongodb.conf\r\n    Function: file.managed\r\n      Result: None\r\n     Comment: The file /etc/graymongo/mongodb.conf is set to be changed\r\n     Started: 23:29:25.940514\r\n    Duration: 36.212 ms\r\n     Changes:\r\n              ----------\r\n              diff:\r\n                  ---\r\n                  +++\r\n                  @@ -8,7 +8,7 @@\r\n\r\n                   # logappend=true\r\n\r\n                  -bind_ip = 172.31.46.63\r\n                  +bind_ip = [u'172.31.46.63\r\n                   #port = 27017\r\n\r\n                   # Enable journaling, http://www.mongodb.org/display/DOCS/Journaling\r\n```\r\nRun without test flag to make changes: `salt --state-output=changes 'graylog.*' state.apply state/linux/graylog`\r\nRelevant output:\r\n```\r\n----------\r\n          ID: /etc/graymongo/mongodb.conf\r\n    Function: file.managed\r\n      Result: True\r\n     Comment: File /etc/graymongo/mongodb.conf updated\r\n     Started: 23:33:42.907231\r\n    Duration: 41.373 ms\r\n     Changes:\r\n              ----------\r\n              diff:\r\n                  ---\r\n                  +++\r\n                  @@ -8,7 +8,7 @@\r\n\r\n                   # logappend=true\r\n\r\n                  -bind_ip = [u'172.31.46.63\r\n                  +bind_ip = 172.31.46.63\r\n                   #port = 27017\r\n\r\n                   # Enable journaling, http://www.mongodb.org/display/DOCS/Journaling\r\n```\r\n\r\n### Versions Report\r\nMaster:\r\n```\r\nSalt Version:\r\n           Salt: 2018.3.0\r\n\r\nDependency Versions:\r\n           cffi: Not Installed\r\n       cherrypy: Not Installed\r\n       dateutil: 2.4.2\r\n      docker-py: Not Installed\r\n          gitdb: 0.6.4\r\n      gitpython: 1.0.1\r\n          ioflo: Not Installed\r\n         Jinja2: 2.8\r\n        libgit2: Not Installed\r\n        libnacl: Not Installed\r\n       M2Crypto: Not Installed\r\n           Mako: 1.0.3\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.6\r\n   mysql-python: Not Installed\r\n      pycparser: Not Installed\r\n       pycrypto: 2.6.1\r\n   pycryptodome: Not Installed\r\n         pygit2: Not Installed\r\n         Python: 2.7.12 (default, Nov 20 2017, 18:23:56)\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 15.2.0\r\n           RAET: Not Installed\r\n          smmap: 0.9.0\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.1.4\r\n\r\nSystem Versions:\r\n           dist: Ubuntu 16.04 xenial\r\n         locale: UTF-8\r\n        machine: x86_64\r\n        release: 4.4.0-112-generic\r\n         system: Linux\r\n        version: Ubuntu 16.04 xenial\r\n```\r\n\r\nMinion:\r\n```\r\nSalt Version:\r\n               Salt: 2018.3.0\r\n\r\n    Dependency Versions:\r\n               cffi: Not Installed\r\n           cherrypy: Not Installed\r\n           dateutil: 2.4.2\r\n          docker-py: Not Installed\r\n              gitdb: Not Installed\r\n          gitpython: Not Installed\r\n              ioflo: Not Installed\r\n             Jinja2: 2.8\r\n            libgit2: Not Installed\r\n            libnacl: Not Installed\r\n           M2Crypto: Not Installed\r\n               Mako: 1.0.3\r\n       msgpack-pure: Not Installed\r\n     msgpack-python: 0.4.6\r\n       mysql-python: Not Installed\r\n          pycparser: Not Installed\r\n           pycrypto: 2.6.1\r\n       pycryptodome: Not Installed\r\n             pygit2: Not Installed\r\n             Python: 2.7.12 (default, Nov 20 2017, 18:23:56)\r\n       python-gnupg: Not Installed\r\n             PyYAML: 3.11\r\n              PyZMQ: 15.2.0\r\n               RAET: Not Installed\r\n              smmap: Not Installed\r\n            timelib: Not Installed\r\n            Tornado: 4.2.1\r\n                ZMQ: 4.1.4\r\n\r\n    System Versions:\r\n               dist: Ubuntu 16.04 xenial\r\n             locale: ascii\r\n            machine: x86_64\r\n            release: 4.4.0-116-generic\r\n             system: Linux\r\n            version: Ubuntu 16.04 xenial\r\n```"}}
{"actor":{"display_login":"NewEvolution"}}