[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Misc bugfixes pending since defcon



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv23551/src/minion/lib/mixminion/server

Modified Files:
	Pinger.py ServerMain.py 
Log Message:
Misc bugfixes pending since defcon

Index: Pinger.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/Pinger.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Pinger.py	28 Jul 2004 06:07:33 -0000	1.5
+++ Pinger.py	7 Aug 2004 14:08:23 -0000	1.6
@@ -384,7 +384,7 @@
             continue
         gr = m.groups()
         # parse time, event; make sure right # of args.
-        tm = calendar.timegm(map(string.atoi, gr[:6]))
+        tm = int(calendar.timegm(map(string.atoi, gr[:6])))
         event = tuple(gr[6].split())
         if _EVENT_ARGS.get(event[0]) != len(event)-1:
             # warn unknown, warn bad n args
@@ -564,7 +564,7 @@
 WEIGHT_AGE = [ 5, 10, 10, 10, 10, 9, 8, 5, 3, 2, 2, 1, 0, 0, 0, 0, 0 ]
 
 def calculatePingResults(periods, endAt):
-    startAt = previousMidnight(endAt) - ONE_DAY*(USE_HISTORY_DAYS)
+    startAt = int(previousMidnight(endAt)) - ONE_DAY*(USE_HISTORY_DAYS)
 
     results = [ OneDayPingResults() for _ in xrange(USE_HISTORY_DAYS+1) ]
     summary = OneDayPingResults()
@@ -580,14 +580,14 @@
         for path,timings in p.pings.items():
             allPaths[path]=1
             for send,recv in timings:
-                day = floorDiv(send-startAt, ONE_DAY)
+                day = floorDiv(int(send-startAt), ONE_DAY)
                 if day<0: continue
                 pingsByDay[day].setdefault(path,[]).append((send,recv))
     if len(periods):
         for send,path in periods[-1].pendingPings.values():
             if send+GRACE_PERIOD > endAt:
                 continue
-            day = floorDiv(send-startAt, ONE_DAY)
+            day = floorDiv(int(send-startAt), ONE_DAY)
             if day<0: continue
             pingsByDay[day].setdefault(path,[]).append((send,None))
             allPaths[path]=1
@@ -665,7 +665,7 @@
         upTotal = 0
         downTotal = 0
         for p in periods:
-            day = floorDiv(p.start-startAt, ONE_DAY)
+            day = floorDiv(int(p.start-startAt), ONE_DAY)
             if day<0: continue
             up = p.serverUptime.get(s,0)
             down = p.serverUptime.get(s,0)
@@ -739,7 +739,7 @@
     def _getPingInterval(self, path):
         raise NotImplemented
     def _schedulePing(self,path,now=None):
-        if now is None: now = time.time()
+        if now is None: now = int(time.time())
         periodStart = self._getPeriodStart(now)
         interval = self._getPingInterval(path)
         t = periodStart + self._getPerturbation(path, periodStart, interval)
@@ -773,7 +773,7 @@
         _PingScheduler.__init__(self)
 
     def scheduleAllPings(self, now=None):
-        if now is None: now = time.time()
+        if now is None: now = int(time.time())
         servers = self.directory.getAllServers()
         nicknames = {}
         for s in servers:

Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- ServerMain.py	27 Jul 2004 23:12:16 -0000	1.133
+++ ServerMain.py	7 Aug 2004 14:08:24 -0000	1.134
@@ -1209,6 +1209,11 @@
     #  would miss the magic copies in sys.__stdin__, sys.__stdout__, etc.
     #  Using os.dup2 instead just nukes the old file for us, and keeps the
     #  fd from getting reused.)
+    if not os.path.exists("/dev/null"):
+        if sys.platform == 'win32':
+            return
+        raise MixFatalError("No /dev/null found; dying.")
+
     nullfd = os.open("/dev/null", os.O_RDWR|os.O_APPEND)
     os.dup2(nullfd, sys.stdin.fileno())
     os.dup2(nullfd, sys.stdout.fileno())