From 0317546a3088dbb379c59b27b6e48166e15ad891 Mon Sep 17 00:00:00 2001 From: Andriy Toloshny Date: Wed, 4 Jan 2023 17:42:46 +0000 Subject: [PATCH] update locations.json and sshfs_mounter.py --- sshfs_mounter.py | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/sshfs_mounter.py b/sshfs_mounter.py index e08ff95..2cf41c1 100755 --- a/sshfs_mounter.py +++ b/sshfs_mounter.py @@ -74,23 +74,29 @@ def get_config_data(config_folder_path): elif not isinstance(remote_locations, list): print ('remote locations should be list but found %s' % type(location)) remote_locations = [] + + remote_folders = {} + for remote_location in remote_locations: + args = ['ssh'] + if identity_file: + args.append('-i') + args.append(identity_file) + args.append(location.get('user@machine')) + args.append('ls -1 ' + remote_location) + + p = subprocess.Popen(args, stdout=subprocess.PIPE) + output = p.communicate()[0].decode() + + for line in output.splitlines(): + if line in location.get('exclude_folders'): + continue + if os.path.join(remote_location, line) in location.get('exclude_folders'): + continue + remote_folders[line] = remote_location + + pprint (remote_folders) + sys.exit() - args = ['ssh'] - if identity_file: - args.append('-i') - args.append(identity_file) - args.append(location.get('user@machine')) - args.append('ls -1 ' + location.get('remote_folder')) - - - p = subprocess.Popen(args, stdout=subprocess.PIPE) - output = p.communicate()[0].decode() - - remote_folders = [] - for line in output.splitlines(): - if line in location.get('exclude_folders'): - continue - remote_folders.append(line) local_folders = [x for x in os.listdir(location.get('local_folder'))] for local_folder in local_folders: