Exemplo n.º 1
0
Arquivo: env.py Projeto: peuter/gosa
    def __init__(self):
        # Load configuration
        self.config = Config(config=Environment.config, noargs=Environment.noargs)
        self.log = logging.getLogger(__name__)
        self.id = platform.node()
        self.__db = {}
        self.__db_session = {}

        # Dump configuration
        if self.log.getEffectiveLevel() == logging.DEBUG:
            self.log.debug("configuration dump:")

            for section in self.config.getSections():
                self.log.debug("[%s]" % section)
                items = self.config.getOptions(section)

                for item in items:
                    self.log.debug("%s = %s" % (item, items[item]))

            self.log.debug("end of configuration dump")

        # Load base - we need one
        self.base = self.config.get("core.base")
        self.domain = self.config.get("core.domain", "default")

        self.uuid = self.config.get("core.id", default=None)
        if not self.uuid:
            self.log.warning("system has no id - falling back to configured hardware uuid")
            self.uuid = dmi_system("uuid")

            if not self.uuid:
                self.log.error("system has no id - please configure one in the core section")
                raise Exception("No system id found")
Exemplo n.º 2
0
    def __init__(self):
        # Load configuration
        self.config = Config(config=Environment.config,  noargs=Environment.noargs)
        self.log = logging.getLogger(__name__)

        self.id = platform.node()

        # Dump configuration
        #TODO: core.loglevel is gone
        if self.config.get("core.loglevel") == "DEBUG":
            self.log.debug("configuration dump:")

            for section in self.config.getSections():
                self.log.debug("[%s]" % section)
                items = self.config.getOptions(section)

                for item in items:
                    self.log.debug("%s = %s" % (item, items[item]))

            self.log.debug("end of configuration dump")

        # Initialized
        self.domain = self.config.get("core.domain", default="org.gosa")
        self.uuid = self.config.get("core.id", default=None)
        if not self.uuid:
            self.log.warning("system has no id - falling back to configured hardware uuid")
            self.uuid = dmi_system("uuid")

            if not self.uuid:
                self.log.error("system has no id - please configure one in the core section")
                raise Exception("No system id found")

        self.active = True
Exemplo n.º 3
0
 def __init__(self):
     self.env = Environment.getInstance()
     self.log = logging.getLogger(__name__)
     self.uuid = dmi_system("uuid")
     self.mac = self.get_mac_address()
     self.get_service()
     self.domain = socket.getfqdn().split('.', 1)[1]
Exemplo n.º 4
0
    def __init__(self):
        self.env = Environment.getInstance()
        self.log = logging.getLogger(__name__)
        self.uuid = dmi_system("uuid")
        self.mac = self.get_mac_address()
        try:
            self.domain = socket.getfqdn().split('.', 1)[1]
        except IndexError:
            self.log.warning("system has no proper DNS domain")
            self.domain = socket.getfqdn().split('.', 1)[0] + ".local"

        self.get_service()
Exemplo n.º 5
0
    def __init__(self):
        self.env = Environment.getInstance()
        self.log = logging.getLogger(__name__)
        self.uuid = dmi_system("uuid")
        self.mac = self.get_mac_address()
        try:
            self.domain = socket.getfqdn().split('.', 1)[1]
        except IndexError:
            self.log.warning("system has no proper DNS domain")
            self.domain = socket.getfqdn().split('.', 1)[0] + ".local"

        self.get_service()
Exemplo n.º 6
0
Arquivo: env.py Projeto: gonicus/gosa
    def __init__(self):
        # Load configuration
        self.config = Config(config=Environment.config, noargs=Environment.noargs)
        self.log = logging.getLogger(__name__)
        self.id = platform.node()
        self.__db = {}
        self.__db_session = {}
        self.__db_factory = {}

        # Dump configuration
        if self.log.getEffectiveLevel() == logging.DEBUG:
            self.log.debug("configuration dump:")

            for section in self.config.getSections():
                self.log.debug("[%s]" % section)
                items = self.config.getOptions(section)

                for item in items:
                    self.log.debug("%s = %s" % (item, items[item]))

            self.log.debug("end of configuration dump")

        # Load base - we need one
        self.base = self.config.get("core.base")
        self.domain = self.config.get("core.domain", "default")

        self.uuid = self.config.get("core.id", default=None)
        self.mode = self.config.get("core.mode", default="backend")
        if self.mode not in ["backend", "proxy"]:
            raise Exception("Unknown mode: %s (only 'backend' or 'proxy' are allowed)" % self.mode)

        if not self.uuid:
            self.log.warning("system has no id - falling back to configured hardware uuid")
            self.uuid = dmi_system("uuid")

            if not self.uuid:
                self.log.error("system has no id - please configure one in the core section")
                raise Exception("No system id found")

        self.backend_index = self.config.getboolean("backend.index", default=True)
        if self.backend_index is False and self.config.get("backend.index-trigger") is not None \
                and os.path.exists(self.config.get("backend.index-trigger")):
            self.backend_index = True
            os.remove(self.config.get("backend.index-trigger"))