mirror of
https://git.isptech.ru/ISPsystem/isp-maintenance.git
synced 2025-09-13 15:03:09 +02:00
Update: dockerize app, rename pkg to mgrctl, fix imports
This commit is contained in:
0
mgrctl/utils/__init__.py
Normal file
0
mgrctl/utils/__init__.py
Normal file
23
mgrctl/utils/helpers.py
Normal file
23
mgrctl/utils/helpers.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
import sys
|
||||
import click
|
||||
|
||||
|
||||
def parse_json_file(file_path: str) -> dict:
|
||||
"""
|
||||
Function read json file as usual config.json then parse it to python dict
|
||||
|
||||
Args:
|
||||
config_file_path (str): path to config file
|
||||
|
||||
Returns:
|
||||
dict: contains parse json content
|
||||
"""
|
||||
try:
|
||||
with open(file_path, 'r') as f:
|
||||
return json.load(f)
|
||||
except Exception as error:
|
||||
click.echo(error)
|
||||
click.echo("Required: /opt/ispsystem/PLATFORM_TYPE/config.json")
|
||||
click.echo("Note: don't forget to mount this file into the container")
|
||||
sys.exit(1)
|
Reference in New Issue
Block a user