saltstack / saltstack/salt

git.detached is always fired even when there are no changes

Open
#38,092 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Core pending-community-assignment severity-low State-Module
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue/Question

Using git.detached I expect this state not to be applied when working copy already has desired commit checked out. But it's triggered every time.

Setup

test-detached.sls:

https://github.com/Magomogo/days-interval:
  git.detached:
    - ref: 'v0.1.0'
    - target: /tmp/days-interval
Steps to Reproduce Issue

Execute this state:

$ salt-call state.apply test-detached
local:
----------
          ID: https://github.com/Magomogo/days-interval
    Function: git.detached
      Result: True
     Comment: Commit ID 5289e24094da8109f0e061c38ed601fa20201426 was checked out at /tmp/days-interval
     Started: 05:04:59.808246
    Duration: 1705.775 ms
     Changes:
              ----------
              HEAD:
                  ----------
                  new:
                      e7c9f32981ec807776b4e9d6cd9f59734c8c1e3b
                  old:
                      e7c9f32981ec807776b4e9d6cd9f59734c8c1e3b

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

### Versions Report

$ git --version
git version 2.1.4

$ sudo salt-call --versions-report
Salt Version:
Salt: 2016.11.0

Dependency Versions:
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 2.2
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.3
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5

System Versions:
dist: debian 8.6
machine: x86_64
release: 3.16.0-4-amd64
system: Linux
version: debian 8.6

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 issue with test-detached.sls and salt-call state.apply test-detached against the git.detached state. Verify the behavior when the desired commit is already checked out; done means the state reports no change and does not fire the detached action unnecessarily.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.