コード例 #1
0
ファイル: cobblerd.py プロジェクト: iH8c0ff33/cobbler
def core(api):
    cobbler_api = api
    settings = cobbler_api.settings()
    xmlrpc_port = settings.xmlrpc_port

    regen_ss_file()
    do_xmlrpc_tasks(cobbler_api, settings, xmlrpc_port)
コード例 #2
0
ファイル: cobblerd.py プロジェクト: smahoney/cobbler
def core(api):
    """
    Starts Cobbler.

    :param api: The cobbler_api instance which is used for this method.
    """
    cobbler_api = api
    settings = cobbler_api.settings()
    xmlrpc_port = settings.xmlrpc_port

    regen_ss_file()
    do_xmlrpc_tasks(cobbler_api, settings, xmlrpc_port)
コード例 #3
0
ファイル: cobblerd.py プロジェクト: iH8c0ff33/cobbler
def log(logger, msg):
    if logger is not None:
        logger.info(msg)
    else:
        print(msg, file=sys.stderr)


def do_xmlrpc_rw(cobbler_api, settings, port):

    xinterface = remote.ProxiedXMLRPCInterface(cobbler_api,
                                               remote.CobblerXMLRPCInterface)
    server = remote.CobblerXMLRPCServer(('127.0.0.1', port))
    server.logRequests = 0  # don't print stuff
    xinterface.logger.debug("XMLRPC running on %s" % port)
    server.register_instance(xinterface)

    while True:
        try:
            print("SERVING!")
            server.serve_forever()
        except IOError:
            # interrupted? try to serve again
            time.sleep(0.5)


if __name__ == "__main__":
    cobbler_api = cobbler_api.CobblerAPI()
    settings = cobbler_api.settings()
    regen_ss_file()
    do_xmlrpc_rw(cobbler_api, settings, 25151)