Some helper functions, classes, etc., are useful to both the client and server. Some of these are used to maintain Python Compatibility, and should go in Bcfg2.Compat. Those that aren’t strictly for Python compatibility go in Bcfg2.Utils, which is documented below.
Miscellaneous useful utility functions, classes, etc., that are used by both client and server. Stuff that doesn’t fit anywhere else.
This very simple descriptor class exists only to get the name of the owner class. This is used because, for historical reasons, we expect every server plugin and every client tool to have a name attribute that is in almost all cases the same as the __class__.__name__ attribute of the plugin object. This makes that more dynamic so that each plugin and tool isn’t repeating its own name.
A convenient way to run external commands with subprocess.Popen
|Parameters:||timeout (float) – Set a default timeout for all commands run by this Executor object|
Run a command, given as a list, optionally giving it the specified input data.
Returned as the result of a call to Bcfg2.Utils.Executor.run(). The result can be accessed via the instance variables, documented below, as a boolean (which is equivalent to Bcfg2.Utils.ExecutorResult.success), or as a tuple, which, for backwards compatibility, is equivalent to (result.retval, result.stdout.splitlines()).
A friendly error message
The return value of the command.
Whether or not the command was successful. If the ExecutorResult is used as a boolean, success is returned.
Representation of a set of integer ranges. A range is described by a comma-delimited string of integers and ranges, e.g.:
Ranges are inclusive on both bounds, and may include 0. Negative numbers are not supported.
May be instantiated in one of two ways:
PackedDigitRange(<comma-delimited list of ranges>)
PackedDigitRange(<int_or_range>[, <int_or_range>[, ...]])
E.g., both of the following are valid:
PackedDigitRange("1-5,7, 10-12") PackedDigitRange("1-5", 7, "10-12")
Return True if other is included in this range. Functionally equivalent to other in range, which should be used instead.