Skip to content

Commit 86c8d6a

Browse files
author
Richard Jones
committed
Freshen is really broken. Commented out.
1 parent 250ed15 commit 86c8d6a

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

roundup-admin

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/python
2-
# $Id: roundup-admin,v 1.7 2001-07-30 01:28:46 richard Exp $
2+
# $Id: roundup-admin,v 1.8 2001-07-30 02:37:07 richard Exp $
33

44
import sys
55
if int(sys.version[0]) < 2:
@@ -273,23 +273,28 @@ def do_retire(db, args):
273273
db.getclass(classname).retire(nodeid)
274274
return 0
275275

276-
def db_freshen(db, args):
276+
def do_freshen(db, args):
277277
'''Usage: freshen
278-
Freshen an existing instance. **do not use
278+
Freshen an existing instance. **DO NOT USE**
279+
280+
This currently kills databases!!!!
279281
280282
This action should generally not be used. It reads in an instance
281283
database and writes it again. In the future, is may also update
282284
instance code to account for changes in templates. It's probably wise
283285
not to use it anyway. Until we're sure it won't break things...
284286
'''
285-
for classname, cl in db.classes.items():
286-
properties = cl.properties.keys()
287-
for nodeid in cl.list():
288-
node = {}
289-
for name in properties:
290-
node[name] = cl.get(nodeid, name)
291-
db.setnode(classname, nodeid, node)
292-
return 0
287+
# for classname, cl in db.classes.items():
288+
# properties = cl.properties.items()
289+
# for nodeid in cl.list():
290+
# node = {}
291+
# for name, type in properties:
292+
# if type.isMultilinkType:
293+
# node[name] = cl.get(nodeid, name, [])
294+
# else:
295+
# node[name] = cl.get(nodeid, name, None)
296+
# db.setnode(classname, nodeid, node)
297+
return 1
293298

294299
def figureCommands():
295300
d = {}
@@ -354,7 +359,7 @@ def main():
354359
return do_init(instance_home, args)
355360

356361
# open the database
357-
if command in ('create', 'set', 'retire'):
362+
if command in ('create', 'set', 'retire', 'freshen'):
358363
while not name:
359364
name = raw_input('Login name: ')
360365
while not password:
@@ -368,16 +373,16 @@ def main():
368373
finally:
369374
del sys.path[0]
370375

371-
command = figureCommands().get(command, None)
376+
function = figureCommands().get(command, None)
372377

373378
# not a valid command
374-
if command is None:
375-
usage()
379+
if function is None:
380+
usage('Unknown command "%s"'%command)
376381
return 1
377382

378383
db = instance.open(name or 'admin')
379384
try:
380-
return command(db, args[1:])
385+
return function(db, args[1:])
381386
finally:
382387
db.close()
383388

@@ -389,6 +394,9 @@ if __name__ == '__main__':
389394

390395
#
391396
# $Log: not supported by cvs2svn $
397+
# Revision 1.7 2001/07/30 01:28:46 richard
398+
# Bugfixes
399+
#
392400
# Revision 1.6 2001/07/30 00:57:51 richard
393401
# Now uses getopt, much improved command-line parsing. Much fuller help. Much
394402
# better internal structure. It's just BETTER. :)

0 commit comments

Comments
 (0)