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