44 lines
1.7 KiB
Diff
44 lines
1.7 KiB
Diff
|
From 815bc8d1bf8f0811d7583ffeebfad463cb481354 Mon Sep 17 00:00:00 2001
|
||
|
From: Sanne Raymaekers <sanne.raymaekers@gmail.com>
|
||
|
Date: Fri, 3 Sep 2021 19:27:10 +0200
|
||
|
Subject: [PATCH] util/rhsm: Check if repositories is None before iterating
|
||
|
|
||
|
When `get_fallback_rhsm_secrets` was used, `Subscriptions.repositories`
|
||
|
was None, and `get_secrets` never returned the fallback secrets.
|
||
|
|
||
|
So check if `repositories` is None before
|
||
|
iterating over it, otherwise return the fallback secrets.
|
||
|
---
|
||
|
osbuild/util/rhsm.py | 15 ++++++++-------
|
||
|
1 file changed, 8 insertions(+), 7 deletions(-)
|
||
|
|
||
|
diff --git a/osbuild/util/rhsm.py b/osbuild/util/rhsm.py
|
||
|
index 21a2d50..3ab1729 100644
|
||
|
--- a/osbuild/util/rhsm.py
|
||
|
+++ b/osbuild/util/rhsm.py
|
||
|
@@ -93,13 +93,14 @@ class Subscriptions:
|
||
|
|
||
|
def get_secrets(self, url):
|
||
|
# Try to find a matching URL from redhat.repo file first
|
||
|
- for parameters in self.repositories.values():
|
||
|
- if parameters["matchurl"].match(url) is not None:
|
||
|
- return {
|
||
|
- "ssl_ca_cert": parameters["sslcacert"],
|
||
|
- "ssl_client_key": parameters["sslclientkey"],
|
||
|
- "ssl_client_cert": parameters["sslclientcert"]
|
||
|
- }
|
||
|
+ if self.repositories is not None:
|
||
|
+ for parameters in self.repositories.values():
|
||
|
+ if parameters["matchurl"].match(url) is not None:
|
||
|
+ return {
|
||
|
+ "ssl_ca_cert": parameters["sslcacert"],
|
||
|
+ "ssl_client_key": parameters["sslclientkey"],
|
||
|
+ "ssl_client_cert": parameters["sslclientcert"]
|
||
|
+ }
|
||
|
|
||
|
# In case there is no matching URL, try the fallback
|
||
|
if self.secrets:
|
||
|
--
|
||
|
2.21.1 (Apple Git-122.3)
|
||
|
|