Skip to content

[REGRESSION] --output-diff doesn't display changes anymore with test=True since v2019.2.0 #51932

Closed

Description

@tomlaredo

Description of Issue/Question

--output-diff doesn't display changes anymore with test=True since v2019.2.0

Setup

# cat state.sls 
/tmp/dest_file.txt:
    file.managed:
        - source: /tmp/source_file.txt

Steps to Reproduce Issue

Initial setup

echo new_content > /tmp/source_file.txt
echo old_content > /tmp/dest_file.txt

With test=True

# salt-call state.apply state --output-diff test=True
[INFO    ] Got list of available master addresses: [u'salt-master', u'localhost']
[INFO    ] Loading fresh modules for state activity
[INFO    ] Running state [/tmp/dest_file.txt] at time 16:36:21.779602
[INFO    ] Executing state file.managed for [/tmp/dest_file.txt]
[INFO    ] The file /tmp/dest_file.txt is set to be changed
[INFO    ] Completed state [/tmp/dest_file.txt] at time 16:36:21.797227 (duration_in_ms=17.626)
local:
----------
          ID: /tmp/dest_file.txt
    Function: file.managed
      Result: None
     Comment: The file /tmp/dest_file.txt is set to be changed
     Started: 16:36:21.779601
    Duration: 17.626 ms
     Changes:   

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

Diff isn't displayed anymore.

Without test=True

vs-salt-master:/srv/salt# salt-call state.apply state --output-diff
[INFO    ] Got list of available master addresses: [u'salt-master', u'localhost']
[INFO    ] Loading fresh modules for state activity
[INFO    ] Running state [/tmp/dest_file.txt] at time 16:36:29.781272
[INFO    ] Executing state file.managed for [/tmp/dest_file.txt]
[INFO    ] File changed:
--- 
+++ 
@@ -1 +1 @@
-old_content
+new_content

[INFO    ] Completed state [/tmp/dest_file.txt] at time 16:36:29.800569 (duration_in_ms=19.296)
local:
----------
          ID: /tmp/dest_file.txt
    Function: file.managed
      Result: True
     Comment: File /tmp/dest_file.txt updated
     Started: 16:36:29.781273
    Duration: 19.296 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -1 +1 @@
                  -old_content
                  +new_content

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

Diff is displayed.

Versions Report

# salt-call --versions-report
Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: 3.5.0
       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: 0.24.0
           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.8 
         locale: UTF-8
        machine: x86_64
        release: 4.15.18-9-pve
         system: Linux
        version: debian 9.8 

Activity

  1. added this to the Blocked milestone on Mar 4, 2019
  2. added
    pending-discussion
    on Mar 4, 2019
  3. garethgreenaway commented on Mar 4, 2019

    @garethgreenaway
    Contributor

    @saltstack/team-core Thoughts?

  4. thatch45 commented on Mar 4, 2019

    @thatch45
    Contributor

    We have gone back and forth on this one a lot over the years. The core argument has been that the changes dict should only have changes in it if changes actually happened. Thats why it keeps getting pulled out. The main argument is that this is the expected behavior.

    The counter argument is that this is some very valuable information to have from a test=True run and that it should be made available.

    The counter/counter to that is that we don't have the ability to get predictive changes out of all states, therefore the output becomes inconsistent.

    Finally, it can also be argued that if the result is None then we should know for sure that we did not make changes, so any changes in the changes dict can be seen as predictive.

  5. garethgreenaway commented on Mar 4, 2019

    @garethgreenaway
    Contributor

    Brief discussion between @thatch45 @waynew and myself, we concluded that the diff should be shown and we'll look to see what changed from 2018.3.x to 2019.2.x to disable this.

  6. thatch45 commented on Mar 4, 2019

    @thatch45
    Contributor

    Agreed, and when we get it back, lets add a fat comment in there to keep it :)

  7. tomlaredo commented on Mar 5, 2019

    @tomlaredo
    Author

    Thanks for those informations and for your reactivity.

    Even if test=True isn't perfect and could miss some changes (generally due to triggers like watch / watch_in etc.), it is a huge help for the one who needs to check some particular changes instead of blindly applying states and just hope changes will be good.
    A note could be displayed on test=True telling the user that changes are juste there for information and can be wrong in certain cases.

  8. waynew commented on Mar 5, 2019

    @waynew
    Contributor

    I'm a fan of adding a note in there, maybe something like Comment: File /tmp/dest_file.txt updated. Note: Actual changes may be different due to other states.

  9. added
    bug
    severity-medium
    severity-critical
    P2
    v2019.2.1
    and removed
    pending-discussion
    on Mar 5, 2019
  10. 58 remaining items

  11. removed
    Aluminium
    on Dec 8, 2020
  12. sagetherage commented on Dec 8, 2020

    @sagetherage
    Contributor

    removing this from a release cycle until unblocked

  13. added
    severity-medium
    and removed
    severity-high
    on Dec 8, 2020
  14. self-assigned this
    on Dec 10, 2020
  15. wwalker commented on Dec 16, 2020

    @wwalker

    @sagetherage what is the blocker on this bug? I would love to see it fixed. Anything I can do to help unBlock it?

  16. added
    ZD
    on Dec 16, 2020
  17. oeuftete commented on Dec 16, 2020

    @oeuftete
    Contributor

    @wwalker @sagetherage I'm going to dig in here to sort out where the issue stands.

  18. oeuftete commented on Jan 4, 2021

    @oeuftete
    Contributor

    AFAICT, this is resolved in minions ≥ 2019.2.1, as noted in #51932 (comment).

    It's possible the issue is still being seen based on an assumption that the master version matters here. It does not, the behaviour here is fully driven by the minions. Here's an example with a 3002.2 master with a 2018.3.5 minion (old) and a 3002.2 minion (master1).

    # salt '*' state.apply gh51932.test test=True
    old:
    ----------
              ID: /tmp/dest_file.txt
        Function: file.managed
          Result: None
         Comment: The file /tmp/dest_file.txt is set to be changed
         Started: 23:35:59.480332
        Duration: 12.141 ms
         Changes:   
    
    Summary for old
    ------------
    Succeeded: 1 (unchanged=1)
    Failed:    0
    ------------
    Total states run:     1
    Total run time:  12.141 ms
    
    master1:
    ----------
              ID: /tmp/dest_file.txt
        Function: file.managed
          Result: None
         Comment: The file /tmp/dest_file.txt is set to be changed
                  Note: No changes made, actual changes may
                  be different due to other states.
         Started: 23:36:00.331591
        Duration: 8.46 ms
         Changes:   
                  ----------
                  diff:
                      --- 
                      +++ 
                      @@ -1 +1 @@
                      -dest
                      +source
    
    Summary for master1
    ------------
    Succeeded: 1 (unchanged=1, changed=1)
    Failed:    0
    ------------
    Total states run:     1
    Total run time:   8.460 ms
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

RegressionZDbugneeds-more-infoseverity-medium

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions