From de3d7526f25302667c5a2a6e7fbb0fa9f4531203 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sat, 4 Feb 2023 01:45:10 +0100 Subject: [PATCH] Check if isdir --- apollo/publishing_tools/apollo_tree.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apollo/publishing_tools/apollo_tree.py b/apollo/publishing_tools/apollo_tree.py index 2929ece..90cb63b 100644 --- a/apollo/publishing_tools/apollo_tree.py +++ b/apollo/publishing_tools/apollo_tree.py @@ -87,6 +87,10 @@ async def scan_path( logger.warning("Searching for arches in %s", repo_base) + if not os.path.isdir(repo_base): + logger.warning("Path is not a directory: %s, skipping", repo_base) + continue + # All dirs in repo_base is an architecture for arch_ in os.listdir(repo_base): if repo_first: @@ -260,12 +264,14 @@ async def update_repomd_xml(repomd_xml_path: str, updateinfo: dict): ) # Write to repomd.xml + logger.info("Writing to %s", repomd_xml_path) with open(repomd_xml_path, "w", encoding="utf-8") as f: f.write(xml_str) # Delete old updateinfo file if existing_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)