Greetings,

This patch is regarding pytest-multihost plugin. 
Including a patch to return FileAttributes for sftp.put function
used in the function.

Current put_file function in transport.py in ParamikoTransport Class doesn't
return any value. So when using this function it's not clear if the operation
was sucessfull or not. 

Returning FileAttributes to put_file function helps in checking if operation
was indeed succesful. 

Requesting feedback on the patch attached.

Regards
Niranjan 
From 5268b93efec39fc0c04f5bd022497143622e87b4 Mon Sep 17 00:00:00 2001
From: Niranjan MR <mrniran...@fedoraproject.org>
Date: Thu, 13 Aug 2015 17:02:45 +0530
Subject: [PATCH] Return File Attributes to sftp.put

This patch passes argument confirm=True to
sftp.put function to return file attributes
of destination file.

Also put_file function now returns FileAttributes
of type SFTPAttributes

Signed-off-by: Niranjan MR <mrniran...@fedoraproject.org>
---
 pytest_multihost/transport.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pytest_multihost/transport.py b/pytest_multihost/transport.py
index 
2b1ccbc32e8ed4b28e263d9bbe2df4bc2c8617de..206aeea6616cfb34bf421009f947145162e187cf
 100644
--- a/pytest_multihost/transport.py
+++ b/pytest_multihost/transport.py
@@ -244,7 +244,8 @@ class ParamikoTransport(Transport):
 
     def put_file(self, localpath, remotepath):
         self.log.info('PUT %s', remotepath)
-        self.sftp.put(localpath, remotepath)
+        fileAttributes = self.sftp.put(localpath, remotepath,confirm=True)
+       return fileAttributes
 
 
 class OpenSSHTransport(Transport):
-- 
1.9.3

Attachment: pgpHHmGGzMTJr.pgp
Description: PGP signature

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to