forked from ungleich-public/cdist
User defined processes are defined by new cdist beta command 'process'.
Processes can be defined in `process` subdirectory in `$HOME/.cdist` or
in custom directories specified through CDIST_PROCESS_PATH environment
variable.
`<path>/process` processes are defined in subdirectories, where a
directory must contain `__init__.py` file to be recognized as a process,
and it is then imported as a module.
Since scanning and registering processes happens before cdist arguments
are parsed, then standard cdist logging cannot be used in this stage.
This is why CDIST_PROCESS_DEBUG environemnt variable turns on debug
messages.
Dummy example (`~/.cdist/process/homeprocess/__init__.py`):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import subprocess
log = logging.getLogger(__name__)
def register(parent_parser):
parser = parent_parser.add_parser('cdist-help')
parser.set_defaults(func=cdist_help)
def cdist_help(args):
cmd = [ "cdist", "-h", ]
log.info("Running my process cdist help")
subprocess.check_call(cmd)
|
||
|---|---|---|
| .. | ||
| conf | ||
| core | ||
| exec | ||
| preos/debootstrap | ||
| sphinxext | ||
| test | ||
| util | ||
| __init__.py | ||
| argparse.py | ||
| autil.py | ||
| banner.py | ||
| config.py | ||
| configuration.py | ||
| emulator.py | ||
| flock.py | ||
| hostsource.py | ||
| info.py | ||
| install.py | ||
| integration.py | ||
| inventory.py | ||
| log.py | ||
| message.py | ||
| mputil.py | ||
| preos.py | ||
| process.py | ||
| shell.py | ||