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()
def showProjects(): print "" print "Current Projects list: " if os.access(env['svn']['repos'], os.F_OK): print commands.getoutput('ls -l '+env['svn']['repos']) else: print log.fatal("wrong path... check env['svn']['repos'].") print ""
def showProjects(): print "" print "Current Projects list: " if os.access(env['svn']['repos'], os.F_OK): print commands.getoutput('ls -l ' + env['svn']['repos']) else: print log.fatal("wrong path... check env['svn']['repos'].") print ""
def checkUser(): if commands.getoutput('whoami') != "root": print log.fatal("You must be root to add new trac-project!") sys.exit()