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

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