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

[master] Fix to git state module when calling git.config_get_regexp #54844

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion salt/states/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ def latest(name,
use_lfs = bool(
__salt__['git.config_get_regexp'](
r'filter\.lfs\.',
**{'global': True}))
**{'global': True, 'ignore_retcode': True}))
lfs_opts = {'identity': identity} if use_lfs else {}

if os.path.isfile(target):
Expand Down
23 changes: 22 additions & 1 deletion tests/integration/states/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from __future__ import absolute_import, print_function, unicode_literals
import functools
import inspect
import logging
import os
import shutil
import socket
Expand All @@ -15,7 +16,7 @@

# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.helpers import with_tempdir
from tests.support.helpers import with_tempdir, TestsLoggingHandler
from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.paths import TMP

Expand Down Expand Up @@ -172,6 +173,26 @@ def test_latest(self, target):
self.assertSaltTrueReturn(ret)
self.assertTrue(os.path.isdir(os.path.join(target, '.git')))

@with_tempdir(create=False)
def test_latest_config_get_regexp_retcode(self, target):
'''
git.latest
'''

log_format = '[%(levelname)-8s] %(jid)s %(message)s'
self.handler = TestsLoggingHandler(format=log_format,
level=logging.DEBUG)
ret_code_err = 'failed with return code: 1'
with self.handler:
ret = self.run_state(
'git.latest',
name=TEST_REPO,
target=target
)
self.assertSaltTrueReturn(ret)
self.assertTrue(os.path.isdir(os.path.join(target, '.git')))
assert any(ret_code_err in s for s in self.handler.messages) is False, False

@with_tempdir(create=False)
def test_latest_with_rev_and_submodules(self, target):
'''
Expand Down