[Freeipa-devel] [patch]-pytest-multihost-Return File Attributes to sftp.put
Niranjan
mrniranjan at fedoraproject.org
Thu Aug 13 11:55:01 UTC 2015
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
-------------- next part --------------
From 5268b93efec39fc0c04f5bd022497143622e87b4 Mon Sep 17 00:00:00 2001
From: Niranjan MR <mrniranjan at 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 <mrniranjan at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 311 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20150813/b109ae3a/attachment.sig>
More information about the Freeipa-devel
mailing list