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
This commit is contained in:
Christian Kellner 2020-05-26 19:05:40 +02:00
parent 9a4f2e067c
commit 52237c4613
2 changed files with 37 additions and 1 deletions

View File

@ -8,12 +8,14 @@ Version: 15
%global pkgdir %{_prefix}/lib/%{pypi_name}
Name: %{pypi_name}
Release: 2%{?dist}
Release: 3%{?dist}
License: ASL 2.0
URL: %{forgeurl}
Source0: %{forgesource}
# PR416 (merged): https://github.com/osbuild/osbuild/pull/416
Patch0: sources-fix-break-when-secrets-is-None.patch
BuildArch: noarch
Summary: A build system for OS images
@ -65,6 +67,7 @@ to build OSTree based images.
%prep
%forgesetup
%patch0 -p1
%build
%py3_build
@ -130,6 +133,11 @@ exit 0
%{pkgdir}/stages/org.osbuild.rpm-ostree
%changelog
* Tue May 26 2020 Christian Kellner <ckellner@redhat.com> - 15-3
- 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
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 15-2
- Rebuilt for Python 3.9

View File

@ -0,0 +1,28 @@
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