Settings dump file creation¶
Description¶
How to create a settings dump file, having full configurator data.
All the following code must be executed from the root service directory (luna-configurator by default) and with activated virtualenv.
Get it from running Configurator¶
Using wget:
wget -O settings_dump.json 127.0.0.1:5070/1/dumpUsing curl:
curl 127.0.0.1:5070/1/dump > settings_dump.json
- Using text editor:
File must apply to the format of the following object:
JSON_dump_file
.
Settings dump file appliance¶
to create additional settings and limitations from the provided file, set dump-file command line argument (limitations from the listed limitation files are replaced with limitations from dump-file, if names of the limitations are same):
python base_scripts/db_create.py --dump-file dump_settings.jsonThis json file must contain
JSON_dump_file
:
- JSON_setting¶
- JSON_groups¶
- JSON_dump_file¶
- Object Properties:
limitations (_list_(
JSON_limitation
)) – list of limitations objectssettings (_list_(
JSON_setting
)) – list of settings objectsgroups (_list_(
JSON_groups
)) – list of groupsJSON-file example:
{ "limitations": [ { "limitation_name": "DEFAULT_IMAGE_EXTENSION", "validation_schema": { "type": "string", "enum": ["jpg", "png", "bmp"] }, "services": [ "luna-service" ], "default_value": "jpg", "description": "default image extension", "group_names": [ "luna-origin" ] } ], "settings": [ { "name": "DEFAULT_IMAGE_EXTENSION", "value": "jpg", "description": "default image extension", "tags": [] }, { "name": "DEFAULT_IMAGE_EXTENSION", "value": "bmp", "description": "data sharing extension", "tags": [ "default-image-extension" ] } ], "groups": [ { "group_name": "luna-origin", "description": "original platform group" } ] }
- Steps when creating/updating settings:
Load JSON data from dump-file and checking the schema for required fields
Validate limitations, for each limitation — default_value should be a valid under limitation validation_schema
Create groups if available
Create limitations and default settings
Add links to limitations on the group(s)
Validate user settings, for each setting — value should be valid under the limitation validation_schema from database
Update existing default settings in the database, if the tags are empty
Create new settings, if tags are specified (if there are settings with the same names and tags, the latter will be applied “sorted by alphabet”)
Error details can be found in the logs.
One has to restart affected services after settings dump file is applied.