[BUG] salt-ssh processing all gitfs refs regardless of saltenv settings
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
Setting up salt-ssh for the first time, the command appears to hang forever (5+ minutes). With trace logging enabled it seems to be in some sort of infinite loop.
The master is configured with multiple formulae as gitfs repos.
Setup
fileserver_backend:
- gitfs
gitfs_privkey: /etc/salt/master.d/salt-git-rsa
gitfs_pubkey: /etc/salt/master.d/salt-git-rsa.pub
gitfs_refspecs:
- '+refs/heads/*:refs/remotes/origin/*'
- '+refs/tags/*:refs/tags/*'
- '+refs/pull/*/head:refs/remotes/origin/pr/*'
- '+refs/pull/*/merge:refs/remotes/origin/merge/*'
gitfs_remotes:
- https://github.com/saltstack-formulas/apt-formula:
- all_saltenvs: v0.10.2
- https://github.com/saltstack-formulas/elasticsearch-formula:
- all_saltenvs: f70e9da
- https://github.com/saltstack-formulas/kibana-formula:
- all_saltenvs: merge/22
- https://github.com/saltstack-formulas/letsencrypt-formula:
- all_saltenvs: v2.0.0
- https://github.com/saltstack-formulas/logstash-formula:
- all_saltenvs: bab7586
- https://github.com/saltstack-formulas/openssh-formula:
- all_saltenvs: v2.0.6
- https://github.com/saltstack-formulas/ufw-formula:
- all_saltenvs: v0.5.7
- https://github.com/saltstack-formulas/zabbix-formula:
- all_saltenvs: v1.0.3
- git@bitbucket.org:myorg/saltstack.git:
- root: salt
state_top_saltenv: base
top_file_merging_strategy: same
myminion:
host: myminion.example.com
user: me
Steps to Reproduce the behavior
salt-ssh --askpass --key-deploy 'myminion' test.ping -ltrace
...
[TRACE] Lockfile /var/cache/salt/master/file_lists/gitfs/.pr_|-173.w created
[TRACE] Start rebuilding gitfs file_list cache
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/apt-formula duration=0.01137399673461914 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/elasticsearch-formula duration=0.0034940242767333984 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/kibana-formula duration=0.003408670425415039 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/letsencrypt-formula duration=0.014557361602783203 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/logstash-formula duration=0.0016510486602783203 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/openssh-formula duration=0.02264404296875 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/ufw-formula duration=0.01248621940612793 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/zabbix-formula duration=0.4704718589782715 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=git@bitbucket.org:sustainableroadfreight/saltstack.git duration=0.00020551681518554688 seconds
[TRACE] Lockfile /var/cache/salt/master/file_lists/gitfs/.pr_|-173.w removed
[TRACE] Finished rebuilding gitfs file_list cache
[DEBUG] Re-using gitfs object for process 1614953
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[DEBUG] Re-using gitfs object for process 1614953
[DEBUG] Re-using gitfs object for process 1614953
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[DEBUG] In saltenv 'pr/173', looking at rel_path '_modules/ufw.py' to resolve 'salt://_modules/ufw.py'
[DEBUG] In saltenv 'pr/173', ** considering ** path '/var/cache/salt/master/files/pr/173/_modules/ufw.py' to resolve 'salt://_modules/ufw.py'
[DEBUG] Re-using gitfs object for process 1614953
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[DEBUG] Re-using gitfs object for process 1614953
[DEBUG] Re-using gitfs object for process 1614953
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[DEBUG] In saltenv 'pr/173', looking at rel_path '_states/ufw.py' to resolve 'salt://_states/ufw.py'
[DEBUG] In saltenv 'pr/173', ** considering ** path '/var/cache/salt/master/files/pr/173/_states/ufw.py' to resolve 'salt://_states/ufw.py'
[DEBUG] Re-using gitfs object for process 1614953
[TRACE] Lockfile /var/cache/salt/master/file_lists/gitfs/.pr_|-27.w created
[TRACE] Start rebuilding gitfs file_list cache
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/apt-formula duration=0.009964942932128906 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/elasticsearch-formula duration=0.0029489994049072266 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/kibana-formula duration=0.0025043487548828125 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/letsencrypt-formula duration=0.009569644927978516 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/logstash-formula duration=0.0014698505401611328 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/openssh-formula duration=0.017264127731323242 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
[PROFILE] gitfs file_name cache rebuild repo=https://github.com/saltstack-formulas/ufw-formula duration=0.010399580001831055 seconds
[TRACE] Returning env cache data from /var/cache/salt/master/gitfs/envs.p
Exiting gracefully on Ctrl-c
Expected behavior
Command should proceed within a few seconds at most.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3002.5
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: 2.0.6
gitpython: 3.0.7
Jinja2: 2.10.1
libgit2: 0.28.3
M2Crypto: 0.31.0
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.6.1
pygit2: 1.0.3
Python: 3.8.5 (default, Jan 27 2021, 15:41:15)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: 2.0.5
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-67-generic
system: Linux
version: Ubuntu 20.04 focal
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin at the salt-ssh command path and gitfs file-list cache handling shown in the trace; inspect how saltenv settings and configured refspecs are selected. Reproduce with the supplied multi-repository configuration and trace logging, then verify the command completes within a few seconds without processing unrelated refs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- cli, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100