1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
.. -*- mode: rst -*-
.. _development-core:
=========================
Server Core Development
=========================
.. versionadded:: 1.3.0
Bcfg2 1.3 added a pluggable server core system so that the server core
itself can be easily swapped out to use different technologies. It
currently ships with several backends: a builtin core written from
scratch using the various server tools in the Python standard library;
a variant on the builtin core that uses Python 2.6's
:mod:`multiprocessing` library to process requests in parallel; and an
experimental `CherryPy <http://www.cherrypy.org/>`_ based core. This
page documents the server core interface so that other cores can be
written to take advantage of other technologies, e.g., `Tornado
<http://www.tornadoweb.org/>`_ or `Twisted
<http://twistedmatrix.com/trac/>`_.
A core implementation needs to:
* Override :func:`Bcfg2.Server.Core.Core._run` to handle server
startup.
* Override :func:`Bcfg2.Server.Core.Core._block` to run the
blocking server loop.
* Call :func:`Bcfg2.Server.Core.Core.shutdown` on orderly
shutdown.
A core that wants to use the network (i.e., a core that isn't used
entirely for introspection, as in :ref:`bcfg2-info
<server-bcfg2-info>`, or other local tasks) should inherit from
:class:`Bcfg2.Server.Core.NetworkCore`, and must also override
:func:`Bcfg2.Server.Core.NetworkCore._daemonize` to handle daemonization,
writing the PID file, and dropping privileges.
Nearly all XML-RPC handling is delegated entirely to the core
implementation. It needs to:
* Call :func:`Bcfg2.Server.Core.NetworkCore.authenticate` to
authenticate clients.
* Handle :exc:`xmlrpclib.Fault` exceptions raised by the exposed
XML-RPC methods as appropriate.
* Dispatch XML-RPC method invocations to the appropriate method,
including Plugin RMI. The client address pair (a tuple of remote IP
address and remote hostname) must be prepended to the argument list
passed to built-in methods (i.e., not to plugin RMI).
Additionally, running and configuring the server is delegated to the
core. It needs to honor the configuration options that influence how
and where the server runs, including the server location (host and
port), listening interfaces, and SSL certificate and key.
Base Core
=========
.. automodule:: Bcfg2.Server.Core
Core Implementations
====================
Builtin Core
------------
The builtin server core consists of the core implementation
(:class:`Bcfg2.Server.BuiltinCore.Core`) and the XML-RPC server
implementation (:mod:`Bcfg2.Server.SSLServer`).
Core
~~~~
.. automodule:: Bcfg2.Server.BuiltinCore
XML-RPC Server
~~~~~~~~~~~~~~
.. automodule:: Bcfg2.Server.SSLServer
Multiprocessing Core
--------------------
.. automodule:: Bcfg2.Server.MultiprocessingCore
CherryPy Core
-------------
.. automodule:: Bcfg2.Server.CherryPyCore
|