pkgset: Skip adding modulemd if there is none
When libmodulemd is available, but the compose contains no modules, we don't want to add the modular metadata anywhere. This patch actually avoids a crash as `ModuleIndex.dump_to_string()` will return `None` if there is no data. JIRA: COMPOSE-3662 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
3097019338
commit
2dfb1cd4c8
@ -233,8 +233,12 @@ def add_modular_metadata(repo, repo_path, mod_index, log_file):
|
||||
"""Add modular metadata into a repository."""
|
||||
with temp_dir() as tmp_dir:
|
||||
modules_path = os.path.join(tmp_dir, "modules.yaml")
|
||||
data = mod_index.dump_to_string()
|
||||
if not data:
|
||||
# No data to include...
|
||||
return
|
||||
with open(modules_path, "w") as f:
|
||||
f.write(mod_index.dump_to_string())
|
||||
f.write(data)
|
||||
|
||||
cmd = repo.get_modifyrepo_cmd(
|
||||
os.path.join(repo_path, "repodata"),
|
||||
|
Loading…
Reference in New Issue
Block a user