The final module
With all of our functions in place, the final module will look like this:
''' The backend for serving files from an SFTP account. To enable, add ``sftp`` to the :conf_master:`fileserver_backend` option in the Master config file. .. code-block:: yaml fileserver_backend: - sftp Each environment is configured as a directory inside the SFTP account. The name of the directory must match the name of the environment. .. code-block:: yaml sftpfs_host: sftp.example.com sftpfs_port: 22 sftpfs_username: larry sftpfs_password: 123pass sftpfs_root: /srv/sftp/salt/ ''' import os import os.path import logging import time try: import fcntl HAS_FCNTL = True except ImportError: # fcntl is not available on windows HAS_FCNTL = False import salt.fileserver import salt.utils import salt.syspaths try: import paramiko from paramiko import AuthenticationException HAS_LIBS = True except ImportError: HAS_LIBS = False __virtualname__...