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

Allow file.managed to work with uppercase source_hash in test=true mode #48422

Merged
merged 2 commits into from Jul 3, 2018

Conversation

Projects
None yet
2 participants
@rallytime
Contributor

rallytime commented Jul 3, 2018

What does this PR do?

Allows the user to pass a source_hash to file.managed that is case indifferent when using test=true.

Using an uppercase source_hash was fixed for normal file.managed execution in PR #40754 to fix #38914, but the test=true behavior still showed changes when using an uppercase source_hash.

What issues does this PR fix or reference?

Fixes #48230

Previous Behavior

Given the following test state:

# cat /srv/salt/test.sls
test1:
  file.managed:
    - name: /tmp/test1
    - source: /testing/tests/integration/files/file/base/hello_world.txt
    - source_hash: c98c24b677eff44860afea6f493bbaec5bb1c4cbb209c6fc2bbb47f66ff2ad31

test2:
  file.managed:
    - name: /tmp/test2
    - source: /testing/tests/integration/files/file/base/hello_world.txt
    - source_hash: C98C24B677EFF44860AFEA6F493BBAEC5BB1C4CBB209C6FC2BBB47F66FF2AD31

Previously, this would show that the file had changed:

# salt-call --local state.sls test test=true
local:
----------
          ID: test1
    Function: file.managed
        Name: /tmp/test1
      Result: True
     Comment: The file /tmp/test1 is in the correct state
     Started: 14:42:43.254849
    Duration: 18.324 ms
     Changes:
----------
          ID: test2
    Function: file.managed
        Name: /tmp/test2
      Result: None
     Comment: The file /tmp/test2 is set to be changed
     Started: 14:42:43.273313
    Duration: 3.627 ms
     Changes:
              ----------
              diff:

Summary for local
------------
Succeeded: 2 (unchanged=1, changed=1)
Failed:    0
------------
Total states run:     2
Total run time:  21.951 ms

New Behavior

Now, the state returns True, with no changes. This matches the regular behavior.

# salt-call --local state.sls test test=true
local:
----------
          ID: test1
    Function: file.managed
        Name: /tmp/test1
      Result: True
     Comment: The file /tmp/test1 is in the correct state
     Started: 14:41:45.302508
    Duration: 20.832 ms
     Changes:
----------
          ID: test2
    Function: file.managed
        Name: /tmp/test2
      Result: True
     Comment: The file /tmp/test2 is in the correct state
     Started: 14:41:45.323483
    Duration: 0.889 ms
     Changes:

Summary for local
------------
Succeeded: 2
Failed:    0
------------
Total states run:     2
Total run time:  21.721 ms

Tests written?

Yes

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

rallytime added some commits Jul 2, 2018

Add regression test for Issue #48230
This also tests the fix for issue #38914

@rallytime rallytime requested a review from saltstack/team-core Jul 3, 2018

@rallytime rallytime merged commit 4224415 into saltstack:2017.7 Jul 3, 2018

5 of 10 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #6209 — FAILURE
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #24137 — FAILURE
Details
default Build started sha1 is merged.
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #20262 — RUNNING
Details
WIP ready for review
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #26420 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #18457 — SUCCESS
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #11179 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #23092 — SUCCESS
Details

@rallytime rallytime deleted the rallytime:fix-48230 branch Jul 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment