[CRIU] [PATCH 3/3] p.haul: rename fileobj_wrap to tarfile_fileobj_wrap

Nikita Spiridonov nspiridonov at virtuozzo.com
Fri Mar 18 08:12:38 PDT 2016


Rename fileobj_wrap to tarfile_fileobj_wrap since it contain
tarfile-specific logic.

Signed-off-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
---
 phaul/images.py |    9 +++++----
 phaul/util.py   |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/phaul/images.py b/phaul/images.py
index 656ab7b..bf2e131 100644
--- a/phaul/images.py
+++ b/phaul/images.py
@@ -41,18 +41,19 @@ class untar_thread(threading.Thread):
 
 	def run(self):
 		try:
-			sk_wrap = util.fileobj_wrap(self.__sk)
-			tf = tarfile.open(mode="r|", fileobj=sk_wrap)
+			tf_fileobj = util.tarfile_fileobj_wrap(self.__sk)
+			tf = tarfile.open(mode="r|", fileobj=tf_fileobj)
 			tf.extractall(self.__dir)
 			tf.close()
-			sk_wrap.discard_unread_input()
+			tf_fileobj.discard_unread_input()
 		except:
 			logging.exception("Exception in untar_thread")
 
 
 class img_tar:
 	def __init__(self, sk, dirname):
-		self.__tf = tarfile.open(mode="w|", fileobj=util.fileobj_wrap(sk))
+		tf_fileobj = util.tarfile_fileobj_wrap(sk)
+		self.__tf = tarfile.open(mode="w|", fileobj=tf_fileobj)
 		self.__dir = dirname
 
 	def add(self, img, path = None):
diff --git a/phaul/util.py b/phaul/util.py
index 420169f..2482570 100644
--- a/phaul/util.py
+++ b/phaul/util.py
@@ -6,7 +6,7 @@ import socket
 import tarfile
 
 
-class fileobj_wrap:
+class tarfile_fileobj_wrap:
 	"""Helper class provides read/write interface for socket object
 
 	Current helper class wrap recv/send socket methods in read/write interface.
-- 
1.7.1



More information about the CRIU mailing list