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() file.close()
#if len(pid) > 0 and Myos().path_isfile('/proc/'+pid+'/cmdline',args.config.ssh[args.tag][st]): #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'): 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) #DEBUG('lockfile %s in use with process %s' % (lf,pid),level=3,verbose=args.verbose)
return(True) return(True)
else: else:
logger.warn('lockfile %s unused' % (lf)) logger.warning('lockfile %s unused' % (lf))
#DEBUG('lockfile %s unused' % (lf),level=3,verbose=args.verbose) #DEBUG('lockfile %s unused' % (lf),level=3,verbose=args.verbose)
return(False) return(False)
else: 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) #DEBUG('lockfile %s not existing' % (lf),level=3,verbose=args.verbose)
return(None) return(None)
@ -222,7 +222,7 @@ class BtrfsListing:
self.scanfs() self.scanfs()
def scanfs(self): def scanfs(self):
logger.warn('SCAN btrfs-drive: %s' % (self.StorePath)) logger.warning('SCAN btrfs-drive: %s' % (self.StorePath))
if self.single: if self.single:
cmd=['btrfs','subvolume','list','-R','-u','-q','-c','-o',self.StorePath] cmd=['btrfs','subvolume','list','-R','-u','-q','-c','-o',self.StorePath]
else: else:
@ -233,7 +233,7 @@ class BtrfsListing:
for line in output.splitlines(): 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!!! # 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(' ') 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 #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]]['id'] = argmts[1]
@ -244,6 +244,7 @@ class BtrfsListing:
self.svols[argmts[1]]['ruuid'] = argmts[12] self.svols[argmts[1]]['ruuid'] = argmts[12]
self.svols[argmts[1]]['uuid'] = argmts[14] self.svols[argmts[1]]['uuid'] = argmts[14]
self.svols[argmts[1]]['path'] = ' '.join(argmts[16:]) self.svols[argmts[1]]['path'] = ' '.join(argmts[16:])
except: except:
print("Subvolume not found: %s" %(self.StorePath)) print("Subvolume not found: %s" %(self.StorePath))
@ -480,13 +481,13 @@ class SubVolume(SubVolumeInfo):
self.SnapLock = self.SnapName+'.part' self.SnapLock = self.SnapName+'.part'
self.SLockFile = '.'+self.SnapName+'.~lock' self.SLockFile = '.'+self.SnapName+'.~lock'
self.SnapID = None self.SnapID = None
logger.warn('OrigName : %s' % (self.OrigName)) logger.warning('OrigName : %s' % (self.OrigName))
logger.warn('SourceName: %s' % (self.SourceName)) logger.warning('SourceName: %s' % (self.SourceName))
logger.warn('OrigLock : %s' % (self.OrigLock)) logger.warning('OrigLock : %s' % (self.OrigLock))
logger.warn('OLockFile : %s' % (self.OLockFile)) logger.warning('OLockFile : %s' % (self.OLockFile))
logger.warn('SnapName : %s' % (self.SnapName)) logger.warning('SnapName : %s' % (self.SnapName))
logger.warn('SnapLock : %s' % (self.SnapLock)) logger.warning('SnapLock : %s' % (self.SnapLock))
logger.warn('SLockFile : %s' % (self.SLockFile)) logger.warning('SLockFile : %s' % (self.SLockFile))
self.parent = '' self.parent = ''
self.subvolsshort = [] self.subvolsshort = []
@ -1957,7 +1958,7 @@ if __name__ == '__main__':
for st in args.store: for st in args.store:
args.sourcepath[st] = args.config.getStorePath(st,args.tag) args.sourcepath[st] = args.config.getStorePath(st,args.tag)
args.destpath[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 Source is %s
Destination is %s''' % (args.action,args.sourcepath,args.destpath)) Destination is %s''' % (args.action,args.sourcepath,args.destpath))
else: else: