Accepting request 1243318 from systemsmanagement:saltstack
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/1243318 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/salt?expand=0&rev=165
This commit is contained in:
commit
865f8fd32d
@ -1 +1 @@
|
||||
8f1380c684ce9206e70a536da663e053bfc125da
|
||||
633ae1a77542d6e3e978c5111c0727312c2cc03c
|
||||
|
79
enhance-find_json-garbage-filtering-bsc-1231605-688.patch
Normal file
79
enhance-find_json-garbage-filtering-bsc-1231605-688.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From a9505da8f4bb2f9a9ef4ee6832197f0749a2c2e6 Mon Sep 17 00:00:00 2001
|
||||
From: Marek Czernek <marek.czernek@suse.com>
|
||||
Date: Thu, 23 Jan 2025 17:34:48 +0100
|
||||
Subject: [PATCH] Enhance find_json garbage filtering (bsc#1231605)
|
||||
(#688)
|
||||
|
||||
* Enhance find_json garbage filtering
|
||||
|
||||
* Enhance error handling in transactional_update module
|
||||
---
|
||||
salt/modules/transactional_update.py | 2 +-
|
||||
salt/utils/json.py | 12 ++++++++++--
|
||||
tests/unit/utils/test_json.py | 5 +++++
|
||||
3 files changed, 16 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/salt/modules/transactional_update.py b/salt/modules/transactional_update.py
|
||||
index d6915475f5..32e1eb9cc4 100644
|
||||
--- a/salt/modules/transactional_update.py
|
||||
+++ b/salt/modules/transactional_update.py
|
||||
@@ -984,7 +984,7 @@ def call(function, *args, **kwargs):
|
||||
return local.get("return", local)
|
||||
else:
|
||||
return local
|
||||
- except ValueError:
|
||||
+ except (ValueError, AttributeError):
|
||||
return {"result": False, "retcode": 1, "comment": ret_stdout}
|
||||
finally:
|
||||
# Check if reboot is needed
|
||||
diff --git a/salt/utils/json.py b/salt/utils/json.py
|
||||
index 0845b64694..26cb38cdbe 100644
|
||||
--- a/salt/utils/json.py
|
||||
+++ b/salt/utils/json.py
|
||||
@@ -39,6 +39,7 @@ def find_json(raw):
|
||||
# Search for possible starts end ends of the json fragments
|
||||
for ind, _ in enumerate(lines):
|
||||
line = lines[ind].lstrip()
|
||||
+ line = line[0] if line else line
|
||||
if line == "{" or line == "[":
|
||||
starts.append((ind, line))
|
||||
if line == "}" or line == "]":
|
||||
@@ -61,10 +62,17 @@ def find_json(raw):
|
||||
working = "\n".join(lines[start : end + 1])
|
||||
try:
|
||||
ret = json.loads(working)
|
||||
+ return ret
|
||||
except ValueError:
|
||||
- continue
|
||||
- if ret:
|
||||
+ pass
|
||||
+ # Try filtering non-JSON text right after the last closing curly brace
|
||||
+ end_str = lines[end].lstrip()[0]
|
||||
+ working = "\n".join(lines[start : end]) + end_str
|
||||
+ try:
|
||||
+ ret = json.loads(working)
|
||||
return ret
|
||||
+ except ValueError:
|
||||
+ continue
|
||||
|
||||
# Fall back to old implementation for backward compatibility
|
||||
# excpecting json after the text
|
||||
diff --git a/tests/unit/utils/test_json.py b/tests/unit/utils/test_json.py
|
||||
index b123e7e884..5ea409a705 100644
|
||||
--- a/tests/unit/utils/test_json.py
|
||||
+++ b/tests/unit/utils/test_json.py
|
||||
@@ -109,6 +109,11 @@ class JSONTestCase(TestCase):
|
||||
ret = salt.utils.json.find_json(garbage_prepend_json)
|
||||
self.assertDictEqual(ret, expected_ret)
|
||||
|
||||
+ # Pre-pend garbage right after closing bracket of the JSON
|
||||
+ garbage_prepend_json = "{}{}".format(test_sample_json.rstrip(), LOREM_IPSUM)
|
||||
+ ret = salt.utils.json.find_json(garbage_prepend_json)
|
||||
+ self.assertDictEqual(ret, expected_ret)
|
||||
+
|
||||
# Test to see if a ValueError is raised if no JSON is passed in
|
||||
self.assertRaises(ValueError, salt.utils.json.find_json, LOREM_IPSUM)
|
||||
|
||||
--
|
||||
2.47.0
|
||||
|
73
fix-failed-to-stat-root-.gitconfig-issue-on-gitfs-bs.patch
Normal file
73
fix-failed-to-stat-root-.gitconfig-issue-on-gitfs-bs.patch
Normal file
@ -0,0 +1,73 @@
|
||||
From 0ef67b3a7ce03335f1bfc6545f851897e11f5795 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
|
||||
<psuarezhernandez@suse.com>
|
||||
Date: Wed, 29 Jan 2025 10:08:28 +0000
|
||||
Subject: [PATCH] Fix failed to stat '/root/.gitconfig' issue on gitfs
|
||||
(bsc#1230944) (bsc#1234881) (#699)
|
||||
|
||||
* Fix failed to stat '/root/.gitconfig' issue on gitfs (bsc#1230944) (bsc#1234881)
|
||||
|
||||
This commit ensures the right HOME value is set during Pygit2 remote
|
||||
initialization, otherwise there are chances that it gets a wrong value
|
||||
depending on the execution stack.
|
||||
|
||||
* Add changelog entry file
|
||||
|
||||
* Add test_checkout_pygit2_with_home_env_unset unit test
|
||||
---
|
||||
changelog/64121.fixed.md | 1 +
|
||||
salt/utils/gitfs.py | 9 +++++----
|
||||
tests/pytests/unit/utils/test_gitfs.py | 1 -
|
||||
3 files changed, 6 insertions(+), 5 deletions(-)
|
||||
create mode 100644 changelog/64121.fixed.md
|
||||
|
||||
diff --git a/changelog/64121.fixed.md b/changelog/64121.fixed.md
|
||||
new file mode 100644
|
||||
index 0000000000..e78bbd5b7f
|
||||
--- /dev/null
|
||||
+++ b/changelog/64121.fixed.md
|
||||
@@ -0,0 +1 @@
|
||||
+Ensure the right HOME environment value is set during Pygit2 remote initialization.
|
||||
diff --git a/salt/utils/gitfs.py b/salt/utils/gitfs.py
|
||||
index 58fa611db8..6f691f3869 100644
|
||||
--- a/salt/utils/gitfs.py
|
||||
+++ b/salt/utils/gitfs.py
|
||||
@@ -1889,7 +1889,12 @@ class Pygit2(GitProvider):
|
||||
"""
|
||||
# https://github.com/libgit2/pygit2/issues/339
|
||||
# https://github.com/libgit2/libgit2/issues/2122
|
||||
+ # https://github.com/saltstack/salt/issues/64121
|
||||
home = os.path.expanduser("~")
|
||||
+ if "HOME" not in os.environ:
|
||||
+ # Make sure $HOME env variable is set to prevent
|
||||
+ # _pygit2.GitError: error loading known_hosts in some libgit2 versions.
|
||||
+ os.environ["HOME"] = home
|
||||
pygit2.settings.search_path[pygit2.GIT_CONFIG_LEVEL_GLOBAL] = home
|
||||
new = False
|
||||
if not os.listdir(self._cachedir):
|
||||
@@ -1994,10 +1999,6 @@ class Pygit2(GitProvider):
|
||||
# pruning only available in pygit2 >= 0.26.2
|
||||
pass
|
||||
try:
|
||||
- # Make sure $HOME env variable is set to prevent
|
||||
- # _pygit2.GitError: error loading known_hosts in some libgit2 versions.
|
||||
- if "HOME" not in os.environ:
|
||||
- os.environ["HOME"] = salt.syspaths.HOME_DIR
|
||||
fetch_results = origin.fetch(**fetch_kwargs)
|
||||
except GitError as exc: # pylint: disable=broad-except
|
||||
exc_str = get_error_message(exc).lower()
|
||||
diff --git a/tests/pytests/unit/utils/test_gitfs.py b/tests/pytests/unit/utils/test_gitfs.py
|
||||
index bd7d74cb2b..3c4a85a856 100644
|
||||
--- a/tests/pytests/unit/utils/test_gitfs.py
|
||||
+++ b/tests/pytests/unit/utils/test_gitfs.py
|
||||
@@ -251,7 +251,6 @@ def test_checkout_pygit2_with_home_env_unset(_prepare_provider):
|
||||
with patched_environ(__cleanup__=["HOME"]):
|
||||
assert "HOME" not in os.environ
|
||||
provider.init_remote()
|
||||
- provider.fetch()
|
||||
assert "HOME" in os.environ
|
||||
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
26
salt.changes
26
salt.changes
@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 29 10:34:28 UTC 2025 - Pablo Suárez Hernández <psuarezhernandez@suse.com>
|
||||
|
||||
- Fix error to stat '/root/.gitconfig' on gitfs
|
||||
(bsc#1230944) (bsc#1234881)
|
||||
|
||||
- Added:
|
||||
* fix-failed-to-stat-root-.gitconfig-issue-on-gitfs-bs.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 27 11:04:02 UTC 2025 - Alexander Graul <alexander.graul@suse.com>
|
||||
|
||||
- Adapt to removal of hex attribute in pygit2 v1.15.0 (bsc#1230642)
|
||||
|
||||
- Added:
|
||||
* update-for-deprecation-of-hex-in-pygit2-1.15.0-and-a.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 23 16:44:42 UTC 2025 - Pablo Suárez Hernández <psuarezhernandez@suse.com>
|
||||
|
||||
- Enhance smart JSON parsing when garbage is present (bsc#1231605)
|
||||
|
||||
- Added:
|
||||
* enhance-find_json-garbage-filtering-bsc-1231605-688.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 22 13:11:21 UTC 2025 - Pablo Suárez Hernández <psuarezhernandez@suse.com>
|
||||
|
||||
@ -174,6 +199,7 @@ Mon Jul 8 16:02:47 UTC 2024 - Pablo Suárez Hernández <pablo.suarezhernandez@s
|
||||
Wed Jul 3 11:13:00 UTC 2024 - Flex Liu <fliu@suse.com>
|
||||
|
||||
- Fix performance of user.list_groups with many remote groups
|
||||
(bsc#1226964)
|
||||
|
||||
- Added:
|
||||
* fix-user.list_groups-omits-remote-groups.patch
|
||||
|
@ -503,6 +503,12 @@ Patch148: revert-setting-selinux-context-for-minion-service-bs.patch
|
||||
Patch149: fix-issues-that-break-salt-in-python-3.12-and-3.13-6.patch
|
||||
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/67181
|
||||
Patch150: fix-virtual-grains-for-vms-running-on-nutanix-ahv-bs.patch
|
||||
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/67023
|
||||
Patch151: enhance-find_json-garbage-filtering-bsc-1231605-688.patch
|
||||
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/67105
|
||||
Patch152: update-for-deprecation-of-hex-in-pygit2-1.15.0-and-a.patch
|
||||
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/67186
|
||||
Patch153: fix-failed-to-stat-root-.gitconfig-issue-on-gitfs-bs.patch
|
||||
|
||||
### IMPORTANT: The line below is used as a snippet marker. Do not touch it.
|
||||
### SALT PATCHES LIST END
|
||||
|
62
update-for-deprecation-of-hex-in-pygit2-1.15.0-and-a.patch
Normal file
62
update-for-deprecation-of-hex-in-pygit2-1.15.0-and-a.patch
Normal file
@ -0,0 +1,62 @@
|
||||
From 40a7163774879f8291f5d323944a65625a439712 Mon Sep 17 00:00:00 2001
|
||||
From: Joyeta Modak <joyeta.modak@suse.com>
|
||||
Date: Mon, 27 Jan 2025 16:19:45 +0530
|
||||
Subject: [PATCH] Update for deprecation of hex in pygit2 1.15.0 and
|
||||
above (bsc#1230642)
|
||||
|
||||
Co-authored-by: David Murphy <damurphy@vmware.com>
|
||||
---
|
||||
salt/utils/gitfs.py | 14 +++++++++-----
|
||||
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/salt/utils/gitfs.py b/salt/utils/gitfs.py
|
||||
index f3902c1f19a..58fa611db89 100644
|
||||
--- a/salt/utils/gitfs.py
|
||||
+++ b/salt/utils/gitfs.py
|
||||
@@ -1660,7 +1660,7 @@ class Pygit2(GitProvider):
|
||||
return None
|
||||
|
||||
try:
|
||||
- head_sha = self.peel(local_head).hex
|
||||
+ head_sha = str(self.peel(local_head).id)
|
||||
except AttributeError:
|
||||
# Shouldn't happen, but just in case a future pygit2 API change
|
||||
# breaks things, avoid a traceback and log an error.
|
||||
@@ -1721,7 +1721,10 @@ class Pygit2(GitProvider):
|
||||
self.repo.create_reference(local_ref, pygit2_id)
|
||||
|
||||
try:
|
||||
- target_sha = self.peel(self.repo.lookup_reference(remote_ref)).hex
|
||||
+ target_sha = str(
|
||||
+ self.peel(self.repo.lookup_reference(remote_ref)).id
|
||||
+ )
|
||||
+
|
||||
except KeyError:
|
||||
log.error(
|
||||
"pygit2 was unable to get SHA for %s in %s remote '%s'",
|
||||
@@ -1802,10 +1805,11 @@ class Pygit2(GitProvider):
|
||||
else:
|
||||
try:
|
||||
# If no AttributeError raised, this is an annotated tag
|
||||
- tag_sha = tag_obj.target.hex
|
||||
+ tag_sha = str(tag_obj.target.id)
|
||||
+
|
||||
except AttributeError:
|
||||
try:
|
||||
- tag_sha = tag_obj.hex
|
||||
+ tag_sha = str(tag_obj.id)
|
||||
except AttributeError:
|
||||
# Shouldn't happen, but could if a future pygit2
|
||||
# API change breaks things.
|
||||
@@ -2145,7 +2149,7 @@ class Pygit2(GitProvider):
|
||||
blob = None
|
||||
break
|
||||
if isinstance(blob, pygit2.Blob):
|
||||
- return blob, blob.hex, mode
|
||||
+ return blob, str(blob.id), mode
|
||||
return None, None, None
|
||||
|
||||
def get_tree_from_branch(self, ref):
|
||||
--
|
||||
2.48.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user