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)
PreOS code did not use configuration support. This fix adds support
for using cdist configuration, which takes into account cdist
configuration file, environment variables and command line options,
especially conf_dir.
It also adds support for -g, --config-file option, for specifying
custom configuration file.
This already takes care of setting up the base DN and managing it as well as
allowing for settings for the listener URLS.
The type was also made a singleton as it doesn't make much sense to setup
multiple LDAP servers on the same machine.
CDIST_ORDER_DEPENDENCY now defines type order dependency context.
cdist (emulator) maintains global state variables, as files,
order_dep_state and typeorder_dep, and per object state variable,
as file, typeorder_dep.
If order_dep_state exists then this defines that order dependency is
turned on.
If order_dep_state does not exist then order dependency is turned off.
If order dependency is on then objects created after it is turned on are
recorded into:
* global typeorder_dep, in case of init manifest
* object's typeorder_dep, in case of type's manifest.
If order dependency is on then requirement is injected, where object
created before current, is read from:
* global typeorder_dep, in case of init manifest
* object's typeorder_dep, in case of type's manifest.
Every time order dependency is turned off, typeorder_dep files are
removed, which means that type order list is cleared, context is
cleaned.
In the end cdist cleans after itself, i.e. mentioned files are removed.
When running type manifest is finished typeorder_dep file is removed.
When running config finishes global typeorder_dep and order_dep_state
files are removed.
Global type order recording is untouched.
Furthermore, for completeness, type order is now recorded for each object
too.