Skip to content

Commit

Permalink
Ignore buildorder parsing errors when parsing entries in module metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
cbbayburt committed Sep 11, 2024
1 parent f4dcd5d commit 536a73f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
32 changes: 27 additions & 5 deletions python/spacewalk/satellite_tools/appstreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,40 @@ def import_module_metadata(self):
rhnSQL.commit()
log(2, f"{no_total_added} of {no_total_pkgs} packages matched.")

@staticmethod
def _is_fatal(failures):
for f in failures:
fatal = True
err = f.get_gerror()
# Ignore known, safe cases
if "buildorder" in err.message and 3 == err.code:
# Failed to parse the 'buildorder' value (bsc#1230274)
fatal = False

# Add more conditions to ignore additional known cases

if fatal:
return True
return False

def _index_modulemd(self):
"""Indexes the Modulemd file."""
idx = Modulemd.ModuleIndex.new()
try:
# The following returns a tuple in the following format: (success, [failures])
result = idx.update_from_file(self.modulemd_file, False)
if not result[0]:
# Parsing error in a YAML subdocument
raise ModuleMdIndexingError(
"An error occurred while indexing a module entry:",
[f.get_gerror().message for f in result[1]],
)
# Errors in a YAML subdocument
if self._is_fatal(result[1]):
raise ModuleMdIndexingError(
"Indexing failed due to one of the following errors:",
[str(f.get_gerror()) for f in result[1]],
)
else:
log(1, "Following error(s) occurred while indexing module entries:")
for e in result[1]:
log(1, f" {e.get_gerror()}")

except gi.repository.GLib.GError as e:
# General parsing error in file
raise ModuleMdIndexingError(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Ignore minor errors when parsing entries in module metadata

0 comments on commit 536a73f

Please sign in to comment.