fix parsing-problem

This commit is contained in:
Jakobus Schürz 2023-03-12 11:22:36 +01:00
parent 5acb9df073
commit 8e10ccacd0

View file

@ -131,15 +131,15 @@ def check_lockfile(args,lf):
file.close()
#if len(pid) > 0 and Myos().path_isfile('/proc/'+pid+'/cmdline',args.config.ssh[args.tag][st]):
if len(pid) > 0 and os.path.isfile('/proc/'+pid+'/cmdline'):
logger.warn('lockfile %s in use with process %s' % (lf,pid))
logger.warning('lockfile %s in use with process %s' % (lf,pid))
#DEBUG('lockfile %s in use with process %s' % (lf,pid),level=3,verbose=args.verbose)
return(True)
else:
logger.warn('lockfile %s unused' % (lf))
logger.warning('lockfile %s unused' % (lf))
#DEBUG('lockfile %s unused' % (lf),level=3,verbose=args.verbose)
return(False)
else:
logger.warn('lockfile %s not existing' % (lf))
logger.warning('lockfile %s not existing' % (lf))
#DEBUG('lockfile %s not existing' % (lf),level=3,verbose=args.verbose)
return(None)
@ -222,7 +222,7 @@ class BtrfsListing:
self.scanfs()
def scanfs(self):
logger.warn('SCAN btrfs-drive: %s' % (self.StorePath))
logger.warning('SCAN btrfs-drive: %s' % (self.StorePath))
if self.single:
cmd=['btrfs','subvolume','list','-R','-u','-q','-c','-o',self.StorePath]
else:
@ -233,9 +233,9 @@ class BtrfsListing:
for line in output.splitlines():
# btrfs-subvolume list 4.13 output field separator is not anymore only one space. uuid-fields are filled up with whitespaces, so split(' ') does not work anymore!!!
#argmts = line.split(' ')
argmts = line.split(' ')
argmts = line.split()
#ID 2412 gen 8547 cgen 8547 top level 2393 parent_uuid 7991115b-8a6b-6d4d-b664-03db01e902d0 received_uuid - uuid 368490e7-5aca-0d4d-9b7a-becff0487ebd path aldebaran/__ALWAYSCURRENT__.2016-10-15_22:40:25.hourly.part/var-spool-dovecot
self.svols[argmts[1]] = dict()
self.svols[argmts[1]] = dict()
self.svols[argmts[1]]['id'] = argmts[1]
self.svols[argmts[1]]['gen'] = argmts[3]
self.svols[argmts[1]]['cgen'] = argmts[5]
@ -244,6 +244,7 @@ class BtrfsListing:
self.svols[argmts[1]]['ruuid'] = argmts[12]
self.svols[argmts[1]]['uuid'] = argmts[14]
self.svols[argmts[1]]['path'] = ' '.join(argmts[16:])
except:
print("Subvolume not found: %s" %(self.StorePath))
@ -263,7 +264,7 @@ class BtrfsListing:
for sub in sorted(self.svols.keys(),key=int):
if self.svols[sub]['path'] == snap: stroot = self.svols[sub]['uuid']
ext = " (gen: "+str(self.svols[sub]['gen'])+" cgen: "+str(self.svols[sub]['gen'])+")"
try:
try:
vars()[str(self.svols[sub]['uuid'])] = Node(str(self.svols[sub]['path'])+ext,parent=vars()[self.svols[sub]['puuid']])
except:
vars()[str(self.svols[sub]['uuid'])] = Node(str(self.svols[sub]['path'])+ext,parent=wood)
@ -480,13 +481,13 @@ class SubVolume(SubVolumeInfo):
self.SnapLock = self.SnapName+'.part'
self.SLockFile = '.'+self.SnapName+'.~lock'
self.SnapID = None
logger.warn('OrigName : %s' % (self.OrigName))
logger.warn('SourceName: %s' % (self.SourceName))
logger.warn('OrigLock : %s' % (self.OrigLock))
logger.warn('OLockFile : %s' % (self.OLockFile))
logger.warn('SnapName : %s' % (self.SnapName))
logger.warn('SnapLock : %s' % (self.SnapLock))
logger.warn('SLockFile : %s' % (self.SLockFile))
logger.warning('OrigName : %s' % (self.OrigName))
logger.warning('SourceName: %s' % (self.SourceName))
logger.warning('OrigLock : %s' % (self.OrigLock))
logger.warning('OLockFile : %s' % (self.OLockFile))
logger.warning('SnapName : %s' % (self.SnapName))
logger.warning('SnapLock : %s' % (self.SnapLock))
logger.warning('SLockFile : %s' % (self.SLockFile))
self.parent = ''
self.subvolsshort = []
@ -1957,7 +1958,7 @@ if __name__ == '__main__':
for st in args.store:
args.sourcepath[st] = args.config.getStorePath(st,args.tag)
args.destpath[st] = args.config.getStorePath(st,args.tag)
logger.warn('''Action is %s
logger.warning('''Action is %s
Source is %s
Destination is %s''' % (args.action,args.sourcepath,args.destpath))
else: