script changes

This commit is contained in:
cswimr 2024-11-22 10:35:19 -05:00
parent 1745e834af
commit eaa112e0a8
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
2 changed files with 11 additions and 11 deletions

View file

@ -30,8 +30,14 @@ def notify(
def read_secret_file(secret: str) -> str:
path = f"/run/secrets/{secret}"
if not os.path.exists(path):
raise FileNotFoundError(f"Secret file {path} does not exist.")
with open(f"/run/secrets/{secret}", "r") as f:
return f.read().strip()
secret = f.read().strip()
if not secret:
raise ValueError(f"Secret file {path} is empty.")
return secret
def does_desktop_entry_exist(desktop_entry: str) -> bool: