Skip to content

Commit

Permalink
Fix AttributeError: ENABLE_NVREA for reposync
Browse files Browse the repository at this point in the history
Co-authored-by: Dominik Gedon <[email protected]>
  • Loading branch information
agraul and nodeg committed Jul 25, 2024
1 parent 3426290 commit 8a62a3f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- fix `AttributeError: ENABLE_NVREA` for reposyncing (bsc#1226273)
28 changes: 12 additions & 16 deletions python/spacewalk/server/importlib/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from uyuni.common.usix import raise_with_tb
from uyuni.common import rhn_rpm
from spacewalk.common.rhnConfig import CFG
from spacewalk.common.rhnConfig import cfg_component
from spacewalk.common.rhnException import rhnFault
from spacewalk.common.rhnLog import log_debug
from spacewalk.satellite_tools import syncLib
Expand Down Expand Up @@ -171,11 +171,9 @@ def processCapabilities(self, capabilityHash):

# pylint: disable-next=invalid-name
def processChangeLog(self, changelogHash):
if (
CFG.has_key("package_import_skip_changelog")
and CFG.package_import_skip_changelog
):
return
with cfg_component(None) as cfg:
if cfg.get("package_import_skip_changelog"):
return None

if not changelogHash:
return
Expand Down Expand Up @@ -1123,12 +1121,9 @@ def processPackages(
"susePackageEula": "package_id",
"rhnPackageExtraTag": "package_id",
}

if (
CFG.has_key("package_import_skip_changelog")
and CFG.package_import_skip_changelog
):
del childTables["rhnPackageChangeLogRec"]
with cfg_component(None) as cfg:
if cfg.get("package_import_skip_changelog"):
del childTables["rhnPackageChangeLogRec"]

for package in packages:
if not isinstance(package, Package):
Expand Down Expand Up @@ -3295,10 +3290,11 @@ def _do_diff(self, data, table_name, uq_fields, fields):
def validate_pks(self):
# If nevra is enabled use checksum as primary key
tbs = self.tables["rhnPackage"]
if not CFG.ENABLE_NVREA:
# remove checksum from a primary key if nevra is disabled.
if "checksum_id" in tbs.pk:
tbs.pk.remove("checksum_id")
with cfg_component("server") as cfg:
if not cfg.ENABLE_NVREA:
# remove checksum from a primary key if nevra is disabled.
if "checksum_id" in tbs.pk:
tbs.pk.remove("checksum_id")


# Returns a tuple for the hash's values
Expand Down

0 comments on commit 8a62a3f

Please sign in to comment.