osbuild/sources-fix-break-when-secrets-is-None.patch
Christian Kellner 52237c4613 Patch added to allow new files source format
Add a patch to allow org.osbuild.files source in the new format
but without actually containing the secrets key.
Taken from merged PR: https://github.com/osbuild/osbuild/pull/416
2020-05-26 19:08:15 +02:00

29 lines
1.2 KiB
Diff

From 9cbedc049671bf2a2eb50caa2759d91acbf7c7f5 Mon Sep 17 00:00:00 2001
From: Jacob Kozol <jacobdkozol@gmail.com>
Date: Fri, 22 May 2020 19:11:46 +0200
Subject: [PATCH] sources: fix break when secrets is None
When the urls' secrets field is not set, an error is thrown when trying
to get the name of the secrets. The secrets now have a default value of
{} when they are checked for the name.
---
sources/org.osbuild.files | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sources/org.osbuild.files b/sources/org.osbuild.files
index 0444d59..34d5334 100755
--- a/sources/org.osbuild.files
+++ b/sources/org.osbuild.files
@@ -110,7 +110,7 @@ def main(options, checksums, cache, output):
try:
if isinstance(urls[checksum], dict):
# check if url needs rhsm secrets
- if urls[checksum].get("secrets").get("name") == "org.osbuild.rhsm":
+ if urls[checksum].get("secrets", {}).get("name") == "org.osbuild.rhsm":
# rhsm secrets only need to be retrieved once and can then be reused
if rhsm_secrets is None:
try:
--
2.26.2