scripts: add encrypt_file and passwords-for

This commit is contained in:
Franzi 2020-11-10 09:12:43 +01:00
parent 2e2c504111
commit ca922ef5f7
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 74 additions and 0 deletions

32
scripts/passwords-for Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env python3
from os import environ
from sys import argv
from bundlewrap.repo import Repository
from bundlewrap.utils import Fault
from bundlewrap.exceptions import FaultUnavailable
path = environ.get('BW_REPO_PATH', '.')
repo = Repository(path)
def print_faults(dictionary, keypath=[]):
for key, value in dictionary.items():
if isinstance(value, Fault):
try:
resolved_fault = value.value
except FaultUnavailable:
print('{}/{}: [permission denied]'.format('/'.join(keypath), key))
else:
if '\n' not in resolved_fault:
print('{}/{}: {}'.format('/'.join(keypath), key, value))
elif isinstance(value, dict):
print_faults(value, keypath=keypath+[key])
if len(argv) == 1:
print('node name missing')
exit(1)
node = repo.get_node(argv[1])
print_faults(node.metadata)