From c968d0d3f3016893c084f23db33b783a65c115b3 Mon Sep 17 00:00:00 2001 From: Mikhail Sandakov Date: Mon, 9 Dec 2024 15:44:13 +0200 Subject: [PATCH] Check if repository file exsists before extracting data from it --- pleskdistup/common/src/rpm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pleskdistup/common/src/rpm.py b/pleskdistup/common/src/rpm.py index eb295ab..ec423e8 100644 --- a/pleskdistup/common/src/rpm.py +++ b/pleskdistup/common/src/rpm.py @@ -45,6 +45,9 @@ def extract_repodata( mirrorlist: typing.Optional[str] = None additional: typing.List[str] = [] + if not os.path.exists(repofile): + raise FileNotFoundError(f"The repository file {repofile!r} does not exist") + with open(repofile, "r") as repo: for line in repo.readlines(): if line.startswith("["):