Singleton hacked for support reinit method for instance
Change-Id: Iea72dc29af8a560005e6f798f33b486d5651fb12
diff --git a/trsync.py b/trsync.py
index 39e1203..5ee5b2e 100644
--- a/trsync.py
+++ b/trsync.py
@@ -25,6 +25,9 @@
def __str__(self):
return self.snapshot_stamp
+ def reinit(self, *args, **kwagrs):
+ self.__init__(*args, **kwagrs)
+
class TRsync(RsyncRemote):
# retry and other function with mirror
diff --git a/utils.py b/utils.py
index f03ec41..8872c47 100644
--- a/utils.py
+++ b/utils.py
@@ -12,6 +12,8 @@
def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
+ elif hasattr(class_, 'reinit'):
+ instances[class_].reinit(*args, **kwargs)
return instances[class_]
return getinstance