procman.utils module
procman utils for file handling and config parsing.
- class procman.utils.MyYAML(**kwargs)[source]
Bases:
YAMLSimple YAML subclass with default indenting. Useful in old RHEL environments with
ruamel.yaml==0.16.6.
- procman.utils.get_env_prefix()[source]
Get user-supplied prefix from environment and expand it when used in
get_userscripts.- Returns:
prefix path
- Return type:
str
- procman.utils.get_userscripts(usr_cfg, usr_file, demo_mode=False)[source]
Get user scripts from Munchified user cfg.
- Parameters:
usr_cfg (Munch) – user configuration
usr_file (Path) – user config file
demo_mode (bool) – run example scripts (self-test)
- Returns:
list of lists with user scripts
- Return type:
List[List[str]]
- procman.utils.load_base_config()[source]
Load initial procman config with our baseline example values. This is used to both run the example flask app and provide a user-facing example configuration.
- Returns:
Munch config obj
- Return type:
Munch
- procman.utils.load_config(ufile='', file_extension='.yaml')[source]
Load yaml configuration file and munchify the data. If ENV path or local file is not found in current directory, the default cfg will be loaded. Note that passing
ufileas a parameter overrides the above default.- Parameters:
ufile (str) – path string for config file
file_extension (str) – file extension with leading separator
- Returns:
cfg Munch and file Path
- Raises:
FileTypeError – if the input file is not yml
- Return type:
Tuple[Munch, Path]