import commands as cmd import cgi, cgitb cgitb.enable() print "Content-Type: text/html; charset=UTF-8;" print "" form = cgi.FieldStorage() # name=form.getvalue('name') # pltid=form.getvalue('pltID') username = form.getvalue('username') projectName = form.getvalue('projectName') pltid = form.getvalue('PltID') ContName = username + '_' + projectName cusr = Connection.connect() if (type(cusr) == int): print "Could not establish the connection" print pltid cusr.execute("select Name from Paltforms where PltID='{0}'".format(pltid)) img = cusr.fetchall()[0][0] db = Connection.getDB() crsr = db.cursor() crsr.execute("select max(port) from Containers") port = crsr.fetchall()[0][0] + 1 #Creating Directory
from package.connect import Connection import commands as cmd import os import cgi, cgitb cgitb.enable() print "Content-Type: text/html; charset=UTF-8;" print "" form = cgi.FieldStorage() # name=form.getvalue('name') # pltid=form.getvalue('pltID') contName = form.getvalue('operation') #removing from database db = Connection.getDB() cusr = db.cursor() cusr.execute( "select ContID from Containers where ContName='{0}'".format(contName)) contID = cusr.fetchall()[0][0] cusr.execute("delete from PAASUsers where ContID='{0}'".format(contID)) cusr.execute("delete from Containers where ContID='{0}'".format(contID)) #Deleting Directory os.system("rm -R -f /PAAS/{0}".format(contName)) # Deleting Container delState = cmd.getstatusoutput( "sshpass -p root ssh -o StrictHostKeyChecking=No root@server 'docker rm -f {0}' " .format(contName))
#!/usr/bin/python import uuid from random import randint import os from package.connect import Connection import cgi, cgitb cgitb.enable() print "Content-Type: text/html; charset=UTF-8;" print "" cr = Connection.connect()