Changeset 338 for cleverbox/branches/0.4/cleverbox/scripts/admin.py
- Timestamp:
- 05/03/08 09:55:04 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
cleverbox/branches/0.4/cleverbox/scripts/admin.py
r332 r338 69 69 self.envname = envname 70 70 self.prompt = "Cleverbox [%s] > " % self.envname 71 71 72 72 # Check if environment needs an upgrade 73 73 # - open VERSION … … 79 79 print "Please upgrade or downgrade your trac installation." 80 80 print 81 81 82 82 sys.exit(1) 83 83 84 84 env_version = open(os.path.join(self.envname, 'VERSION')).read().strip() 85 85 86 86 # - compare with self._version 87 87 # - if VERSION < self._version : 88 if parse_version(env_version) < parse_version(_version): 88 if parse_version(env_version) < parse_version(_version): 89 89 print "\nCleverbox environment needs to be upgraded. Please run :" 90 90 print " cleverbox-admin %s upgrade\n" % self.envname … … 93 93 # no VERSION file means user wants to create an environment 94 94 pass 95 95 96 96 if env is not None: 97 97 self.__env = env … … 185 185 # root user & group 186 186 # we keep the ssh_user notion for backward compatibility. 187 # this will have to disappear in a future release 187 # this will have to disappear in a future release 188 188 collected_infos['ssh_user'] = 0 189 189 collected_infos['ssh_group'] = 0 … … 191 191 # Host server domain name 192 192 collected_infos['domain'] = raw_input('Domain name > ').strip() 193 193 194 194 # Authentication backend password (if any) 195 195 collected_infos['authbackend_pass'] = raw_input('Authentication backend password (if any) []> ').strip() or '' … … 198 198 dcp = 'default' 199 199 collected_infos['default_profile'] = raw_input('Default configuration profile [%s]> ' % dcp).strip() or dcp 200 200 201 201 # Write ini file 202 202 self._config.add_section('general') … … 214 214 for directive, value in trac_infos.items() : 215 215 self._config.set('trac', directive, str(value)) 216 216 217 217 fh_config = open(os.path.join(self.envname, 'cleverbox.ini'), 'w+') 218 218 self._config.write(fh_config) … … 241 241 for filename in _defaults['profile_files']: 242 242 shutil.copy(collected_infos['assets_dir'] + '/' + filename, os.path.join(self.envname, 'profiles', 'default')) 243 243 244 244 245 245 print … … 251 251 def do_upgrade(self, line=None): 252 252 env_version = open(os.path.join(self.envname, 'VERSION')).read() 253 if parse_version(env_version) < parse_version(_version): 253 if parse_version(env_version) < parse_version(_version): 254 254 from cleverbox.upgrades import upgrades 255 255 i = 1 … … 261 261 break 262 262 i = i + 1 263 263 264 264 265 265 ## help … … 432 432 int(self.getConfig('ssh_user', 'general')), int(self.getConfig('apache_group', 'general')) ) 433 433 os.chmod( os.path.join(collected_infos['home_dir'], 'tmp'), 0775 ) 434 434 435 435 print " Fixed permissions in %s\n" % collected_infos['home_dir'] 436 436 … … 795 795 # -- Revoke all permissions in trac 796 796 self._project_trac_revoke_all_perms( collected_infos ) 797 797 798 798 # -- Trac initial permissions 799 799 self._project_trac_setperms( collected_infos ) … … 801 801 # -- Modifies Trac default conf 802 802 self._project_trac_defaultconf( collected_infos ) 803 803 804 804 # -- Fix perms 805 805 self._project_fix_perms( collected_infos ) … … 870 870 'var/svn', 871 871 infos['short_name'] ) 872 872 873 873 cmd_data = { 'env_path' : trac_env_path, 874 874 'title' : '"%s - %s - Trac"' % (infos['client'], infos['short_name']), … … 878 878 'trac_install_dir' : self.getConfig('lib_dir', 'trac')} 879 879 880 trac_cmd = ' /usr/bin/trac-admin %(env_path)s initenv %(title)s %(db_dsn)s svn %(svn_path)s %(templates_path)s' % cmd_data881 880 trac_cmd = 'trac-admin %(env_path)s initenv %(title)s %(db_dsn)s svn %(svn_path)s %(templates_path)s' % cmd_data 881 882 882 (stdin, stdout, stderr) = os.popen3( trac_cmd ) 883 883 … … 923 923 def _project_trac_revoke_all_perms(self, infos): 924 924 import trac.env 925 925 926 926 trac_env_path = os.path.join( self.getConfig('clients_root', 'general'), 927 927 infos['client'], 928 928 'var/trac', 929 929 infos['short_name'] ) 930 930 931 931 # Revoke all permissions 932 932 trac_env = trac.env.open_environment(trac_env_path) … … 935 935 db_cursor.execute('DELETE FROM permission') 936 936 trac_db.commit() 937 937 938 938 print " Revoked Trac default permissions\n" 939 939 … … 970 970 infos['short_name'], 971 971 'conf','trac.ini' ) 972 os.chmod( trac_ini_path, 0777 ) 972 os.chmod( trac_ini_path, 0777 ) 973 973 974 974 # Subversion repository … … 996 996 Overrides project's default trac.ini with values provided in configuration profile. 997 997 """ 998 998 999 999 # New defaults 1000 1000 tracdefaults_config = ConfigParser.SafeConfigParser() 1001 1001 tracdefaults_config.read(os.path.join(self.envname, 'profiles', infos['profile'], 'trac-defaults.ini')) 1002 1002 1003 1003 # Trac base config file 1004 1004 project_config_path = os.path.join(self.getConfig('clients_root', 'general'), infos['client'], 'var', 'trac', infos['short_name'], 'conf', 'trac.ini')
