コード例 #1
0
ファイル: fuse_plugin.py プロジェクト: nom3ad/obnam
 def __init__(self, *args, **kw):
     if 'fuse_args' in kw:
         self.fuse_args = kw.pop('fuse_args')
     else:
         self.fuse_args = fuse.FuseArgs()
     if 'fuse' in kw:
         self.fuse = kw.pop('fuse')
コード例 #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())
コード例 #3
0
ファイル: snippet.py プロジェクト: szabo92/gistable
 def __init__(self, *args, **kw):
     self.fuse_args = \
         'fuse_args' in kw and kw.pop('fuse_args') or fuse.FuseArgs()
     if 'fuse' in kw:
         self.fuse = kw.pop('fuse')