Changeset 85 for cleverbox/branches/0.1
- Timestamp:
- 07/10/06 13:10:56 (6 years ago)
- Location:
- cleverbox/branches/0.1/cleverbox
- Files:
-
- 1 added
- 1 modified
-
CHANGELOG (added)
-
scripts/admin.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cleverbox/branches/0.1/cleverbox/scripts/admin.py
r82 r85 6 6 import sys 7 7 import traceback 8 import re 8 9 from trac import util 9 10 from trac.scripts.admin import TracAdmin … … 249 250 if not self._client_exists(client_name): 250 251 252 # Client name cannot contain strokes 253 if client_name.count('-') != 0: 254 print "** Client's identifier can not contain the '-' character." 255 return 256 251 257 # Information collection 252 258 collected_infos = { 'full_name' : None, … … 254 260 'ftp_password' : None } 255 261 256 print 257 print "Creating a new client." 258 print "Let's collect some informations about him : " 259 print 260 print " Please enter client's full name." 261 print " This will be used in several interface screens and in emails." 262 print 263 264 dfn = client_name.capitalize() 265 collected_infos['full_name'] = raw_input('Full Name [%s]> ' % dfn).strip() or dfn 266 267 print 268 print " Please enter client's home directory." 269 print " All data regarding client's projects will be stored in there." 270 print 271 272 dhd = os.path.join(self.getConfig('clients_root', 'general'), client_name) 273 collected_infos['home_dir'] = raw_input('Home Directory [%s]> ' % dhd).strip() or dhd 262 collected_infos['home_dir'] = os.path.join(self.getConfig('clients_root', 'general'), client_name) 274 263 275 264 # A few checks before effectively creating client … … 280 269 print "Directory %s is not writable or already exists, aborting." % collected_infos['home_dir'] 281 270 raise os.error 271 272 273 print 274 print "Creating a new client." 275 print "Let's collect some informations about him : " 276 print 277 print " Please enter client's full name." 278 print " This will be used in several interface screens and in emails." 279 print 280 281 dfn = client_name.capitalize() 282 collected_infos['full_name'] = raw_input('Full Name [%s]> ' % dfn).strip() or dfn 282 283 283 284 print … … 554 555 555 556 # Restrict to requested client 557 pattern = re.compile('(\w+)-(.*)') 556 558 if (client_name): 557 559 client_projects = [] 558 for p in list_projects: 559 if p.rsplit('-')[0] == client_name: 560 client_projects.append(p) 560 for project_name in list_projects: 561 matches = pattern.findall(project_name) 562 if (client_name == matches[0][0]): 563 client_projects.append(matches[0][1]) 561 564 list_projects = client_projects 562 565 563 # Filter out the "client-" part 564 filtered_list = [] 565 for p in list_projects: 566 filtered_list.append(p.rsplit('-')[1]) 567 568 return filtered_list 566 return list_projects 569 567 570 568 def _do_project_disable(self, args): … … 697 695 traceback.print_exc() 698 696 697 # -- Enable client ? 698 print "Project has been created. Do you want to enable it ?" 699 print 700 enable_project = raw_input('Enable project ? [y/N]> ').strip() or False 701 702 if enable_project == 'y': 703 self._do_project_enable((client_name, project_name)) 704 699 705 else: 700 706 self.do_help('project') … … 764 770 'project_name' : infos['short_name'], 765 771 'clients_root' : self.getConfig('clients_root', 'general'), 766 'ldap_password' : '<LDAP_PASSWORD>'}772 'ldap_password' : self.getConfig('ldap_password', 'general') } 767 773 768 774 apache_conf_filepath = os.path.join( self.envname, 'projects-available', '%s-%s' % (infos['client'], infos['short_name']) ) … … 936 942 comp = [] 937 943 938 # " enable" subcommand's first argument is client's name944 # "disable" subcommand's first argument is client's name 939 945 if not args or (len(args) <= 1 and args[0] not in self._get_clients()): 940 946 comp = self._get_clients() 941 # " enable" subcommand second argument is project's name947 # "disable" subcommand second argument is project's name 942 948 else : 943 949 comp = self._get_projects(args[0], 'enabled') … … 948 954 comp = [] 949 955 950 # " enable" subcommand's first argument is client's name956 # "remove" subcommand's first argument is client's name 951 957 if not args or (len(args) <= 1 and args[0] not in self._get_clients()): 952 958 comp = self._get_clients() 953 # " enable" subcommand second argument is project's name959 # "remove" subcommand second argument is project's name 954 960 else : 955 961 comp = self._get_projects(args[0]) … … 983 989 try: 984 990 if (os.path.isdir(directory)): 991 os.chown(directory, uid, gid) 985 992 direntries = os.listdir(directory) 986 993 for direntry in direntries:
