Skip to content

Commit

Permalink
Check if repository file exsists before extracting data from it
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sandakov committed Dec 10, 2024
1 parent 8ff8354 commit c968d0d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pleskdistup/common/src/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("["):
Expand Down

0 comments on commit c968d0d

Please sign in to comment.