Skip to content
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

[BUG] git.latest function can fail if fetch_url is None #66537

Open
2 of 9 tasks
marinelay opened this issue May 17, 2024 · 1 comment
Open
2 of 9 tasks

[BUG] git.latest function can fail if fetch_url is None #66537

marinelay opened this issue May 17, 2024 · 1 comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@marinelay
Copy link

Description

salt/salt/states/git.py

Lines 1144 to 1158 in 551e7c4

if remote in remotes:
fetch_url = remotes[remote]["fetch"]
else:
log.debug("Remote '%s' not found in git checkout at %s", remote, target)
fetch_url = None
if remote_rev is not None and desired_fetch_url != fetch_url:
if __opts__["test"]:
actions = [
"Remote '{}' would be changed from {} to {}".format(
remote,
salt.utils.url.redact_http_basic_auth(fetch_url),
redacted_fetch_url,
)
]

I wonder that it is required to check fetch_url is None at line 1151 because the function redact_http_basic_auth at line 1155 does not allow None type and raises TypeError.
It is the result of my type checker, so I wanted to provide test cases but I couldn't.
If this is the correct behavior, I apologize for taking your time.

Setup
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • 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
  • classic packaging
  • onedir packaging
  • used bootstrap to install
@marinelay marinelay added Bug broken, incorrect, or confusing behavior needs-triage labels May 17, 2024
Copy link

welcome bot commented May 17, 2024

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant