add push and applyto functions
This commit is contained in:
parent
e19fc234f4
commit
49cb37eda2
34
lgit.py
34
lgit.py
@ -284,12 +284,25 @@ l dc values from base
|
|||||||
|
|
||||||
return appliedlogs
|
return appliedlogs
|
||||||
|
|
||||||
|
def applyto(self, destination)->int:
|
||||||
|
basecopy = destination.getbasecopy(self)
|
||||||
|
|
||||||
|
appliedlogs = destination.applylogs(basecopy)
|
||||||
|
|
||||||
|
return appliedlogs
|
||||||
|
|
||||||
def pullfrom(self, source)->int:
|
def pullfrom(self, source)->int:
|
||||||
self.fetchfrom(source)
|
self.fetchfrom(source)
|
||||||
applied = self.applyfrom(source)
|
applied = self.applyfrom(source)
|
||||||
|
|
||||||
return applied
|
return applied
|
||||||
|
|
||||||
|
def pushto(self, destination)->int:
|
||||||
|
destination.pullfrom(self)
|
||||||
|
pushed = destination.pullfrom(self)
|
||||||
|
|
||||||
|
return pushed
|
||||||
|
|
||||||
def lastpwchangenow(self):
|
def lastpwchangenow(self):
|
||||||
'''
|
'''
|
||||||
Return time of last password change for the user set to current time
|
Return time of last password change for the user set to current time
|
||||||
@ -336,6 +349,15 @@ class lgit():
|
|||||||
|
|
||||||
return appliedlogs
|
return appliedlogs
|
||||||
|
|
||||||
|
def applytoall(self, log_server: logserver)->int:
|
||||||
|
appliedlogs = 0
|
||||||
|
|
||||||
|
for destination in self.servers:
|
||||||
|
if destination != log_server:
|
||||||
|
appliedlogs += log_server.applyto(destination)
|
||||||
|
|
||||||
|
return appliedlogs
|
||||||
|
|
||||||
def apply(self)->int:
|
def apply(self)->int:
|
||||||
appliedlogs = 0
|
appliedlogs = 0
|
||||||
|
|
||||||
@ -350,12 +372,24 @@ class lgit():
|
|||||||
|
|
||||||
return pulled
|
return pulled
|
||||||
|
|
||||||
|
def pushtoall(self, log_server: logserver)->int:
|
||||||
|
pushed = 0
|
||||||
|
|
||||||
|
for destination in self.servers:
|
||||||
|
if destination != log_server:
|
||||||
|
pushed += log_server.pushto(destination)
|
||||||
|
|
||||||
|
return pushed
|
||||||
|
|
||||||
def pull(self)->int:
|
def pull(self)->int:
|
||||||
self.fetch()
|
self.fetch()
|
||||||
pulled = self.apply()
|
pulled = self.apply()
|
||||||
|
|
||||||
return pulled
|
return pulled
|
||||||
|
|
||||||
|
def push(self)->int:
|
||||||
|
return self.pull()
|
||||||
|
|
||||||
def sync(self)->int:
|
def sync(self)->int:
|
||||||
pulledlogs = self.pull()
|
pulledlogs = self.pull()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user