add dummy sops manifest
This commit is contained in:
@@ -138,14 +138,17 @@ def encrypt_file(
|
|||||||
folder.mkdir(parents=True, exist_ok=True)
|
folder.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# hopefully /tmp is written to an in-memory file to avoid leaking secrets
|
# hopefully /tmp is written to an in-memory file to avoid leaking secrets
|
||||||
with NamedTemporaryFile(delete=False) as f:
|
with NamedTemporaryFile(delete=False) as dummy_manifest_file, NamedTemporaryFile(
|
||||||
|
delete=False
|
||||||
|
) as f:
|
||||||
try:
|
try:
|
||||||
with open(f.name, "w") as fd:
|
with open(f.name, "w") as fd:
|
||||||
if isinstance(content, str):
|
if isinstance(content, str):
|
||||||
fd.write(content)
|
fd.write(content)
|
||||||
else:
|
else:
|
||||||
shutil.copyfileobj(content, fd)
|
shutil.copyfileobj(content, fd)
|
||||||
args = ["sops"]
|
# we pass an empty manifest to pick up existing configuration of the user
|
||||||
|
args = ["sops", "--config", dummy_manifest_file.name]
|
||||||
for key in keys:
|
for key in keys:
|
||||||
args.extend(["--age", key])
|
args.extend(["--age", key])
|
||||||
args.extend(["-i", "--encrypt", str(f.name)])
|
args.extend(["-i", "--encrypt", str(f.name)])
|
||||||
|
|||||||
Reference in New Issue
Block a user