feat: enhance 1Password lookup module to handle empty output and improve logging
Some checks failed
Nix Format Check / check-format (push) Failing after 38s

This commit is contained in:
Menno van Leeuwen 2025-03-11 20:22:17 +01:00
parent 97609e5578
commit 61f29fb7ba
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE

View File

@ -70,7 +70,13 @@ class LookupModule(LookupBase):
text=True,
check=True
)
return [result.stdout.strip()]
output = result.stdout.strip()
display.vvv(f"1Password output for ref '{ref}': '{output}'")
if not output:
display.warning(f"1Password returned empty output for ref '{ref}'")
return [output]
except subprocess.CalledProcessError as e:
error_msg = e.stderr.strip()
display.warning(f"Error executing 1Password CLI: {error_msg}")