[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Add code to stop known-dead servers from being included...
Update of /home/minion/cvsroot/src/minion/lib/mixminion/directory
In directory moria.mit.edu:/tmp/cvs-serv10314/lib/mixminion/directory
Modified Files:
DirMain.py Directory.py ServerList.py
Log Message:
Add code to stop known-dead servers from being included in the directory at all.
Index: DirMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/DirMain.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- DirMain.py 20 Oct 2003 19:40:32 -0000 1.17
+++ DirMain.py 20 Nov 2003 04:03:47 -0000 1.18
@@ -134,7 +134,7 @@
config = d.getConfig()
- badServers = config['Directory'].get('BadServer', [])
+ badServers = config['Directory'].get('BadServer', [])[:]
badServerFiles = config['Directory'].get('BadServerFile', [])
for fn in badServerFiles:
if not os.path.exists(fn):
@@ -147,6 +147,9 @@
badServers.append(ln)
f.close()
+ excludeServers = config['Directory'].get("ExcludeServer",[])[:]
+ excludeServers = [ nn.strip().lower() for nn in excludeServers ]
+
location = config['Publishing']['Location']
print "(Bad servers==%r)"%badServers
@@ -157,7 +160,8 @@
serverList.generateDirectory(startAt=now, endAt=tomorrow,
extraTime=twoWeeks,
identityKey=key,
- badServers=badServers)
+ badServers=badServers,
+ excludeServers=excludeServers)
print "Directory generated; publishing."
fname = serverList.getDirectoryFilename()
Index: Directory.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/Directory.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Directory.py 7 Nov 2003 07:03:28 -0000 1.14
+++ Directory.py 20 Nov 2003 04:03:47 -0000 1.15
@@ -164,7 +164,8 @@
},
'Directory' : {
"BadServer" : ("ALLOW*", None, None),
- "BadServerFile" : ("ALLOW*", "filename", None)
+ "BadServerFile" : ("ALLOW*", "filename", None),
+ "ExcludeServer" : ("ALLOW*", None, None),
},
'Publishing' : {
"__SECTION__": ('REQUIRE', None, None),
Index: ServerList.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/directory/ServerList.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- ServerList.py 20 Oct 2003 19:40:32 -0000 1.41
+++ ServerList.py 20 Nov 2003 04:03:47 -0000 1.42
@@ -242,11 +242,15 @@
startAt, endAt, extraTime,
identityKey,
publicationTime=None,
- badServers=()):
+ badServers=(),
+ excludeServers=()):
"""Generate and sign a new directory, to be effective from <startAt>
through <endAt>. It includes all servers that are valid at
any time between <startAt> and <endAt>+<extraTime>. The directory
- is signed with <identityKey> """
+ is signed with <identityKey>
+
+ DOCDOC badServers, excludeServers
+ """
try:
self._lock()
self.clean()
@@ -255,10 +259,13 @@
if previousMidnight(startAt) >= previousMidnight(endAt):
raise MixError("Validity range does not contain a full day.")
+ excludeServers = [ nickname.lower() for nickname in excludeServers]
+
# First, sort all servers by nickname.
includedByNickname = {}
for fn, s in self.servers.items():
nickname = s.getNickname().lower()
+ if nickname in excludeServers: continue
includedByNickname.setdefault(nickname, []).append((s, fn))
# Second, find all servers that are valid for part of the period,