Check if isdir

This commit is contained in:
Mustafa Gezen 2023-02-04 01:45:10 +01:00
parent c64f9621fa
commit de3d7526f2
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1

View File

@ -87,6 +87,10 @@ async def scan_path(
logger.warning("Searching for arches in %s", repo_base) 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 # All dirs in repo_base is an architecture
for arch_ in os.listdir(repo_base): for arch_ in os.listdir(repo_base):
if repo_first: if repo_first:
@ -260,12 +264,14 @@ async def update_repomd_xml(repomd_xml_path: str, updateinfo: dict):
) )
# Write to repomd.xml # Write to repomd.xml
logger.info("Writing to %s", repomd_xml_path)
with open(repomd_xml_path, "w", encoding="utf-8") as f: with open(repomd_xml_path, "w", encoding="utf-8") as f:
f.write(xml_str) f.write(xml_str)
# Delete old updateinfo file # Delete old updateinfo file
if existing_updateinfo_path: if existing_updateinfo_path:
try: try:
logger.info("Deleting %s", existing_updateinfo_path)
os.remove(existing_updateinfo_path) os.remove(existing_updateinfo_path)
except FileNotFoundError: except FileNotFoundError:
logger.warning("File %s not found", existing_updateinfo_path) logger.warning("File %s not found", existing_updateinfo_path)