@@ -251,6 +251,7 @@ def get_file(self):
251251 """Downloads a file from the NFS share"""
252252 remote_file_path = self .args .get_file [0 ]
253253 local_file_path = self .args .get_file [1 ]
254+ windows = False
254255
255256 # Do a bit of smart handling for the local file path
256257 if local_file_path .endswith ("/" ):
@@ -265,12 +266,24 @@ def get_file(self):
265266
266267 # Mount the NFS share
267268 mnt_info = self .mount .mnt (remote_file_path , self .auth )
269+ if mnt_info ["mountinfo" ] is None :
270+ windows = True
271+ remote_file_path2 , remote_file_path = os .path .split (remote_file_path .rstrip ("/" )) # For windows. Windows wants to share name, not whole file path.
272+ mnt_info = self .mount .mnt (remote_file_path2 , self .auth )
273+
268274 # Update the UID for the file
269275 attrs = self .nfs3 .getattr (mnt_info ["mountinfo" ]["fhandle" ], auth = self .auth )
270276 self .auth ["uid" ] = attrs ["attributes" ]["uid" ]
271- file_handle = mnt_info ["mountinfo" ]["fhandle" ]
277+ dir_handle = mnt_info ["mountinfo" ]["fhandle" ]
278+
272279 # Read the file data
273- file_data = self .nfs3 .read (file_handle , auth = self .auth )
280+ if windows :
281+ dir_data = self .nfs3 .lookup (dir_handle , remote_file_path , auth = self .auth )
282+ file_handle = dir_data ["resok" ]["object" ]["data" ]
283+ file_data = self .nfs3 .read (file_handle , auth = self .auth )
284+ else :
285+ file_handle = mnt_info ["mountinfo" ]["fhandle" ]
286+ file_data = self .nfs3 .read (file_handle , auth = self .auth )
274287
275288 if "resfail" in file_data :
276289 raise Exception ("Insufficient Permissions" )
@@ -323,10 +336,11 @@ def put_file(self):
323336 except Exception as e :
324337 self .logger .fail (f"{ file_name } was not created." )
325338 self .logger .debug (f"Error while creating remote file: { e } " )
339+ exit (- 1 )
326340
327341 try :
328342 # Mount the NFS share to write the file
329- mnt_info = self .mount .mnt (remote_file_path , self .auth )
343+ mnt_info = self .mount .mnt (remote_file_path + "/" + file_name , self .auth )
330344 file_handle = mnt_info ["mountinfo" ]["fhandle" ]
331345 attrs = self .nfs3 .getattr (file_handle , auth = self .auth )
332346 self .auth ["uid" ] = attrs ["attributes" ]["uid" ]
@@ -340,6 +354,7 @@ def put_file(self):
340354 except Exception as e :
341355 self .logger .fail (f"{ local_file_path } was not writed." )
342356 self .logger .debug (f"Error while creating remote file: { e } " )
357+ exit (- 1 )
343358
344359 # Unmount the share
345360 self .mount .umnt (self .auth )
0 commit comments