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)
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)
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)