annotate roundup-admin @ 127:0791d13baea7

Added vim command to all source so that we don't get no steenkin' tabs :)
author Richard Jones <richard@users.sourceforge.net>
date Sun, 29 Jul 2001 07:01:39 +0000
parents 3a7e5515c1bd
children 4a87e0b0d3f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1 #! /usr/bin/python
127
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 51
diff changeset
2 # $Id: roundup-admin,v 1.4 2001-07-29 07:01:39 richard Exp $
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
3
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
4 import sys
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
5 if int(sys.version[0]) < 2:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
6 print 'Roundup requires python 2.0 or later.'
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
7 sys.exit(1)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
8
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
9 import string, os, getpass
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
10 from roundup import date, roundupdb, init
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
11
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
12 def determineLogin(instance, argv, n = 2):
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
13 name = password = ''
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
14 if argv[2] == '-u':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
15 l = argv[3].split(':')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
16 name = l[0]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
17 if len(l) > 1:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
18 password = l[1]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
19 n = 4
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
20 elif os.environ.has_key('ROUNDUP_LOGIN'):
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
21 l = os.environ['ROUNDUP_LOGIN'].split(':')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
22 name = l[0]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
23 if len(l) > 1:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
24 password = l[1]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
25 while not name:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
26 name = raw_input('Login name: ')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
27 while not password:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
28 password = getpass.getpass(' password: ')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
29 # TODO use the password...
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
30 return n, instance.open(name)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
31
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
32 def usage(message=''):
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
33 if message: message = 'Problem: '+message+'\n'
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
34 print '''%sUsage:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
35
51
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
36 roundup [-i instance] init [template backend]
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
37 -- initialise the database
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
38 roundup [-i instance] spec classname
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
39 -- show the properties for a classname
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
40 roundup [-i instance] create [-u login] classname propname=value ...
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
41 -- create a new entry of a given class
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
42 roundup [-i instance] list [-c] classname
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
43 -- list the instances of a class
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
44 roundup [-i instance] history [-c] designator
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
45 -- show the history entries of a designator
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
46 roundup [-i instance] get [-c] designator[,designator,...] propname
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
47 -- get the given property of one or more designator(s)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
48 roundup [-i instance] set [-u login] designator[,designator,...] propname=value ...
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
49 -- set the given property of one or more designator(s)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
50 roundup [-i instance] find [-c] classname propname=value ...
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
51 -- find the class instances with a given property
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
52 roundup [-i instance] retire designator[,designator,...]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
53 -- "retire" a designator
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
54 roundup help
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
55 -- this help
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
56 roundup morehelp
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
57 -- even more detailed help
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
58 '''%message
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
59
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
60 def moreusage(message=''):
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
61 usage(message)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
62 print '''
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
63 All commands (except help) require an instance specifier. This is just the path
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
64 to the roundup instance you're working with. It may be specified in the environment
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
65 variable ROUNDUP_INSTANCE or on the command line as "-i instance".
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
66
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
67 A designator is a classname and a nodeid concatenated, eg. bug1, user10, ...
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
68
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
69 Property values are represented as strings in command arguments and in the
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
70 printed results:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
71 . Strings are, well, strings.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
72 . Date values are printed in the full date format in the local time zone, and
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
73 accepted in the full format or any of the partial formats explained below.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
74 . Link values are printed as node designators. When given as an argument,
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
75 node designators and key strings are both accepted.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
76 . Multilink values are printed as lists of node designators joined by commas.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
77 When given as an argument, node designators and key strings are both
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
78 accepted; an empty string, a single node, or a list of nodes joined by
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
79 commas is accepted.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
80
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
81 When multiple nodes are specified to the roundup get or roundup set
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
82 commands, the specified properties are retrieved or set on all the listed
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
83 nodes.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
84
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
85 When multiple results are returned by the roundup get or roundup find
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
86 commands, they are printed one per line (default) or joined by commas (with
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
87 the -c) option.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
88
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
89 Where the command changes data, a login name/password is required. The
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
90 login may be specified as either "name" or "name:password".
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
91 . ROUNDUP_LOGIN environment variable
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
92 . the -u command-line option
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
93 If either the name or password is not supplied, they are obtained from the
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
94 command-line.
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
95
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
96 Date format examples:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
97 "2000-04-17.03:45" means <Date 2000-04-17.08:45:00>
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
98 "2000-04-17" means <Date 2000-04-17.00:00:00>
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
99 "01-25" means <Date yyyy-01-25.00:00:00>
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
100 "08-13.22:13" means <Date yyyy-08-14.03:13:00>
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
101 "11-07.09:32:43" means <Date yyyy-11-07.14:32:43>
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
102 "14:25" means <Date yyyy-mm-dd.19:25:00>
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
103 "8:47:11" means <Date yyyy-mm-dd.13:47:11>
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
104 "." means "right now"
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
105 '''
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
106
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
107 def main():
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
108 argv = sys.argv
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
109
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
110 if len(argv) == 1:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
111 usage('No command specified')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
112 return 1
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
113
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
114 # handle help now
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
115 if argv[1] == 'help':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
116 usage()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
117 return 0
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
118 if argv[1] == 'morehelp':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
119 moreusage()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
120 return 0
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
121
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
122 # figure the instance home
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
123 n = 1
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
124 if argv[1] == '-i':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
125 if len(argv) == 2:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
126 usage()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
127 return 1
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
128 instance_home = argv[2]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
129 n = 3
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
130 else:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
131 instance_home = os.environ.get('ROUNDUP_INSTANCE', '')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
132
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
133 # now figure the command
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
134 command = argv[n]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
135 n = n + 1
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
136
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
137 if command == 'init':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
138 adminpw = ''
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
139 confirm = 'x'
51
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
140 if len(argv) > n:
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
141 template = argv[n]
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
142 backend = argv[n+1]
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
143 else:
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
144 template = backend = ''
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
145 while not instance_home:
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
146 instance_home = raw_input('Enter instance home: ').strip()
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
147 # TODO: list the templates
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
148 while not template:
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
149 template = raw_input('Select template: ').strip()
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
150 # TODO: list the backends
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
151 while not backend:
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
152 backend = raw_input('Select backend: ').strip()
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
153 while adminpw != confirm:
51
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
154 adminpw = getpass.getpass('Admin Password: ')
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
155 confirm = getpass.getpass(' Confirm: ')
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
156 init.init(instance_home, template, backend, adminpw)
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
157 return 0
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
158
51
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
159 # from here on, we need an instance_home
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
160 if not instance_home:
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
161 usage('No instance home specified')
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
162 return 1
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
163
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
164 # get the instance
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
165 path, instance = os.path.split(instance_home)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
166 sys.path.insert(0, path)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
167 try:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
168 instance = __import__(instance)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
169 finally:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
170 del sys.path[0]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
171
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
172 if command == 'get':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
173 db = instance.open()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
174 designators = string.split(argv[n], ',')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
175 propname = argv[n+1]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
176 # TODO: handle the -c option
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
177 for designator in designators:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
178 classname, nodeid = roundupdb.splitDesignator(designator)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
179 print db.getclass(classname).get(nodeid, propname)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
180
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
181 elif command == 'set':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
182 n, db = determineLogin(instance, argv, n)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
183 designators = string.split(argv[n], ',')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
184 props = {}
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
185 for prop in argv[n+1:]:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
186 key, value = prop.split('=')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
187 props[key] = value
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
188 for designator in designators:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
189 classname, nodeid = roundupdb.splitDesignator(designator)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
190 cl = db.getclass(classname)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
191 properties = cl.getprops()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
192 for key, value in props.items():
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
193 type = properties[key]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
194 if type.isStringType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
195 continue
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
196 elif type.isDateType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
197 props[key] = date.Date(value)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
198 elif type.isIntervalType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
199 props[key] = date.Interval(value)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
200 elif type.isLinkType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
201 props[key] = value
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
202 elif type.isMultilinkType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
203 props[key] = value.split(',')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
204 apply(cl.set, (nodeid, ), props)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
205
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
206 elif command == 'find':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
207 db = instance.open()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
208 classname = argv[n]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
209 cl = db.getclass(classname)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
210
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
211 # look up the linked-to class and get the nodeid that has the value
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
212 propname, value = argv[n+1:].split('=')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
213 propcl = cl[propname].classname
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
214 nodeid = propcl.lookup(value)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
215
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
216 # now do the find
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
217 # TODO: handle the -c option
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
218 print cl.find(propname, nodeid)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
219
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
220 elif command == 'spec':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
221 db = instance.open()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
222 classname = argv[n]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
223 cl = db.getclass(classname)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
224 for key, value in cl.properties.items():
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
225 print '%s: %s'%(key, value)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
226
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
227 elif command == 'create':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
228 n, db = determineLogin(instance, argv, n)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
229 classname = argv[n]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
230 cl = db.getclass(classname)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
231 props = {}
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
232 properties = cl.getprops()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
233 for prop in argv[n+1:]:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
234 key, value = prop.split('=')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
235 type = properties[key]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
236 if type.isStringType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
237 props[key] = value
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
238 elif type.isDateType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
239 props[key] = date.Date(value)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
240 elif type.isIntervalType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
241 props[key] = date.Interval(value)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
242 elif type.isLinkType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
243 props[key] = value
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
244 elif type.isMultilinkType:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
245 props[key] = value.split(',')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
246 print apply(cl.create, (), props)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
247
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
248 elif command == 'list':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
249 db = instance.open()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
250 classname = argv[n]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
251 cl = db.getclass(classname)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
252 key = cl.getkey() or cl.properties.keys()[0]
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
253 # TODO: handle the -c option
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
254 for nodeid in cl.list():
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
255 value = cl.get(nodeid, key)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
256 print "%4s: %s"%(nodeid, value)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
257
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
258 elif command == 'history':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
259 db = instance.open()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
260 classname, nodeid = roundupdb.splitDesignator(argv[n])
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
261 # TODO: handle the -c option
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
262 print db.getclass(classname).history(nodeid)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
263
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
264 elif command == 'retire':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
265 n, db = determineLogin(instance, argv, n)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
266 designators = string.split(argv[n], ',')
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
267 for designator in designators:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
268 classname, nodeid = roundupdb.splitDesignator(designator)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
269 db.getclass(classname).retire(nodeid)
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
270
48
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
271 elif command == 'freshen':
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
272 n, db = determineLogin(instance, argv, n)
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
273 for classname, cl in db.classes.items():
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
274 properties = cl.properties.keys()
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
275 for nodeid in cl.list():
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
276 node = {}
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
277 for name in properties:
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
278 node[name] = cl.get(nodeid, name)
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
279 db.setnode(classname, nodeid, node)
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
280
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
281 else:
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
282 print "Unknown command '%s'"%command
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
283 usage()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
284 return 1
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
285
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
286 db.close()
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
287 return 0
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
288
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
289 if __name__ == '__main__':
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
290 sys.exit(main())
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
291
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
292 #
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
293 # $Log: not supported by cvs2svn $
127
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 51
diff changeset
294 # Revision 1.3 2001/07/23 08:45:28 richard
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 51
diff changeset
295 # ok, so now "./roundup-admin init" will ask questions in an attempt to get a
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 51
diff changeset
296 # workable instance_home set up :)
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 51
diff changeset
297 # _and_ anydbm has had its first test :)
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 51
diff changeset
298 #
51
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
299 # Revision 1.2 2001/07/23 08:20:44 richard
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
300 # Moved over to using marshal in the bsddb and anydbm backends.
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
301 # roundup-admin now has a "freshen" command that'll load/save all nodes (not
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
302 # retired - mod hyperdb.Class.list() so it lists retired nodes)
3a7e5515c1bd ok, so now "./roundup-admin init" will ask questions...
Richard Jones <richard@users.sourceforge.net>
parents: 48
diff changeset
303 #
48
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
304 # Revision 1.1 2001/07/23 03:46:48 richard
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
305 # moving the bin files to facilitate out-of-the-boxness
671203878652 Moved over to using marshal in the bsddb and anydbm backends.
Richard Jones <richard@users.sourceforge.net>
parents: 27
diff changeset
306 #
27
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
307 # Revision 1.1 2001/07/22 11:15:45 richard
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
308 # More Grande Splite stuff
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
309 #
e5e9ea306a09 moving the bin files to facilitate out-of-the-boxness
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
310 #
127
0791d13baea7 Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents: 51
diff changeset
311 # vim: set filetype=python ts=4 sw=4 et si

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