comparison roundup-admin @ 455:2198e5445d6b

Some cleanups in roundup-admin, also made it work again...
author Richard Jones <richard@users.sourceforge.net>
date Sat, 15 Dec 2001 23:09:23 +0000
parents 141aacfdb34f
children b579418f7ed1
comparison
equal deleted inserted replaced
454:eed9359b448d 455:2198e5445d6b
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
18 # 18 #
19 # $Id: roundup-admin,v 1.53 2001-12-13 00:20:00 richard Exp $ 19 # $Id: roundup-admin,v 1.54 2001-12-15 23:09:23 richard Exp $
20 20
21 # python version check 21 # python version check
22 from roundup import version_check 22 from roundup import version_check
23 23
24 import string, os, getpass, getopt, re, UserDict 24 import sys, os, getpass, getopt, re, UserDict
25 try: 25 try:
26 import csv 26 import csv
27 except ImportError: 27 except ImportError:
28 csv = None 28 csv = None
29 from roundup import date, hyperdb, roundupdb, init, password 29 from roundup import date, hyperdb, roundupdb, init, password
245 Retrieves the property value of the nodes specified by the designators. 245 Retrieves the property value of the nodes specified by the designators.
246 ''' 246 '''
247 if len(args) < 2: 247 if len(args) < 2:
248 raise UsageError, 'Not enough arguments supplied' 248 raise UsageError, 'Not enough arguments supplied'
249 propname = args[0] 249 propname = args[0]
250 designators = string.split(args[1], ',') 250 designators = args[1].split(',')
251 l = [] 251 l = []
252 for designator in designators: 252 for designator in designators:
253 # decode the node designator 253 # decode the node designator
254 try: 254 try:
255 classname, nodeid = roundupdb.splitDesignator(designator) 255 classname, nodeid = roundupdb.splitDesignator(designator)
284 ''' 284 '''
285 if len(args) < 2: 285 if len(args) < 2:
286 raise UsageError, 'Not enough arguments supplied' 286 raise UsageError, 'Not enough arguments supplied'
287 from roundup import hyperdb 287 from roundup import hyperdb
288 288
289 designators = string.split(args[0], ',') 289 designators = args[0].split(',')
290 props = {} 290 props = {}
291 for prop in args[1:]: 291 for prop in args[1:]:
292 if prop.find('=') == -1: 292 if prop.find('=') == -1:
293 raise UsageError, 'argument "%s" not propname=value'%prop 293 raise UsageError, 'argument "%s" not propname=value'%prop
294 try: 294 try:
620 props.append((spec, int(width))) 620 props.append((spec, int(width)))
621 else: 621 else:
622 props.append((spec, len(spec))) 622 props.append((spec, len(spec)))
623 623
624 # now display the heading 624 # now display the heading
625 print ' '.join([string.capitalize(name) for name, width in props]) 625 print ' '.join([name.capitalize() for name, width in props])
626 626
627 # and the table data 627 # and the table data
628 for nodeid in cl.list(): 628 for nodeid in cl.list():
629 l = [] 629 l = []
630 for name, width in props: 630 for name, width in props:
698 This action indicates that a particular node is not to be retrieved by 698 This action indicates that a particular node is not to be retrieved by
699 the list or find commands, and its key value may be re-used. 699 the list or find commands, and its key value may be re-used.
700 ''' 700 '''
701 if len(args) < 1: 701 if len(args) < 1:
702 raise UsageError, 'Not enough arguments supplied' 702 raise UsageError, 'Not enough arguments supplied'
703 designators = string.split(args[0], ',') 703 designators = args[0].split(',')
704 for designator in designators: 704 for designator in designators:
705 try: 705 try:
706 classname, nodeid = roundupdb.splitDesignator(designator) 706 classname, nodeid = roundupdb.splitDesignator(designator)
707 except roundupdb.DesignatorError, message: 707 except roundupdb.DesignatorError, message:
708 raise UsageError, message 708 raise UsageError, message
722 tab-separated-value files that are placed in the nominated destination 722 tab-separated-value files that are placed in the nominated destination
723 directory. The journals are not exported. 723 directory. The journals are not exported.
724 ''' 724 '''
725 if len(args) < 2: 725 if len(args) < 2:
726 raise UsageError, 'Not enough arguments supplied' 726 raise UsageError, 'Not enough arguments supplied'
727 classes = string.split(args[0], ',') 727 classes = args[0].split(',')
728 dir = args[1] 728 dir = args[1]
729 729
730 # use the csv parser if we can - it's faster 730 # use the csv parser if we can - it's faster
731 if csv is not None: 731 if csv is not None:
732 p = csv.parser(field_sep=':') 732 p = csv.parser(field_sep=':')
736 try: 736 try:
737 cl = self.db.getclass(classname) 737 cl = self.db.getclass(classname)
738 except KeyError: 738 except KeyError:
739 raise UsageError, 'no such class "%s"'%classname 739 raise UsageError, 'no such class "%s"'%classname
740 f = open(os.path.join(dir, classname+'.csv'), 'w') 740 f = open(os.path.join(dir, classname+'.csv'), 'w')
741 f.write(string.join(cl.properties.keys(), ':') + '\n') 741 f.write(':'.join(cl.properties.keys()) + '\n')
742 742
743 # all nodes for this class 743 # all nodes for this class
744 properties = cl.properties.items() 744 properties = cl.properties.items()
745 for nodeid in cl.list(): 745 for nodeid in cl.list():
746 l = [] 746 l = []
976 tool = AdminTool() 976 tool = AdminTool()
977 sys.exit(tool.main()) 977 sys.exit(tool.main())
978 978
979 # 979 #
980 # $Log: not supported by cvs2svn $ 980 # $Log: not supported by cvs2svn $
981 # Revision 1.53 2001/12/13 00:20:00 richard
982 # . Centralised the python version check code, bumped version to 2.1.1 (really
983 # needs to be 2.1.2, but that isn't released yet :)
984 #
981 # Revision 1.52 2001/12/12 21:47:45 richard 985 # Revision 1.52 2001/12/12 21:47:45 richard
982 # . Message author's name appears in From: instead of roundup instance name 986 # . Message author's name appears in From: instead of roundup instance name
983 # (which still appears in the Reply-To:) 987 # (which still appears in the Reply-To:)
984 # . envelope-from is now set to the roundup-admin and not roundup itself so 988 # . envelope-from is now set to the roundup-admin and not roundup itself so
985 # delivery reports aren't sent to roundup (thanks Patrick Ohly) 989 # delivery reports aren't sent to roundup (thanks Patrick Ohly)

Roundup Issue Tracker: http://roundup-tracker.org/