univention.config_registry package
Contents
univention.config_registry package¶
Univention Configuration Registry module.
- univention.config_registry.ucr_factory()[source]¶
Factory method to return private loaded UCR instance.
- Returns
A private UCR instance.
Submodules¶
univention.config_registry.backend module¶
Univention Configuration Registry backend for data storage.
- exception univention.config_registry.backend.StrictModeException[source]¶
Bases:
Exception
Attempt to store non-UTF-8 characters in strict UTF-8 mode.
- univention.config_registry.backend.exception_occured(out=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>)[source]¶
Print exception message and exit.
- Parameters
out – Output stream for message.
- class univention.config_registry.backend.ConfigRegistry(filename='', write_registry=1)[source]¶
Bases:
univention.config_registry.backend.ReadOnlyConfigRegistry
,collections.abc.MutableMapping
Merged persistent value store. This is a merged view of several sub-registries.
- Parameters
filename – File name for custom layer text database file.
write_registry – The UCR level used for writing.
univention.config_registry.filters module¶
Univention Configuration Registry output filters.
- univention.config_registry.filters.filter_shell(args, text)[source]¶
Filter output for shell: escape keys.
- Parameters
args – UNUSED.
text – Text as list of lines.
- Returns
Filteres list of lines.
univention.config_registry.frontend module¶
Univention Configuration Registry command line implementation.
- exception univention.config_registry.frontend.UnknownKeyException(value)[source]¶
Bases:
Exception
Query for unknown key: no info file nor set.
- univention.config_registry.frontend.handler_set(args, opts={}, quiet=False)[source]¶
Set config registry variables in args. Args is an array of strings ‘key=value’ or ‘key?value’.
- Parameters
args – Command line arguments.
opts – Command line options.
quiet – Hide output.
- univention.config_registry.frontend.handler_unset(args, opts={})[source]¶
Unset config registry variables in args.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_dump(args, opts={})[source]¶
Dump all variables.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_update(args, opts={})[source]¶
Update handlers.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_commit(args, opts={})[source]¶
Commit all registered templated files.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_register(args, opts={})[source]¶
Register new .info file.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_unregister(args, opts={})[source]¶
Unregister old .info file.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_filter(args, opts={})[source]¶
Run filter on STDIN to STDOUT.
- univention.config_registry.frontend.handler_search(args, opts={})[source]¶
Search for registry variable.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_get(args, opts={})[source]¶
Return config registry variable.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_info(args, opts={})[source]¶
Print variable info.
- Parameters
args – Command line arguments.
opts – Command line options.
- univention.config_registry.frontend.handler_version(args, opts={})[source]¶
Print version info.
- Parameters
args – Command line arguments.
opts – Command line options.
univention.config_registry.handler module¶
Univention Configuration Registry handlers.
- class univention.config_registry.handler.ConfigHandlers[source]¶
Bases:
object
Manage handlers for configuration variables.
- CACHE_FILE = '/var/cache/univention-config/cache'¶
- VERSION = 3¶
- VERSION_MIN = 3¶
- VERSION_MAX = 3¶
- VERSION_TEXT = 'univention-config cache, version'¶
- VERSION_NOTICE = 'univention-config cache, version 3\n'¶
- VERSION_RE = re.compile('^univention-config cache, version (?P<version>[0-9]+)$')¶
- get_handler(entry)[source]¶
Parse entry and return Handler instance.
- Parameters
entry – .info file entry dictionary.
- Returns
An instance of None.
- update_divert(handlers)[source]¶
Synchronize diversions with handlers.
- Parameters
handlers – List of handlers.
- register(package, ucr)[source]¶
Register new info file for package.
- Parameters
package – Name of the package to register.
ucr – UCR instance.
- Returns
Set of (new) handlers.
- unregister(package, ucr)[source]¶
Un-register info file for package.
- Parameters
package – Name of the package to un-register.
ucr – UCR instance.
- Returns
Set of (then obsolete) handlers.
univention.config_registry.interfaces module¶
Handle UCR network configuration.
- univention.config_registry.interfaces.forgiving(translation=None)[source]¶
Decorator to translate exceptions into return values.
- Parameters
translation – Mapping from Exception class to return value.
- univention.config_registry.interfaces.cmp_alnum(value)[source]¶
Sort value split by digits / non-digits.
- Parameters
value – The value to sort.
- Returns
value split into tuple.
- class univention.config_registry.interfaces.Interfaces(ucr=None)[source]¶
Bases:
object
Handle network interfaces configured by UCR.
- Parameters
ucr – UCR instance.
- property all_interfaces¶
Yield IPv4 interfaces.
- property ipv4_interfaces¶
Yield IPv4 interfaces.
- property ipv6_interfaces¶
Yield names of IPv6 interfaces.
univention.config_registry.misc module¶
Univention Configuration Registry helper functions.
- univention.config_registry.misc.replace_dict(line, dictionary)[source]¶
Map any character from line to its value from dictionary.
>>> replace_dict('kernel', {'e': 'E', 'k': '', 'n': 'pp'}) 'ErppEl'
- univention.config_registry.misc.replace_umlaut(line)[source]¶
Replace german umlauts.
>>> replace_umlaut(u'überschrieben') == u'ueberschrieben' True
- univention.config_registry.misc.directory_files(directory)[source]¶
Return a list of all files below the given directory.
- Parameters
directory – Base directory path.
- Returns
List of absolute file names.
- univention.config_registry.misc.escape_value(s)¶
Return a shell-escaped version of the string s.
- univention.config_registry.misc.key_shell_escape(line)[source]¶
Escape variable name by substituting shell invalid characters by ‘_’.
- Parameters
line – UCR variable name.
- Returns
substitued variable name
- univention.config_registry.misc.validate_key(key, out=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>)[source]¶
Check if key consists of only shell valid characters.
- Parameters
key – UCR variable name to check.
out – Output stream where error message is printed to.
- Returns
True if the name is valid, False otherwise.