def __init__(self, is_cobblerd=False): """ Constructor """ # FIXME: this should be switchable through some simple system self.__dict__ = BootAPI.__shared_state self.perms_ok = False if not BootAPI.__has_loaded: if os.path.exists("/etc/cobbler/use.couch"): self.use_couch = True else: self.use_couch = False # NOTE: we do not log all API actions, because # a simple CLI invocation may call adds and such # to load the config, which would just fill up # the logs, so we'll do that logging at CLI # level (and remote.py web service level) instead. random.seed() self.is_cobblerd = is_cobblerd try: self.logger = clogger.Logger("/var/log/cobbler/cobbler.log") except CX: # return to CLI/other but perms are not valid # perms_ok is False return # FIMXE: conslidate into 1 server instance self.selinux_enabled = utils.is_selinux_enabled() self.dist = utils.check_dist() self.os_version = utils.os_release() BootAPI.__has_loaded = True module_loader.load_modules() self._config = config.Config(self) self.deserialize() self.authn = self.get_module_from_file("authentication", "module", "authn_configfile") self.authz = self.get_module_from_file("authorization", "module", "authz_allowall") # FIXME: pass more loggers around, and also see that those # using things via tasks construct their own kickgen/yumgen/ # pxegen versus reusing this one, which has the wrong logger # (most likely) for background tasks. self.kickgen = kickgen.KickGen(self._config) self.yumgen = yumgen.YumGen(self._config) self.pxegen = pxegen.PXEGen(self._config, logger=self.logger) self.logger.debug("API handle initialized") self.perms_ok = True
def __init__(self, log_settings={}, is_cobblerd=False): """ Constructor """ self.__dict__ = BootAPI.__shared_state self.log_settings = log_settings self.perms_ok = False if not BootAPI.__has_loaded: # NOTE: we do not log all API actions, because # a simple CLI invocation may call adds and such # to load the config, which would just fill up # the logs, so we'll do that logging at CLI # level (and remote.py web service level) instead. random.seed() self.is_cobblerd = is_cobblerd try: self.logger = self.__setup_logger("api") except CX: # return to CLI/other but perms are not valid # perms_ok is False return # FIMXE: conslidate into 1 server instance self.selinux_enabled = utils.is_selinux_enabled() self.dist = utils.check_dist() self.os_version = utils.os_release() self.acl_engine = acls.AclEngine() BootAPI.__has_loaded = True module_loader.load_modules() self._config = config.Config(self) self.deserialize() self.authn = self.get_module_from_file( "authentication", "module", "authn_configfile" ) self.authz = self.get_module_from_file( "authorization", "module", "authz_allowall" ) self.kickgen = kickgen.KickGen(self._config) self.yumgen = yumgen.YumGen(self._config) self.pxegen = pxegen.PXEGen(self._config) self.logger.debug("API handle initialized") self.perms_ok = True
def __init__(self, args): self.allow_reuse_address = True self.modules = module_loader.load_modules() SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, args) XmlRpcInterface.__init__(self)
def main(): """Intialize and start the application""" parse_arguments() cfg.read() setup_logging() service.init() setup_paths() configure_django() module_loader.load_modules() setup_server() cherrypy.engine.start() cherrypy.engine.block()
def __init__(self, args): self.allow_reuse_address = True self.modules = module_loader.load_modules() XmlRpcInterface.__init__(self) hn = utils.get_hostname() self.key = "%s/%s.pem" % (self.cm_config.cert_dir, hn) self.cert = "%s/%s.cert" % (self.cm_config.cert_dir, hn) self.ca = "%s/ca.cert" % self.cm_config.cert_dir self._our_ca = certs.retrieve_cert_from_file(self.ca) self.acls = acls_mod.Acls(config=self.config) AuthedXMLRPCServer.AuthedSSLXMLRPCServer.__init__( self, ("", 51234), self.key, self.cert, self.ca)
def __init__(self, args): self.allow_reuse_address = True self.modules = module_loader.load_modules() XmlRpcInterface.__init__(self) hn = utils.get_hostname() self.key = "%s/%s.pem" % (self.cm_config.cert_dir, hn) self.cert = "%s/%s.cert" % (self.cm_config.cert_dir, hn) self.ca = "%s/ca.cert" % self.cm_config.cert_dir self._our_ca = certs.retrieve_cert_from_file(self.ca) self.acls = acls_mod.Acls(config=self.config) AuthedXMLRPCServer.AuthedSSLXMLRPCServer.__init__(self, ("", 51234), self.key, self.cert, self.ca)
from codes import * import config_data import logger import module_loader import utils import virt_utils import amqp_utils import time from busrpc.services import RPCDispatcher from busrpc.config import DeploymentConfig MODULE_PATH="modules/" modules = module_loader.load_modules(MODULE_PATH) import string import traceback class Singleton(object): def __new__(type, *args, **kwargs): if not '_the_instance' in type.__dict__: type._the_instance = object.__new__(type, *args, **kwargs) type._the_instance.init(*args, **kwargs) return type._the_instance def make_logger(): return logger.Logger().logger class XmlRpcInterface(Singleton):