sops: fix compatibility with new format
The new format can have null values now.
This commit is contained in:
@@ -449,15 +449,20 @@ def decrypt_file(secret_path: Path) -> str:
|
|||||||
|
|
||||||
def get_recipients(secret_path: Path) -> set[SopsKey]:
|
def get_recipients(secret_path: Path) -> set[SopsKey]:
|
||||||
sops_attrs = json.loads((secret_path / "secret").read_text())["sops"]
|
sops_attrs = json.loads((secret_path / "secret").read_text())["sops"]
|
||||||
return {
|
keys = set()
|
||||||
SopsKey(
|
for key_type in KeyType:
|
||||||
pubkey=recipient[key_type.sops_recipient_attr],
|
recipients = sops_attrs.get(key_type.name.lower())
|
||||||
username="",
|
if not recipients:
|
||||||
key_type=key_type,
|
continue
|
||||||
)
|
for recipient in recipients:
|
||||||
for key_type in KeyType
|
keys.add(
|
||||||
for recipient in sops_attrs[key_type.name.lower()] or []
|
SopsKey(
|
||||||
}
|
pubkey=recipient[key_type.sops_recipient_attr],
|
||||||
|
username="",
|
||||||
|
key_type=key_type,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return keys
|
||||||
|
|
||||||
|
|
||||||
def get_meta(secret_path: Path) -> dict:
|
def get_meta(secret_path: Path) -> dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user