Source code for solidipes.mounters.sshfs

import os

from ..utils import solidipes_logging as logging

################################################################
from .cloud import Mounter, parameter

################################################################
print = logging.invalidPrint
logger = logging.getLogger()
################################################################


[docs] class SSHFSMounter(Mounter): "Mount a remote file system through ssh (sshfs file system)" parser_key = "ssh" def __init__(self, **kwargs): super().__init__(**kwargs)
[docs] def mount(self, headless=False): # Create directory if it does not exist if not os.path.exists(self.path): os.makedirs(self.path) # Mount SSH file system endpoint = self.mount_info["endpoint"] command = [ "sshfs", endpoint, self.path, ] options = [] if headless: options.append("password_stdin") if len(options) > 0: command += ["-o", ",".join(options)] # logger.error(command) self.run_and_check_return(command, headless=headless, fail_message="Mounting failed")
@parameter def endpoint() -> str: "[user@]host[:path]" pass