comparison roundup-admin @ 51:3a7e5515c1bd

ok, so now "./roundup-admin init" will ask questions... ...in an attempt to get a workable instance_home set up :) _and_ anydbm has had its first test :)
author Richard Jones <richard@users.sourceforge.net>
date Mon, 23 Jul 2001 08:45:28 +0000
parents 671203878652
children 0791d13baea7
comparison
equal deleted inserted replaced
50:674bd8e1b36e 51:3a7e5515c1bd
1 #! /usr/bin/python 1 #! /usr/bin/python
2 2
3 # $Id: roundup-admin,v 1.2 2001-07-23 08:20:44 richard Exp $ 3 # $Id: roundup-admin,v 1.3 2001-07-23 08:45:28 richard Exp $
4 4
5 import sys 5 import sys
6 if int(sys.version[0]) < 2: 6 if int(sys.version[0]) < 2:
7 print 'Roundup requires python 2.0 or later.' 7 print 'Roundup requires python 2.0 or later.'
8 sys.exit(1) 8 sys.exit(1)
32 32
33 def usage(message=''): 33 def usage(message=''):
34 if message: message = 'Problem: '+message+'\n' 34 if message: message = 'Problem: '+message+'\n'
35 print '''%sUsage: 35 print '''%sUsage:
36 36
37 roundup [-i instance] init template 37 roundup [-i instance] init [template backend]
38 -- initialise the database 38 -- initialise the database
39 roundup [-i instance] spec classname 39 roundup [-i instance] spec classname
40 -- show the properties for a classname 40 -- show the properties for a classname
41 roundup [-i instance] create [-u login] classname propname=value ... 41 roundup [-i instance] create [-u login] classname propname=value ...
42 -- create a new entry of a given class 42 -- create a new entry of a given class
128 return 1 128 return 1
129 instance_home = argv[2] 129 instance_home = argv[2]
130 n = 3 130 n = 3
131 else: 131 else:
132 instance_home = os.environ.get('ROUNDUP_INSTANCE', '') 132 instance_home = os.environ.get('ROUNDUP_INSTANCE', '')
133
134 # now figure the command
135 command = argv[n]
136 n = n + 1
137
138 if command == 'init':
139 adminpw = ''
140 confirm = 'x'
141 if len(argv) > n:
142 template = argv[n]
143 backend = argv[n+1]
144 else:
145 template = backend = ''
146 while not instance_home:
147 instance_home = raw_input('Enter instance home: ').strip()
148 # TODO: list the templates
149 while not template:
150 template = raw_input('Select template: ').strip()
151 # TODO: list the backends
152 while not backend:
153 backend = raw_input('Select backend: ').strip()
154 while adminpw != confirm:
155 adminpw = getpass.getpass('Admin Password: ')
156 confirm = getpass.getpass(' Confirm: ')
157 init.init(instance_home, template, backend, adminpw)
158 return 0
159
160 # from here on, we need an instance_home
133 if not instance_home: 161 if not instance_home:
134 usage('No instance home specified') 162 usage('No instance home specified')
135 return 1 163 return 1
136
137 # now figure the command
138 command = argv[n]
139 n = n + 1
140
141 if command == 'init':
142 adminpw = ''
143 confirm = 'x'
144 while adminpw != confirm:
145 adminpw = getpass.getpass('Admin Password:')
146 confirm = getpass.getpass(' Confirm:')
147 init.init(instance_home, argv[n], adminpw)
148 return 0
149 164
150 # get the instance 165 # get the instance
151 path, instance = os.path.split(instance_home) 166 path, instance = os.path.split(instance_home)
152 sys.path.insert(0, path) 167 sys.path.insert(0, path)
153 try: 168 try:
275 if __name__ == '__main__': 290 if __name__ == '__main__':
276 sys.exit(main()) 291 sys.exit(main())
277 292
278 # 293 #
279 # $Log: not supported by cvs2svn $ 294 # $Log: not supported by cvs2svn $
295 # Revision 1.2 2001/07/23 08:20:44 richard
296 # Moved over to using marshal in the bsddb and anydbm backends.
297 # roundup-admin now has a "freshen" command that'll load/save all nodes (not
298 # retired - mod hyperdb.Class.list() so it lists retired nodes)
299 #
280 # Revision 1.1 2001/07/23 03:46:48 richard 300 # Revision 1.1 2001/07/23 03:46:48 richard
281 # moving the bin files to facilitate out-of-the-boxness 301 # moving the bin files to facilitate out-of-the-boxness
282 # 302 #
283 # Revision 1.1 2001/07/22 11:15:45 richard 303 # Revision 1.1 2001/07/22 11:15:45 richard
284 # More Grande Splite stuff 304 # More Grande Splite stuff

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