def addSequence(projectname): # input project name print log.debug("projectname = "+projectname) if os.access(env['trac']['project']+projectname+"/README", os.F_OK): print "" print log.info("already exists project name: "+projectname) sys.exit() else: print log.info("adding trac project: "+projectname) # ----------- create metadata db print log.info("create db \""+projectname+"\"") cmd_createdb = "su - postgres -c \'"+env['pgsql']['create']+" -E UTF-8 -O trac "+projectname+" \"Database for trac project "+projectname+"\"\'" print log.debug(cmd_createdb) print commands.getoutput(cmd_createdb) print log.info("complete.") print "" # ----------- create svn repos print log.info("create svn repos \""+projectname+"\"") cmd_svnadmin = env['svn']['admin']+" create "+env['svn']['repos']+"/"+projectname print log.debug(cmd_svnadmin) print commands.getoutput(cmd_svnadmin) print log.info("complete.") print "" # ----------- create trac project print log.info("create trac project \""+projectname+"\"") cmd_tracadmin = env['trac']['admin']+" "+env['trac']['project']+"/"+projectname+" initenv "+projectname+" " cmd_tracadmin += "postgres://*****:*****@localhost/"+projectname+" svn " cmd_tracadmin += env['svn']['repos']+"/"+projectname+" " cmd_tracadmin += env['trac']['template'] print log.debug(cmd_tracadmin) print "\033[1;32m" print "=========================================" print "=BEGINS= This message output from trac ==" print "=========================================" print commands.getoutput(cmd_tracadmin) print "=========================================" print "=FINISH= This message output from trac ==" print "=========================================" print "\033[0m" print log.info("complete.") print "" # ----------- set up misc. print log.info("setup misc..") chmod_path = env['trac']['project']+"/"+projectname cmd_misc = "chmod 777 "+chmod_path # print "<DBUG> "+cmd_misc commands.getoutput(cmd_misc) print commands.getstatus(chmod_path) cmd_misc = "chmod 777 "+chmod_path+"/log" # print "<DBUG> "+cmd_misc commands.getoutput(cmd_misc) print commands.getstatus(chmod_path+"/log") cmd_misc = "chmod 777 "+chmod_path+"/plugins" # print "<DBUG> "+cmd_misc commands.getoutput(cmd_misc) print commands.getstatus(chmod_path+"/plugins") print log.info("complete.") print ""
def addSequence(projectname): # input project name print log.debug("projectname = " + projectname) if os.access(env['trac']['project'] + projectname + "/README", os.F_OK): print "" print log.info("already exists project name: " + projectname) sys.exit() else: print log.info("adding trac project: " + projectname) # ----------- create metadata db print log.info("create db \"" + projectname + "\"") cmd_createdb = "su - postgres -c \'" + env['pgsql'][ 'create'] + " -E UTF-8 -O trac " + projectname + " \"Database for trac project " + projectname + "\"\'" print log.debug(cmd_createdb) print commands.getoutput(cmd_createdb) print log.info("complete.") print "" # ----------- create svn repos print log.info("create svn repos \"" + projectname + "\"") cmd_svnadmin = env['svn']['admin'] + " create " + env['svn'][ 'repos'] + "/" + projectname print log.debug(cmd_svnadmin) print commands.getoutput(cmd_svnadmin) print log.info("complete.") print "" # ----------- create trac project print log.info("create trac project \"" + projectname + "\"") cmd_tracadmin = env['trac']['admin'] + " " + env['trac'][ 'project'] + "/" + projectname + " initenv " + projectname + " " cmd_tracadmin += "postgres://*****:*****@localhost/" + projectname + " svn " cmd_tracadmin += env['svn']['repos'] + "/" + projectname + " " cmd_tracadmin += env['trac']['template'] print log.debug(cmd_tracadmin) print "\033[1;32m" print "=========================================" print "=BEGINS= This message output from trac ==" print "=========================================" print commands.getoutput(cmd_tracadmin) print "=========================================" print "=FINISH= This message output from trac ==" print "=========================================" print "\033[0m" print log.info("complete.") print "" # ----------- set up misc. print log.info("setup misc..") chmod_path = env['trac']['project'] + "/" + projectname cmd_misc = "chmod 777 " + chmod_path # print "<DBUG> "+cmd_misc commands.getoutput(cmd_misc) print commands.getstatus(chmod_path) cmd_misc = "chmod 777 " + chmod_path + "/log" # print "<DBUG> "+cmd_misc commands.getoutput(cmd_misc) print commands.getstatus(chmod_path + "/log") cmd_misc = "chmod 777 " + chmod_path + "/plugins" # print "<DBUG> "+cmd_misc commands.getoutput(cmd_misc) print commands.getstatus(chmod_path + "/plugins") print log.info("complete.") print ""
def delSequence(projectname): # input project name print log.debug("projectname = "+projectname) print env['trac']['project']+"/"+projectname+"/README" if os.access(env['trac']['project']+"/"+projectname+"/README", os.F_OK): print log.info("removing trac project: "+projectname) # ----------- drop metadata db print log.info("drop db "+projectname) cmd_dropdb = "su - postgres -c \""+env['pgsql']['drop']+" "+projectname+"\"" print log.debug(cmd_dropdb) print commands.getoutput(cmd_dropdb) print log.info("complete.") print "" # ----------- delete svn repos print log.info("delete svn repos "+projectname) cmd_rmrepos = "rm -rf "+env['svn']['repos']+"/"+projectname print log.debug(cmd_rmrepos) print commands.getoutput(cmd_rmrepos) print log.info("complete.") print "" # ----------- delete project dir print log.info("delete project dir "+projectname) cmd_rmproj = "rm -rf "+env['trac']['project']+"/"+projectname print log.debug(cmd_rmproj) print commands.getoutput(cmd_rmproj) print log.info("complete.") print "" else: print "" print log.fatal("Couldn't find project: "+projectname) sys.exit()
def delSequence(projectname): # input project name print log.debug("projectname = " + projectname) print env['trac']['project'] + "/" + projectname + "/README" if os.access(env['trac']['project'] + "/" + projectname + "/README", os.F_OK): print log.info("removing trac project: " + projectname) # ----------- drop metadata db print log.info("drop db " + projectname) cmd_dropdb = "su - postgres -c \"" + env['pgsql'][ 'drop'] + " " + projectname + "\"" print log.debug(cmd_dropdb) print commands.getoutput(cmd_dropdb) print log.info("complete.") print "" # ----------- delete svn repos print log.info("delete svn repos " + projectname) cmd_rmrepos = "rm -rf " + env['svn']['repos'] + "/" + projectname print log.debug(cmd_rmrepos) print commands.getoutput(cmd_rmrepos) print log.info("complete.") print "" # ----------- delete project dir print log.info("delete project dir " + projectname) cmd_rmproj = "rm -rf " + env['trac']['project'] + "/" + projectname print log.debug(cmd_rmproj) print commands.getoutput(cmd_rmproj) print log.info("complete.") print "" else: print "" print log.fatal("Couldn't find project: " + projectname) sys.exit()