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

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