SHA256
1
0
forked from pool/salt
salt/0013-Prevent-crash-if-pygit2-package-is-requesting-re-com.patch

87 lines
2.6 KiB
Diff
Raw Normal View History

Accepting request 391560 from systemsmanagement:saltstack:testing - Prevent crash if pygit2 package requests recompilation. Add: * 0013-Prevent-crash-if-pygit2-package-is-requesting-re-com.patch - Align OS grains from older SLES with the current one (bsc#975757) Add: * 0014-align-OS-grains-from-older-SLES-with-current-one-326.patch - remove patches which produce duplicate functions: Remove: * 0004-implement-version_cmp-for-zypper.patch * 0005-pylint-changes.patch * 0006-Check-if-rpm-python-can-be-imported.patch - remove patches which add and revert the same file Remove: * 0007-Initial-Zypper-Unit-Tests-and-bugfixes.patch * 0009-Bugfix-on-SLE11-series-base-product-reported-as-addi.patch - rename patches: 0008-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch to 0004-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch 0010-Use-SHA256-hash-type-by-default.patch to 0005-Use-SHA256-hash-type-by-default.patch 0011-Update-to-2015.8.8.2.patch to 0006-Update-to-2015.8.8.2.patch 0012-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch to 0007-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch 0013-Cleaner-deprecation-process-with-decorators.patch to 0008-Cleaner-deprecation-process-with-decorators.patch - fix sorting by latest package Add: * 0009-fix-sorting-by-latest-version-when-called-with-an-at.patch - Prevent metadata download when getting installed products Add: * 0010-Prevent-metadata-download-when-getting-installed-pro.patch - Check if EOL is available in a particular product (bsc#975093) Add: * 0011-Check-if-EOL-is-available-in-a-particular-product-bs.patch - Bugfix: salt-key crashes if tries to generate keys to the directory w/o write access (bsc#969320) Add: * 0012-Bugfix-salt-key-crashes-if-tries-to-generate-keys-to.patch - Deprecation process using decorators and re-implementation of status.update function. Add: * 0013-Cleaner-deprecation-process-with-decorators.patch - Reverted the fake 2015.8.8.2 patch, with the right one, - this patch only contains: - https://github.com/saltstack/salt/pull/32135 - https://github.com/saltstack/salt/pull/32023 - https://github.com/saltstack/salt/pull/32117 - Ensure that in case of multi-packages installed on the system, the latest is reported by pkg.info_installed (bsc#972490) Add: * 0012-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch - Update to the fake 2015.8.8.2 release upstream released a bunch of fixes on top of 2015.8.8, without creating a new tag and proper release. This commit includes all the changes between tag v2015.8.8 and commit ID 596444e2b447b7378dbcdfeb9fc9610b90057745 which introduces the fake 2015.8.8.2 release. see https://docs.saltstack.com/en/latest/topics/releases/2015.8.8.html#salt-2015-8-8-2 - Update to 2015.8.8 see https://docs.saltstack.com/en/latest/topics/releases/2015.8.8.html Patches renamed: * 0004-implement-version_cmp-for-zypper.patch * 0005-pylint-changes.patch * 0006-Check-if-rpm-python-can-be-imported.patch * 0007-Initial-Zypper-Unit-Tests-and-bugfixes.patch * 0008-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch * 0009-Bugfix-on-SLE11-series-base-product-reported-as-addi.patch * 0010-Use-SHA256-hash-type-by-default.patch Patches removed: * 0004-Fix-pkg.latest-prevent-crash-on-multiple-package-ins.patch * 0005-Fix-package-status-filtering-on-latest-version-and-i.patch * 0006-add_key-reject_key-do-not-crash-w-Permission-denied-.patch * 0007-Force-kill-websocket-s-child-processes-faster-than-d.patch * 0008-Fix-types-in-the-output-data-and-return-just-a-list-.patch * 0009-The-functions-in-the-state-module-that-return-a-retc.patch * 0010-add-handling-for-OEM-products.patch * 0011-improve-doc-for-list_pkgs.patch * 0012-implement-version_cmp-for-zypper.patch * 0013-pylint-changes.patch * 0014-Check-if-rpm-python-can-be-imported.patch * 0015-call-zypper-with-option-non-interactive-everywhere.patch * 0016-write-a-zypper-command-builder-function.patch * 0017-Fix-crash-with-scheduler-and-runners-31106.patch * 0018-unify-behavior-of-refresh.patch * 0019-add-refresh-option-to-more-functions.patch * 0020-simplify-checking-the-refresh-paramater.patch * 0021-do-not-change-kwargs-in-refresh-while-checking-a-val.patch * 0022-fix-argument-handling-for-pkg.download.patch * 0023-Initial-Zypper-Unit-Tests-and-bugfixes.patch * 0024-proper-checking-if-zypper-exit-codes-and-handling-of.patch * 0025-adapt-tests-to-new-zypper_check_result-output.patch * 0026-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch * 0027-make-suse-check-consistent-with-rh_service.patch * 0028-fix-numerical-check-of-osrelease.patch * 0029-Make-use-of-checksum-configurable-defaults-to-MD5-SH.patch * 0030-Bugfix-on-SLE11-series-base-product-reported-as-addi.patch * 0031-Only-use-LONGSIZE-in-rpm.info-if-available.-Otherwis.patch * 0032-Add-error-check-when-retcode-is-0-but-stderr-is-pres.patch * 0033-fixing-init-system-dectection-on-sles-11-refs-31617.patch * 0034-Fix-git_pillar-race-condition.patch * 0035-Fix-the-always-false-behavior-on-checking-state.patch * 0036-Use-SHA256-hash-type-by-default.patch OBS-URL: https://build.opensuse.org/request/show/391560 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=66
2016-04-28 09:26:14 +02:00
From f187ee058eb221eb5a34d51ca5db53bb8eeea5e1 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@maryniuk.net>
Date: Mon, 18 Apr 2016 16:25:05 +0200
Subject: [PATCH 13/14] Prevent crash if pygit2 package is requesting
re-compilation
* Prevent crash if pygit2 package is requesting re-compilation of the entire library on production systems (no *devel packages)
* Fix PEP8: move imports to the top of the file
* Move logger up
* Add log error message in case if exception is not an ImportError
---
salt/utils/gitfs.py | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/salt/utils/gitfs.py b/salt/utils/gitfs.py
index 164c92e..5452c28 100644
--- a/salt/utils/gitfs.py
+++ b/salt/utils/gitfs.py
@@ -19,6 +19,18 @@ import subprocess
import time
from datetime import datetime
+# Import salt libs
+import salt.utils
+import salt.utils.itertools
+import salt.utils.url
+import salt.fileserver
+from salt.utils.process import os_is_running as pid_exists
+from salt.exceptions import FileserverConfigError, GitLockError
+from salt.utils.event import tagify
+
+# Import third party libs
+import salt.ext.six as six
+
VALID_PROVIDERS = ('gitpython', 'pygit2', 'dulwich')
# Optional per-remote params that can only be used on a per-remote basis, and
# thus do not have defaults in salt/config.py.
@@ -54,16 +66,8 @@ _INVALID_REPO = (
'master to continue to use this {2} remote.'
)
-# Import salt libs
-import salt.utils
-import salt.utils.itertools
-import salt.utils.url
-import salt.fileserver
-from salt.exceptions import FileserverConfigError, GitLockError
-from salt.utils.event import tagify
+log = logging.getLogger(__name__)
-# Import third party libs
-import salt.ext.six as six
# pylint: disable=import-error
try:
import git
@@ -79,8 +83,13 @@ try:
GitError = pygit2.errors.GitError
except AttributeError:
GitError = Exception
-except ImportError:
- HAS_PYGIT2 = False
+except Exception as err: # cffi VerificationError also may happen
+ HAS_PYGIT2 = False # and pygit2 requrests re-compilation
+ # on a production system (!),
+ # but cffi might be absent as well!
+ # Therefore just a generic Exception class.
+ if not isinstance(err, ImportError):
+ log.error('Import pygit2 failed: {0}'.format(err))
try:
import dulwich.errors
@@ -93,8 +102,6 @@ except ImportError:
HAS_DULWICH = False
# pylint: enable=import-error
-log = logging.getLogger(__name__)
-
# Minimum versions for backend providers
GITPYTHON_MINVER = '0.3'
PYGIT2_MINVER = '0.20.3'
--
2.8.1