diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-10-30 07:10:00 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-10-30 07:10:00 -0400 |
commit | 1c5c4f285293142e38ff54797e1c4b5a820e9cb0 (patch) | |
tree | d4bc1cacc8234f377e658071762f00af11bf477f /src/lib | |
parent | c4e1b49ff7d5b8f5860f5cc208476ff42159724e (diff) | |
download | bcfg2-1c5c4f285293142e38ff54797e1c4b5a820e9cb0.tar.gz bcfg2-1c5c4f285293142e38ff54797e1c4b5a820e9cb0.tar.bz2 bcfg2-1c5c4f285293142e38ff54797e1c4b5a820e9cb0.zip |
Core: Better stringification of server core objects
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Bcfg2/Server/Core.py | 7 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/MultiprocessingCore.py | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py index 85760aac3..e3a9f7fce 100644 --- a/src/lib/Bcfg2/Server/Core.py +++ b/src/lib/Bcfg2/Server/Core.py @@ -247,6 +247,9 @@ class Core(object): self.logger.error("Updating database %s failed: %s" % (Bcfg2.Options.setup.db_name, err)) + def __str__(self): + return self.__class__.__name__ + def plugins_by_type(self, base_cls): """ Return a list of loaded plugins that match the passed type. @@ -1360,6 +1363,10 @@ class NetworkCore(Core): __init__.__doc__ = Core.__init__.__doc__.split(".. -----")[0] + \ "\n.. automethod:: _daemonize\n" + def __str__(self): + return "%s(%s)" % (self.__class__.__name__, + Bcfg2.Options.setup.location) + def run(self): """ Run the server core. This calls :func:`_daemonize` before calling :func:`Bcfg2.Server.Core.Core.run` to run the server diff --git a/src/lib/Bcfg2/Server/MultiprocessingCore.py b/src/lib/Bcfg2/Server/MultiprocessingCore.py index c42009bdd..58a05c85d 100644 --- a/src/lib/Bcfg2/Server/MultiprocessingCore.py +++ b/src/lib/Bcfg2/Server/MultiprocessingCore.py @@ -351,6 +351,11 @@ class MultiprocessingCore(BuiltinCore): #: to provide a round-robin distribution of render requests self.children = None + def __str__(self): + return "%s(%s; %s children)" % (self.__class__.__name__, + Bcfg2.Options.setup.location, + len(self._all_children)) + def _run(self): for cnum in range(Bcfg2.Options.setup.core_children): name = "Child-%s" % cnum |