[BUG] git state module says could not resolve dns and fails
@frogunder is already working on this.
Since Mar 19, 2022.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
I have a basic state which calls the Nginx and PHP-FPM formulas to get them installed, then sets some firewall rules, then uses git.latest to pull in a git url. If I go to the command line and issue a "git clone url" it works fine, but running as salt state it fails. I've tried both different git hosted sites (GitLab and GitHub) and neither seem to matter. I've tested on Linode vm's, Parallells vm's, Virtualbox vm's, and even physical servers. Tested both in my work environment and my home lab. I've also tried disabling firewalld to see if that was blocking it, and that didn't help. Network firewalls are pretty basic, allow all outbound but limited inbound NATs.
If I run the state twice, the second time it always succeeds, but it always fails on the first attempt. I know in the past I've used syntax like this to pull in git repos, but never came across this error. DNS is correctly setup in all the different environments I've tested this. Any ideas?
Setup
Here is the roles.webserver.init.sls
include:
- core.packages
- core.users.user_www_data
- php.fpm
- core.services.firewalld
- nginx
webserver-firewalld-rules:
firewalld.present:
- name: public
- services:
- http
- https
- prune_services: False
webserver-firewalld-service:
service.running:
- name: firewalld
- reload: True
- watch:
- firewalld: public
webserver-www-content-download:
git.latest:
- name: https://gitlab.com/DevOpsClinic/sample-php-website.git
# - name: https://github.com/DevOps-Clinic/sample-php-website.git
- target: /var/www/html
- branch: main
Here is the core.packages.init.sls:
core-packages-install:
pkg.latest:
- pkgs:
- bash-completion
- bzip2
- curl
- epel-release
- git
- jq
- tmux
- unzip
- vim-minimal
- vim-common
- vim-enhanced
- wget
- zsh
core-packages-pygit:
pkg.latest:
- pkgs:
- python3-GitPython
- require:
- core-packages-install
From /var/log/salt/minion
Mar 19 12:59:37 minion1 salt-minion[946]: [ERROR ] Command 'git' failed with return code: 128
Mar 19 12:59:37 minion1 salt-minion[946]: [ERROR ] stderr: fatal: unable to access 'https://gitlab.com/DevOpsClinic/sample-php-website.git/': Could not resolve host: gitlab.com
Mar 19 12:59:37 minion1 salt-minion[946]: [ERROR ] retcode: 128
Mar 19 12:59:37 minion1 salt-minion[946]: [ERROR ] Failed to check remote refs: fatal: unable to access 'https://gitlab.com/DevOpsClinic/sample-php-website.git/': Could not resolve host: gitlab.com
Please be as specific as possible and give set-up details.
- both on prem and in home lab
- VM (Virtualbox, Parallels, Linode)
- Physical servers
- container: no container
- Rocky Linux 8.5 with latest updates and latest Salt
Steps to Reproduce the behavior
salt "minion1" state.apply
Expected behavior
I expect it to pull down the remote Git repo
Screenshots
See logs
Versions Report
Both master and minion are running same OS and same Salt version:
[root@minion1 ~]# salt-call test.versions_report
local:
Salt Version:
Salt: 3004
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 4.0.1
gitpython: 3.0.9
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Nov 9 2021, 14:44:26)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 19.0.0
smmap: 3.0.1
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: rocky 8.5 Green Obsidian
locale: UTF-8
machine: x86_64
release: 4.18.0-348.20.1.el8_5.x86_64
system: Linux
version: Rocky Linux 8.5 Green Obsidian
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.
Assessment
This issue has not been assessed yet.