View | Details | Raw Unified | Return to bug 28067
Collapse All | Expand All

(-)/usr/share/pyshared/univention/management/console/modules/join/__init__.py.bak (-12 / +19 lines)
 Lines 548-556    Link Here 
548
					for line in file:
548
					for line in file:
549
						match = re.search('^VERSION\=(\d+)',line)
549
						match = re.search('^VERSION\=(\d+)',line)
550
						if match:
550
						if match:
551
							entry['current'] = match.group(1)
551
							try:
552
							MODULE.info("   Script '%s' has version '%s'" % (fname,match.group(1)))
552
								entry['current'] = int(match.group(1))
553
							break	# should stop reading from this file
553
								MODULE.info("   Script '%s' has version '%s'" % (fname,match.group(1)))
554
								break	# should stop reading from this file
555
							except ValueError, e:
556
								MODULE.warn("   Failed to parse version number for Script '%s': VERSION=%s" % (fname, match.group(1)))
554
				finally:
557
				finally:
555
					if file != None:
558
					if file != None:
556
						file.close()
559
						file.close()
 Lines 589-608    Link Here 
589
					lcount = lcount + 1
592
					lcount = lcount + 1
590
					temp = line.split()
593
					temp = line.split()
591
					if len(temp) != 3:
594
					if len(temp) != 3:
592
						next
595
						continue
593
					if temp[2] != 'successful':
596
					if temp[2] != 'successful':
594
						next
597
						continue
595
					fcount = fcount + 1
598
					fcount = fcount + 1
596
					(fname,version,status) = temp
599
					(fname,version,status) = temp
597
					version = version.replace('v','')
600
					try:
601
						version = int(version.replace('v',''))
602
					except ValueError, e:
603
						version = 0
604
						MODULE.warn("   Failed to parse executed version number for Script '%s': %s" % (fname, version))
598
					if fname in files:
605
					if fname in files:
599
						# Some join scripts fail to remove older entries from the status
606
						# Some join scripts fail to remove older entries from the status
600
						# file, so we have to check that we've catched the highest version!
607
						# file, so we have to check that we've catched the highest version!
601
						if 'last' in files[fname]:					# we have already registered an instance of this script, and...
608
						if version < files[fname].get('last', 0):
602
							if version < files[fname]['last']:		# ... it has a higher version than the one we're processing, so...
609
							# ignore smaller version
603
								next								# ... ignore this entry
610
							continue
604
						files[fname]['last'] = version
611
						files[fname]['last'] = version
605
						if files[fname]['last'] < files[fname]['current']:
612
						if files[fname].get('last', 0) < files[fname].get('current', 0):
606
							files[fname]['action'] = _('run')
613
							files[fname]['action'] = _('run')
607
							files[fname]['status'] = _('due')
614
							files[fname]['status'] = _('due')
608
						else:
615
						else:
 Lines 617-624    Link Here 
617
						files[fname] = e
624
						files[fname] = e
618
			finally:
625
			finally:
619
				file.close()
626
				file.close()
620
		except Exception,ex:
627
		except (IOError, OSError), e:
621
			MODULE.warn("ERROR: %s" % str(ex))
628
			MODULE.warn("ERROR opening the status file: %s" % e)
622
		MODULE.info("   .. Read %d lines, extracted %d success entries" % (lcount,fcount))
629
		MODULE.info("   .. Read %d lines, extracted %d success entries" % (lcount,fcount))
623
		# Say it perlish: @result = values %files;
630
		# Say it perlish: @result = values %files;
624
		result = []
631
		result = []

Return to bug 28067