From 5c60d387d818db8268b595f0cd3abf6eaec3a037 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sat, 4 Feb 2023 10:27:13 +0100 Subject: [PATCH] Stop failing when old updateinfo doesn't exist --- apollo/publishing_tools/apollo_tree.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apollo/publishing_tools/apollo_tree.py b/apollo/publishing_tools/apollo_tree.py index 9020697..dc4c084 100644 --- a/apollo/publishing_tools/apollo_tree.py +++ b/apollo/publishing_tools/apollo_tree.py @@ -285,13 +285,14 @@ async def update_repomd_xml(repomd_xml_path: str, updateinfo: dict): f.write(xml_str) # Delete old updateinfo file if not the same as the new one - updinfo_base = os.path.basename(existing_updateinfo_path) - if existing_updateinfo_path and updinfo_base != updateinfo_path: - try: - logger.info("Deleting %s", existing_updateinfo_path) - os.remove(existing_updateinfo_path) - except FileNotFoundError: - logger.warning("File %s not found", existing_updateinfo_path) + if existing_updateinfo_path: + updinfo_base = os.path.basename(existing_updateinfo_path) + if updinfo_base != updateinfo_path: + try: + logger.info("Deleting %s", existing_updateinfo_path) + os.remove(existing_updateinfo_path) + except FileNotFoundError: + logger.warning("File %s not found", existing_updateinfo_path) async def run_apollo_tree(