saltstack / saltstack/salt

[BUG] Salt-ssh file.managed always updating even no changes

Open
#62,081 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage Salt-SSH
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
file.managed updating file even there's no changes.

I have simple file that uses .repo file from http source.

Setup Docker-ce yum repository:
file.managed:
- name: /etc/yum.repos.d/docker-ce.repo
- source: https://download.docker.com/linux/centos/docker-ce.repo
- skip_verify: True
- user: root
- group: root
- mode: 644
- show_changes: False

Setup

salt-ssh 3004.1

  • on-prem machine
  • VM (Virtualbox, Centos7)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD

Steps to Reproduce the behavior
Running this state (state-apply) I always get:

          ID: Setup Docker-ce yum repository
    Function: file.managed
        Name: /etc/yum.repos.d/docker-ce.repo
      Result: True
     Comment: File /etc/yum.repos.d/docker-ce.repo updated
     Started: 17:18:39.659514
    Duration: 230.587 ms
     Changes:
              ----------
              diff:
                  <show_changes=False>

Now, interesting fact is if I run state.apply test=True I get this:

          ID: Setup Docker-ce yum repository
    Function: file.managed
        Name: /etc/yum.repos.d/docker-ce.repo
      Result: True
     Comment: The file /etc/yum.repos.d/docker-ce.repo is in the correct state
     Started: 17:21:46.929919
    Duration: 235.463 ms
     Changes:

For local sources this works fine. I have another state that uses http, with difference that it uses source_hash, and that one works fine. But if I remove source_hash (and I need to add skip_verify: True) that one updates file as well.

Expected behavior
If no changes, file.managed should not update.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report salt-ssh --version salt-ssh 3004.1
PASTE HERE

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the salt-ssh 3004.1 file.managed state with the HTTP source, first using state.apply and then test=True, and compare the reported changes. Investigate the file.managed handling of remote sources without source_hash; done means an unchanged /etc/yum.repos.d/docker-ce.repo is not reported as updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.