|
|
@ -6,7 +6,6 @@ fuse for catcli
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from time import time
|
|
|
|
from time import time
|
|
|
|
from stat import S_IFDIR, S_IFREG
|
|
|
|
from stat import S_IFDIR, S_IFREG
|
|
|
|
from typing import List, Dict, Any, Optional
|
|
|
|
from typing import List, Dict, Any, Optional
|
|
|
@ -19,14 +18,6 @@ from catcli.utils import path_to_search_all, path_to_top
|
|
|
|
from catcli import nodes
|
|
|
|
from catcli import nodes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# build custom logger to log in /tmp
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
logger.setLevel(logging.DEBUG)
|
|
|
|
|
|
|
|
fh = logging.FileHandler('/tmp/fuse-catcli.log')
|
|
|
|
|
|
|
|
fh.setLevel(logging.DEBUG)
|
|
|
|
|
|
|
|
logger.addHandler(fh)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Fuser:
|
|
|
|
class Fuser:
|
|
|
|
"""fuse filesystem mounter"""
|
|
|
|
"""fuse filesystem mounter"""
|
|
|
|
|
|
|
|
|
|
|
@ -114,8 +105,6 @@ class CatcliFilesystem(fuse.LoggingMixIn, fuse.Operations): # type: ignore
|
|
|
|
|
|
|
|
|
|
|
|
def getattr(self, path: str, _fh: Any = None) -> Dict[str, Any]:
|
|
|
|
def getattr(self, path: str, _fh: Any = None) -> Dict[str, Any]:
|
|
|
|
"""return attr of file pointed by path"""
|
|
|
|
"""return attr of file pointed by path"""
|
|
|
|
logger.info('getattr path: %s', path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if path == '/':
|
|
|
|
if path == '/':
|
|
|
|
# mountpoint
|
|
|
|
# mountpoint
|
|
|
|
curt = time()
|
|
|
|
curt = time()
|
|
|
@ -135,7 +124,6 @@ class CatcliFilesystem(fuse.LoggingMixIn, fuse.Operations): # type: ignore
|
|
|
|
|
|
|
|
|
|
|
|
def readdir(self, path: str, _fh: Any) -> List[str]:
|
|
|
|
def readdir(self, path: str, _fh: Any) -> List[str]:
|
|
|
|
"""read directory content"""
|
|
|
|
"""read directory content"""
|
|
|
|
logger.info('readdir path: %s', path)
|
|
|
|
|
|
|
|
content = ['.', '..']
|
|
|
|
content = ['.', '..']
|
|
|
|
entries = self._get_entries(path)
|
|
|
|
entries = self._get_entries(path)
|
|
|
|
for entry in entries:
|
|
|
|
for entry in entries:
|
|
|
|