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.
This commit is contained in:
Jacob Kozol 2020-05-22 19:11:46 +02:00 committed by David Rheinsberg
parent 89b9e541e2
commit 9cbedc0496

View file

@ -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: