dnf-plugin-spacewalk/dnf-plugin-spacewalk-2.8.5-8-el8-to-dnf-plugin-spacewalk-2.8.5-9-el8.patch

56 lines
2.4 KiB
Diff

diff --git a/dnf-plugin-spacewalk.spec b/dnf-plugin-spacewalk.spec
index 24a5b5d..fd42348 100644
--- a/dnf-plugin-spacewalk.spec
+++ b/dnf-plugin-spacewalk.spec
@@ -12,7 +12,7 @@
Summary: DNF plugin for Spacewalk
Name: dnf-plugin-spacewalk
Version: 2.8.5
-Release: 8%{?dist}
+Release: 9%{?dist}
License: GPLv2
Source0: https://github.com/spacewalkproject/spacewalk/archive/%{name}-%{version}.tar.gz
URL: https://github.com/spacewalkproject/spacewalk
@@ -113,6 +113,10 @@ install -m 644 actions/errata.py %{buildroot}%{python3_sitelib}/rhn/actions/
%endif
%changelog
+* Wed Dec 19 2018 Michael Mraka <michael.mraka@redhat.com> 2.8.5-9
+- Resolves: #1660552 - report and fail gracefully if not root
+- logger.warn() has been obsoleted
+
* Mon Dec 10 2018 Michael Mraka <michael.mraka@redhat.com> 2.8.5-8
- Resolves: #1637980 - use new api for http headers (michael.mraka@redhat.com)
diff --git a/spacewalk.py b/spacewalk.py
index 61bc5d8..1e60eef 100644
--- a/spacewalk.py
+++ b/spacewalk.py
@@ -49,6 +49,7 @@ UPDATES_FROM_SPACEWALK = _("This system is receiving updates from Spacewalk serv
GPG_KEY_REJECTED = _("For security reasons packages from Spacewalk based repositories can be verified only with locally installed gpg keys. GPG key '%s' has been rejected.")
PROFILE_NOT_SENT = _("Package profile information could not be sent.")
MISSING_HEADER = _("Missing required login information for Spacewalk: %s")
+MUST_BE_ROOT = _('Spacewalk plugin has to be run under with the root privileges.')
class Spacewalk(dnf.Plugin):
@@ -68,6 +69,9 @@ class Spacewalk(dnf.Plugin):
options = self.parser.items("main")
for (key, value) in options:
self.conf._set_value(key, value, PRIO_PLUGINCONFIG)
+ if not dnf.util.am_i_root():
+ logger.warning(MUST_BE_ROOT)
+ self.conf.enabled = False
if not self.conf.enabled:
return
logger.debug('initialized Spacewalk plugin')
@@ -222,7 +226,7 @@ class SpacewalkRepo(dnf.repo.Repo):
try:
self.gpgkey = get_gpg_key_urls(channel['gpg_key_url'])
except InvalidGpgKeyLocation as e:
- logger.warn(GPG_KEY_REJECTED, dnf.i18n.ucd(e))
+ logger.warning(GPG_KEY_REJECTED, dnf.i18n.ucd(e))
self.gpgkey = []
if channel['version'] != opts.get('cached_version'):
self.metadata_expire = 1