Skip to content

Commit

Permalink
update locations.json and sshfs_mounter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
talosh committed Jan 4, 2023
1 parent 613e8e7 commit 0317546
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions sshfs_mounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0317546

Please sign in to comment.