Exemple #1
0
    def __init__(self, *args, **kw):
        config = Config.get_instance()
        self.static_path = config.get('tftp.static-path',
                                      '/tftpboot/pxelinux.static')
        self.cfg_path = config.get('tftp.path', '/tftpboot/pxelinux.cfg')

        # Sanity checks
        if not os.access(self.cfg_path, os.F_OK):
            syslog.syslog(syslog.LOG_ERR,
                          "base path '%s' does not exist" % self.cfg_path)
            exit(1)
        if not os.access(self.static_path, os.F_OK):
            syslog.syslog(syslog.LOG_ERR,
                          "static path '%s' does not exist" % self.static_path)
            exit(1)

        # Inject mount point
        fa = fuse.FuseArgs()
        fa.mountpoint = self.cfg_path
        fa.add('allow_other')
        fa.add('nonempty')
        if config.get('core.foreground', 'False') == 'True':
            fa.setmod('foreground')

        kw['fuse_args'] = fa

        fuse.Fuse.__init__(self, *args, **kw)
        self.root = os.sep
        self.filesystem = {
            self.root: {
                "content": "",
            }
        }
        self.positive_cache_timeout = 10

        # Load all registered boot methods
        self.boot_method_reg = {}
        for entry in pkg_resources.iter_entry_points("fts.plugin"):
            module = entry.load()
            if issubclass(module, BootPlugin):
                self.boot_method_reg[module.__name__] = module()
                syslog.syslog(
                    syslog.LOG_INFO, "boot plugin '%s' included" %
                    self.boot_method_reg[module.__name__].getInfo())
Exemple #2
0
    def __init__(self, *args, **kw):
        config = Config.get_instance()
        self.static_path = config.get('tftp.static-path', '/tftpboot/pxelinux.static')
        self.cfg_path = config.get('tftp.path', '/tftpboot/pxelinux.cfg')

        # Sanity checks
        if not os.access(self.cfg_path, os.F_OK):
            syslog.syslog(syslog.LOG_ERR, "base path '%s' does not exist" % self.cfg_path)
            exit(1)
        if not os.access(self.static_path, os.F_OK):
            syslog.syslog(syslog.LOG_ERR, "static path '%s' does not exist" % self.static_path)
            exit(1)

        # Inject mount point
        fa = fuse.FuseArgs()
        fa.mountpoint = self.cfg_path
        fa.add('allow_other')
        fa.add('nonempty')
        if config.get('core.foreground', 'False') == 'True':
            fa.setmod('foreground')

        kw['fuse_args'] = fa

        fuse.Fuse.__init__(self, *args, **kw)
        self.root = os.sep
        self.filesystem = {
            self.root : {
                "content": "",
            }
        }
        self.positive_cache_timeout = 10

        # Load all registered boot methods
        self.boot_method_reg = {}
        for entry in pkg_resources.iter_entry_points("fts.plugin"):
            module = entry.load()
            if issubclass(module, BootPlugin):
                self.boot_method_reg[module.__name__] = module()
                syslog.syslog(syslog.LOG_INFO, "boot plugin '%s' included" % self.boot_method_reg[module.__name__].getInfo())
Exemple #3
0
    def __init__(self):
        self.config = Config.get_instance()
        self.log = logging.getLogger(__name__)

        # Initialize from configuration
        get = self.config.get
        self.__url = ldapurl.LDAPUrl(get("ldap.url"))
        self.__bind_user = get('ldap.bind_user', default=None)
        self.__bind_dn = get('ldap.bind_dn', default=None)
        self.__bind_secret = get('ldap.bind_secret', default=None)
        self.__pool = int(get('ldap.pool_size', default=10))

        # Sanity check
        if self.__bind_user and not ldap.SASL_AVAIL:
            self.log.error("bind_user needs SASL support, which doesn't seem to be available in python-ldap")
            sys.exit(1)

        if not self.__url:
            self.log.error("there is no 'url' specified in the 'ldap' section of the configuration file")
            sys.exit(1)

        # Initialize static pool
        LDAPHandler.connection_handle = [None] * self.__pool
        LDAPHandler.connection_usage = [False] * self.__pool