-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions_containers.py
26 lines (20 loc) · 1.1 KB
/
functions_containers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from functions_files import get_plaintext_from_container_file
def get_container_content(container_file_name, container_password):
container_data = {}
container_content = ""
if container_file_name == "":
container_data = {'error': True, 'status': 'ERROR: Container name was not specified!'}
elif container_password == "":
container_data = {'error': True, 'status': 'ERROR: Container password is empty!'}
else:
try:
container_content = get_plaintext_from_container_file(container_file_name, container_password)
except:
container_data = {'error': True, 'status': 'ERROR: Container ' + container_file_name + ' is not found!'}
if container_content == "":
container_data = {'error': True, 'status': 'ERROR: Container ' + container_file_name + ' is empty!'}
else:
container_data = {'error': False, 'container_content': container_content,
'status': 'OK: Container ' + container_file_name + ' was loaded successfully'}
print(container_data['status'])
return(container_data)