misc
Miscellaneous utilities.
DEFAULT_LOGGING
module-attribute
#
DEFAULT_LOGGING = load('---\nversion: 1\nformatters:\n simple_format:\n format: "%(asctime)s - %(levelname)s - %(filename)s:%(lineno)s - %(message)s"\n datefmt: "[%Y-%m-%d %H:%M:%S]"\n\nhandlers:\n console:\n class : logging.StreamHandler\n formatter: simple_format\n level : DEBUG\n\nloggers:\n fortimanager_template_sync:\n level: INFO\n\nroot:\n level: WARNING\n handlers: [console]\n')
find_all_vars #
Find all undeclared variables in the given template content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_content |
str
|
The content of the template. |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
set
|
A list of undeclared variables found in the template content. |
Source code in fortimanager_template_sync/misc.py
get_logging_config #
prepare logging config and convert it to dict
Source code in fortimanager_template_sync/misc.py
sanitize_variables #
De-dup and check variables, so they are unique in name and default value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variables |
List[Variable]
|
input list of variables |
required |
Returns:
Type | Description |
---|---|
List[Variable]
|
list of variables |
Raises:
Type | Description |
---|---|
FMGSyncVariableException
|
on variable definition problem |