Commit 212af295 authored by Alain Takoudjou's avatar Alain Takoudjou

Merge branch 'slaprunner'

parents 4a21f210 fba37096
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
margin:34px 0 0; margin:34px 0 0;
} }
.tabContents{ .tabContents{
padding:20px padding:20px;
min-height: 250px;
} }
.tabContents p{ .tabContents p{
padding:0 0 10px; padding:0 0 10px;
......
...@@ -27,7 +27,8 @@ td{ ...@@ -27,7 +27,8 @@ td{
border-bottom: 1px solid #A8A8A8; border-bottom: 1px solid #A8A8A8;
border-right: 1px solid #A8A8A8; border-right: 1px solid #A8A8A8;
} }
td.propertie{padding-left:10px; color:blue;} td.propertie{padding-left:10px; color:blue;width: 178px;}
.slapvalues{display:block;width: 375px;word-wrap: break-word}
td.first{border-left: 1px solid #A8A8A8;} td.first{border-left: 1px solid #A8A8A8;}
th{ th{
background: #2281C1; background: #2281C1;
...@@ -505,6 +506,7 @@ h2.hight:hover{ ...@@ -505,6 +506,7 @@ h2.hight:hover{
width: 754px; width: 754px;
padding: 2px; padding: 2px;
height: 450px; height: 450px;
font-size: 13px;
} }
.log_btn{border: 1px solid #678dad; border-top:none; height: 22px; width: 654px; margin: 0 40px 10px 40px; .log_btn{border: 1px solid #678dad; border-top:none; height: 22px; width: 654px; margin: 0 40px 10px 40px;
padding:4px 10px 4px 10px; font-size: 16px; color: #4c6172;} padding:4px 10px 4px 10px; font-size: 16px; color: #4c6172;}
...@@ -715,4 +717,4 @@ padding:10px; font-size:14px; color:#03406A} ...@@ -715,4 +717,4 @@ padding:10px; font-size:14px; color:#03406A}
.login-label{padding:5px; font-size:16px;} .login-label{padding:5px; font-size:16px;}
.login-input{width:220px;} .login-input{width:220px;}
.information{display:block; float:left; height:16px; margin-top:10px; margin-left:10px; font-weight:bold} .information{display:block; float:left; height:16px; margin-top:10px; margin-left:10px; font-weight:bold}
.account{margin-left:60px;} .account{margin-left:60px;}
\ No newline at end of file
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
} }
else{setupBox();} else{setupBox();}
function setupBox(){ function setupBox(){
if (msg == undefined){
msg = "Cannot execute your request. Please make sure you are logged in!!"
option.type = "error";
}
$box.empty(); $box.empty();
$box.css('top','-1000px'); $box.css('top','-1000px');
$box.show(); $box.show();
...@@ -66,4 +70,4 @@ ...@@ -66,4 +70,4 @@
} }
} }
}); });
}(jQuery, document, this)); }(jQuery, document, this));
\ No newline at end of file
...@@ -62,13 +62,13 @@ ...@@ -62,13 +62,13 @@
</h2> </h2>
<div class="clear"></div><br/> <div class="clear"></div><br/>
<div id="bcontent{{item[0]}}"> <div id="bcontent{{item[0]}}">
<table cellpadding="0" cellspacing="0" width="100%"> <table cellpadding="0" cellspacing="0" width="577">
<tr> <tr>
<th>Parameter Name</th><th>Parameter Value</th> <th>Parameter Name</th><th>Parameter Value</th>
</tr> </tr>
{% for k in item[1] %} {% for k in item[1] %}
<tr> <tr>
<td class="propertie first">{{k}}</td><td align='left'>{{item[1][k]}}</td> <td class="propertie first">{{k}}</td><td align='left'><span class="slapvalues">{{item[1][k]}}</span></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
...@@ -140,3 +140,4 @@ ...@@ -140,3 +140,4 @@
</div> </div>
{{instance}} {{instance}}
{% endblock %} {% endblock %}
...@@ -102,7 +102,7 @@ def updateProxy(config): ...@@ -102,7 +102,7 @@ def updateProxy(config):
slap = slapos.slap.slap() slap = slapos.slap.slap()
#Get current software release profile #Get current software release profile
try: try:
software_folder = open(os.path.join(config['runner_workdir'], software_folder = open(os.path.join(config['etc_dir'],
".project")).read() ".project")).read()
profile = realpath(config, os.path.join(software_folder, profile = realpath(config, os.path.join(software_folder,
config['software_profile'])) config['software_profile']))
...@@ -136,7 +136,7 @@ def updateProxy(config): ...@@ -136,7 +136,7 @@ def updateProxy(config):
'tap': {'name': partition_reference}, 'tap': {'name': partition_reference},
}) })
#get instance parameter #get instance parameter
param_path = os.path.join(config['runner_workdir'], ".parameter.xml") param_path = os.path.join(config['etc_dir'], ".parameter.xml")
xml_result = readParameters(param_path) xml_result = readParameters(param_path)
partition_parameter_kw = None partition_parameter_kw = None
if type(xml_result) != type('') and xml_result.has_key('instance'): if type(xml_result) != type('') and xml_result.has_key('instance'):
...@@ -174,14 +174,14 @@ def updateInstanceParameter(config, software_type=None): ...@@ -174,14 +174,14 @@ def updateInstanceParameter(config, software_type=None):
slap.initializeConnection(config['master_url']) slap.initializeConnection(config['master_url'])
#Get current software release profile #Get current software release profile
try: try:
software_folder = open(os.path.join(config['runner_workdir'], software_folder = open(os.path.join(config['etc_dir'],
".project")).read() ".project")).read()
profile = realpath(config, os.path.join(software_folder, profile = realpath(config, os.path.join(software_folder,
config['software_profile'])) config['software_profile']))
except: except:
raise Exception("Software Release profile not found") raise Exception("Software Release profile not found")
#get instance parameter #get instance parameter
param_path = os.path.join(config['runner_workdir'], ".parameter.xml") param_path = os.path.join(config['etc_dir'], ".parameter.xml")
xml_result = readParameters(param_path) xml_result = readParameters(param_path)
partition_parameter_kw = None partition_parameter_kw = None
if type(xml_result) != type('') and xml_result.has_key('instance'): if type(xml_result) != type('') and xml_result.has_key('instance'):
...@@ -192,7 +192,7 @@ def updateInstanceParameter(config, software_type=None): ...@@ -192,7 +192,7 @@ def updateInstanceParameter(config, software_type=None):
def startProxy(config): def startProxy(config):
"""Start Slapproxy server""" """Start Slapproxy server"""
proxy_pid = os.path.join(config['runner_workdir'], 'proxy.pid') proxy_pid = os.path.join(config['etc_dir'], 'proxy.pid')
pid = readPid(proxy_pid) pid = readPid(proxy_pid)
running = False running = False
if pid: if pid:
...@@ -204,14 +204,14 @@ def startProxy(config): ...@@ -204,14 +204,14 @@ def startProxy(config):
running = True running = True
if not running: if not running:
proxy = Popen([config['slapproxy'], config['configuration_file_path']]) proxy = Popen([config['slapproxy'], config['configuration_file_path']])
proxy_pid = os.path.join(config['runner_workdir'], 'proxy.pid') proxy_pid = os.path.join(config['etc_dir'], 'proxy.pid')
writePid(proxy_pid, proxy.pid) writePid(proxy_pid, proxy.pid)
time.sleep(5) time.sleep(5)
def stopProxy(config): def stopProxy(config):
"""Stop Slapproxy server""" """Stop Slapproxy server"""
pid = readPid(os.path.join(config['runner_workdir'], 'proxy.pid')) pid = readPid(os.path.join(config['etc_dir'], 'proxy.pid'))
if pid: if pid:
try: try:
os.kill(pid) os.kill(pid)
...@@ -229,7 +229,7 @@ def isSoftwareRunning(config): ...@@ -229,7 +229,7 @@ def isSoftwareRunning(config):
""" """
Return True if slapgrid-sr is still running and false if slapgrid if not Return True if slapgrid-sr is still running and false if slapgrid if not
""" """
slapgrid_pid = os.path.join(config['runner_workdir'], 'slapgrid-sr.pid') slapgrid_pid = os.path.join(config['etc_dir'], 'slapgrid-sr.pid')
pid = readPid(slapgrid_pid) pid = readPid(slapgrid_pid)
if pid: if pid:
try: try:
...@@ -248,7 +248,7 @@ def runSoftwareWithLock(config): ...@@ -248,7 +248,7 @@ def runSoftwareWithLock(config):
Use Slapgrid to compile current Software Release and wait until Use Slapgrid to compile current Software Release and wait until
compilation is done compilation is done
""" """
slapgrid_pid = os.path.join(config['runner_workdir'], 'slapgrid-sr.pid') slapgrid_pid = os.path.join(config['etc_dir'], 'slapgrid-sr.pid')
if not isSoftwareRunning(config): if not isSoftwareRunning(config):
if not os.path.exists(config['software_root']): if not os.path.exists(config['software_root']):
os.mkdir(config['software_root']) os.mkdir(config['software_root'])
...@@ -268,20 +268,20 @@ def runSoftwareWithLock(config): ...@@ -268,20 +268,20 @@ def runSoftwareWithLock(config):
slapgrid.wait() slapgrid.wait()
#Saves the current compile software for re-use #Saves the current compile software for re-use
#This uses the new folder create by slapgrid (if not exits yet) #This uses the new folder create by slapgrid (if not exits yet)
data = loadSoftwareData(config['runner_workdir']) data = loadSoftwareData(config['etc_dir'])
md5 = "" md5 = ""
for path in os.listdir(config['software_root']): for path in os.listdir(config['software_root']):
exist = False exist = False
for val in data: for val in data:
if val['md5'] == path: if val['md5'] == path:
exist = True exist = True
conf = os.path.join(config['runner_workdir'], ".project") conf = os.path.join(config['etc_dir'], ".project")
if not exist: #save this compile software folder if not exist: #save this compile software folder
if os.path.exists(conf): if os.path.exists(conf):
data.append({"title":getProjectTitle(config), "md5":path, data.append({"title":getProjectTitle(config), "md5":path,
"path": open(os.path.join(config['runner_workdir'], "path": open(os.path.join(config['etc_dir'],
".project"), 'r').read()}) ".project"), 'r').read()})
writeSoftwareData(config['runner_workdir'], data) writeSoftwareData(config['etc_dir'], data)
else: else:
shutil.rmtree(os.path.join(config['software_root'], path)) shutil.rmtree(os.path.join(config['software_root'], path))
break break
...@@ -293,7 +293,7 @@ def isInstanceRunning(config): ...@@ -293,7 +293,7 @@ def isInstanceRunning(config):
""" """
Return True if slapgrid-cp is still running and false if slapgrid if not Return True if slapgrid-cp is still running and false if slapgrid if not
""" """
slapgrid_pid = os.path.join(config['runner_workdir'], 'slapgrid-cp.pid') slapgrid_pid = os.path.join(config['etc_dir'], 'slapgrid-cp.pid')
pid = readPid(slapgrid_pid) pid = readPid(slapgrid_pid)
if pid: if pid:
try: try:
...@@ -308,7 +308,7 @@ def isInstanceRunning(config): ...@@ -308,7 +308,7 @@ def isInstanceRunning(config):
def killRunningSlapgrid(config, ptype): def killRunningSlapgrid(config, ptype):
"""Kill slapgrid process and all running children process""" """Kill slapgrid process and all running children process"""
slapgrid_pid = os.path.join(config['runner_workdir'], ptype) slapgrid_pid = os.path.join(config['etc_dir'], ptype)
pid = readPid(slapgrid_pid) pid = readPid(slapgrid_pid)
if pid: if pid:
recursifKill([pid]) recursifKill([pid])
...@@ -340,7 +340,7 @@ def runInstanceWithLock(config): ...@@ -340,7 +340,7 @@ def runInstanceWithLock(config):
Use Slapgrid to deploy current Software Release and wait until Use Slapgrid to deploy current Software Release and wait until
deployment is done. deployment is done.
""" """
slapgrid_pid = os.path.join(config['runner_workdir'], 'slapgrid-cp.pid') slapgrid_pid = os.path.join(config['etc_dir'], 'slapgrid-cp.pid')
if not isInstanceRunning(config): if not isInstanceRunning(config):
startProxy(config) startProxy(config)
logfile = open(config['instance_log'], 'w') logfile = open(config['instance_log'], 'w')
...@@ -390,18 +390,6 @@ def getSlapStatus(config): ...@@ -390,18 +390,6 @@ def getSlapStatus(config):
partition_list.append((slappart_id, [])) partition_list.append((slappart_id, []))
return partition_list return partition_list
def runBuildoutAnnotate(config):
slapgrid_pid = os.path.join(config['runner_workdir'], 'slapgrid-sr.pid')
if not isSoftwareRunning(config):
bin_buildout = os.path.join(config['software_root'], "bin/buildout")
if os.path.exists(bin_buildout):
logfile = open(config['annotate_log'], 'w')
buildout = Popen([bin_buildout, '-vc', config['configuration_file_path'],
"annotate"], stdout=logfile)
buildout.wait()
return True
return False
def svcStopAll(config): def svcStopAll(config):
"""Stop all Instance process on this computer""" """Stop all Instance process on this computer"""
return Popen([config['supervisor'], config['configuration_file_path'], return Popen([config['supervisor'], config['configuration_file_path'],
...@@ -561,10 +549,10 @@ def configNewSR(config, projectpath): ...@@ -561,10 +549,10 @@ def configNewSR(config, projectpath):
removeProxyDb(config) removeProxyDb(config)
startProxy(config) startProxy(config)
removeInstanceRoot(config) removeInstanceRoot(config)
param_path = os.path.join(config['runner_workdir'], ".parameter.xml") param_path = os.path.join(config['etc_dir'], ".parameter.xml")
if os.path.exists(param_path): if os.path.exists(param_path):
os.remove(param_path) os.remove(param_path)
open(os.path.join(config['runner_workdir'], ".project"), 'w').write(projectpath) open(os.path.join(config['etc_dir'], ".project"), 'w').write(projectpath)
return True return True
else: else:
return False return False
...@@ -579,25 +567,22 @@ def newSoftware(folder, config, session): ...@@ -579,25 +567,22 @@ def newSoftware(folder, config, session):
session: Flask session directory""" session: Flask session directory"""
json = "" json = ""
code = 0 code = 0
runner_dir = config['runner_workdir'] basedir = config['etc_dir']
try: try:
folderPath = realpath(config, folder, check_exist=False) folderPath = realpath(config, folder, check_exist=False)
if folderPath and not os.path.exists(folderPath): if folderPath and not os.path.exists(folderPath):
os.mkdir(folderPath) os.mkdir(folderPath)
#load software.cfg and instance.cfg from http://git.erp5.org #load software.cfg and instance.cfg from http://git.erp5.org
software = "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/lamp-template/software.cfg" software = "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/lamp-template/software.cfg"
instance = "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/lamp-template/instance.cfg"
softwareContent = "" softwareContent = ""
instanceContent = ""
try: try:
softwareContent = urllib.urlopen(software).read() softwareContent = urllib.urlopen(software).read()
instanceContent = urllib.urlopen(instance).read()
except: except:
#Software.cfg and instance.cfg content will be empty #Software.cfg and instance.cfg content will be empty
pass pass
open(os.path.join(folderPath, config['software_profile']), 'w').write(softwareContent) open(os.path.join(folderPath, config['software_profile']), 'w').write(softwareContent)
open(os.path.join(folderPath, config['instance_profile']), 'w').write(instanceContent) open(os.path.join(folderPath, config['instance_profile']), 'w').write("")
open(os.path.join(runner_dir, ".project"), 'w').write(folder + "/") open(os.path.join(basedir, ".project"), 'w').write(folder + "/")
session['title'] = getProjectTitle(config) session['title'] = getProjectTitle(config)
code = 1 code = 1
else: else:
...@@ -618,7 +603,7 @@ def checkSoftwareFolder(path, config): ...@@ -618,7 +603,7 @@ def checkSoftwareFolder(path, config):
def getProjectTitle(config): def getProjectTitle(config):
"""Generate the name of the current software Release (for slaprunner UI)""" """Generate the name of the current software Release (for slaprunner UI)"""
conf = os.path.join(config['runner_workdir'], ".project") conf = os.path.join(config['etc_dir'], ".project")
if os.path.exists(conf): if os.path.exists(conf):
project = open(conf, "r").read().split("/") project = open(conf, "r").read().split("/")
software = project[len(project) - 2] software = project[len(project) - 2]
...@@ -627,22 +612,22 @@ def getProjectTitle(config): ...@@ -627,22 +612,22 @@ def getProjectTitle(config):
def getSoftwareReleaseName(config): def getSoftwareReleaseName(config):
"""Get the name of the current Software Release""" """Get the name of the current Software Release"""
sr_profile = os.path.join(config['runner_workdir'], ".project") sr_profile = os.path.join(config['etc_dir'], ".project")
if os.path.exists(sr_profile): if os.path.exists(sr_profile):
project = open(sr_profile, "r").read().split("/") project = open(sr_profile, "r").read().split("/")
software = project[len(project) - 2] software = project[len(project) - 2]
return software.replace(' ', '_') return software.replace(' ', '_')
return "No_name" return "No_name"
def loadSoftwareData(runner_dir): def loadSoftwareData(basedir):
"""Get All Compiled Softwares Releases name and directory """Get All Compiled Softwares Releases name and directory
Agrs: Agrs:
runner_dir: base directory of slapos web runner. basedir: base directory of slapos web runner.
Returns: Returns:
a dictionnary that contains all compiled Software Release with path""" a dictionnary that contains all compiled Software Release with path"""
import pickle import pickle
file_path = os.path.join(runner_dir, '.softdata') file_path = os.path.join(basedir, '.softdata')
if not os.path.exists(file_path): if not os.path.exists(file_path):
return [] return []
pkl_file = open(file_path, 'rb') pkl_file = open(file_path, 'rb')
...@@ -650,15 +635,15 @@ def loadSoftwareData(runner_dir): ...@@ -650,15 +635,15 @@ def loadSoftwareData(runner_dir):
pkl_file.close() pkl_file.close()
return data return data
def writeSoftwareData(runner_dir, data): def writeSoftwareData(basedir, data):
"""Save the list of compiled Software Release into a file """Save the list of compiled Software Release into a file
Args: Args:
runner_dir: base directory of slapos web runner. basedir: base directory of slapos web runner.
data: dictionnary data about real name and directory of each software release data: dictionnary data about real name and directory of each software release
""" """
import pickle import pickle
file_path = os.path.join(runner_dir, '.softdata') file_path = os.path.join(basedir, '.softdata')
pkl_file = open(file_path, 'wb') pkl_file = open(file_path, 'wb')
# Pickle dictionary using protocol 0. # Pickle dictionary using protocol 0.
pickle.dump(data, pkl_file) pickle.dump(data, pkl_file)
...@@ -678,12 +663,12 @@ def removeSoftwareByName(config, folderName): ...@@ -678,12 +663,12 @@ def removeSoftwareByName(config, folderName):
svcStopAll(config) svcStopAll(config)
shutil.rmtree(path) shutil.rmtree(path)
#update compiled software list #update compiled software list
data = loadSoftwareData(config['runner_workdir']) data = loadSoftwareData(config['etc_dir'])
i = 0 i = 0
for p in data: for p in data:
if p['md5'] == folderName: if p['md5'] == folderName:
del data[i] del data[i]
writeSoftwareData(config['runner_workdir'], data) writeSoftwareData(config['etc_dir'], data)
break break
i = i+1 i = i+1
return data return data
...@@ -815,4 +800,4 @@ def readParameters(path): ...@@ -815,4 +800,4 @@ def readParameters(path):
except Exception, e: except Exception, e:
return str(e) return str(e)
else: else:
return "No such file or directory: " + path return "No such file or directory: " + path
\ No newline at end of file
...@@ -79,7 +79,7 @@ def doLogin(): ...@@ -79,7 +79,7 @@ def doLogin():
# software views # software views
@login_required() @login_required()
def editSoftwareProfile(): def editSoftwareProfile():
profile = getProfilePath(app.config['runner_workdir'], app.config['software_profile']) profile = getProfilePath(app.config['etc_dir'], app.config['software_profile'])
if profile == "": if profile == "":
flash('Error: can not open profile, please select your project first') flash('Error: can not open profile, please select your project first')
return render_template('updateSoftwareProfile.html', workDir='workspace', return render_template('updateSoftwareProfile.html', workDir='workspace',
...@@ -92,18 +92,18 @@ def inspectSoftware(): ...@@ -92,18 +92,18 @@ def inspectSoftware():
else: else:
result = app.config['software_root'] result = app.config['software_root']
return render_template('runResult.html', softwareRoot='software_root', return render_template('runResult.html', softwareRoot='software_root',
softwares=loadSoftwareData(app.config['runner_workdir'])) softwares=loadSoftwareData(app.config['etc_dir']))
#remove content of compiled software release #remove content of compiled software release
@login_required() @login_required()
def removeSoftware(): def removeSoftware():
file_config = os.path.join(app.config['runner_workdir'], ".softdata") file_config = os.path.join(app.config['etc_dir'], ".softdata")
if isSoftwareRunning(app.config) or isInstanceRunning(app.config): if isSoftwareRunning(app.config) or isInstanceRunning(app.config):
flash('Software installation or instantiation in progress, cannot remove') flash('Software installation or instantiation in progress, cannot remove')
elif os.path.exists(file_config): elif os.path.exists(file_config):
svcStopAll(app.config) svcStopAll(app.config)
shutil.rmtree(app.config['software_root']) shutil.rmtree(app.config['software_root'])
os.remove(os.path.join(app.config['runner_workdir'], ".softdata")) os.remove(file_config)
flash('Software removed') flash('Software removed')
return redirect(url_for('inspectSoftware')) return redirect(url_for('inspectSoftware'))
...@@ -121,12 +121,12 @@ def viewSoftwareLog(): ...@@ -121,12 +121,12 @@ def viewSoftwareLog():
else: else:
result = 'Not found yet' result = 'Not found yet'
return render_template('viewLog.html', type='software', return render_template('viewLog.html', type='software',
result=result) result=result.encode("utf-8"))
# instance views # instance views
@login_required() @login_required()
def editInstanceProfile(): def editInstanceProfile():
profile = getProfilePath(app.config['runner_workdir'], app.config['instance_profile']) profile = getProfilePath(app.config['etc_dir'], app.config['instance_profile'])
if profile == "": if profile == "":
flash('Error: can not open instance profile for this Software Release') flash('Error: can not open instance profile for this Software Release')
return render_template('updateInstanceProfile.html', workDir='workspace', return render_template('updateInstanceProfile.html', workDir='workspace',
...@@ -171,7 +171,7 @@ def removeInstance(): ...@@ -171,7 +171,7 @@ def removeInstance():
removeProxyDb(app.config) removeProxyDb(app.config)
startProxy(app.config) startProxy(app.config)
removeInstanceRoot(app.config) removeInstanceRoot(app.config)
param_path = os.path.join(app.config['runner_workdir'], ".parameter.xml") param_path = os.path.join(app.config['etc_dir'], ".parameter.xml")
if os.path.exists(param_path): if os.path.exists(param_path):
os.remove(param_path) os.remove(param_path)
flash('Instance removed') flash('Instance removed')
...@@ -193,7 +193,7 @@ def viewInstanceLog(): ...@@ -193,7 +193,7 @@ def viewInstanceLog():
else: else:
result = 'Not found yet' result = 'Not found yet'
return render_template('viewLog.html', type='instance', return render_template('viewLog.html', type='instance',
result=result) result=result.encode("utf-8"))
@login_required() @login_required()
def stopAllPartition(): def stopAllPartition():
...@@ -210,15 +210,6 @@ def startStopProccess(process, action): ...@@ -210,15 +210,6 @@ def startStopProccess(process, action):
svcStartStopProcess(app.config, process, action) svcStartStopProcess(app.config, process, action)
return redirect(url_for('inspectInstance')) return redirect(url_for('inspectInstance'))
@login_required()
def viewBuildoudAnnotate():
if os.path.exists(app.config['annotate_log']):
result = open(app.config['annotate_log'], 'r').read()
else:
result = 'Not found yet'
return render_template('viewLog.html', type='Instance',
result=result, running=isInstanceRunning(app.config))
@login_required(login_redirect) @login_required(login_redirect)
def openProject(method): def openProject(method):
return render_template('projectFolder.html', method=method, return render_template('projectFolder.html', method=method,
...@@ -271,7 +262,7 @@ def getProjectStatus(): ...@@ -271,7 +262,7 @@ def getProjectStatus():
#view for current software release files #view for current software release files
@login_required() @login_required()
def editCurrentProject(): def editCurrentProject():
project = os.path.join(app.config['runner_workdir'], ".project") project = os.path.join(app.config['etc_dir'], ".project")
if os.path.exists(project): if os.path.exists(project):
return render_template('softwareFolder.html', workDir='workspace', return render_template('softwareFolder.html', workDir='workspace',
project=open(project).read(), project=open(project).read(),
...@@ -438,11 +429,11 @@ def getPath(): ...@@ -438,11 +429,11 @@ def getPath():
#update instance parameter into a local xml file #update instance parameter into a local xml file
@login_required() @login_required()
def saveParameterXml(): def saveParameterXml():
project = os.path.join(app.config['runner_workdir'], ".project") project = os.path.join(app.config['etc_dir'], ".project")
if not os.path.exists(project): if not os.path.exists(project):
return jsonify(code=0, result="Please first open a Software Release") return jsonify(code=0, result="Please first open a Software Release")
content = request.form['parameter'].encode("utf-8") content = request.form['parameter'].encode("utf-8")
param_path = os.path.join(app.config['runner_workdir'], ".parameter.xml") param_path = os.path.join(app.config['etc_dir'], ".parameter.xml")
try: try:
f = open(param_path, 'w') f = open(param_path, 'w')
f.write(content) f.write(content)
...@@ -465,7 +456,7 @@ def saveParameterXml(): ...@@ -465,7 +456,7 @@ def saveParameterXml():
#read instance parameters into the local xml file and return a dict #read instance parameters into the local xml file and return a dict
@login_required() @login_required()
def getParameterXml(request): def getParameterXml(request):
param_path = os.path.join(app.config['runner_workdir'], ".parameter.xml") param_path = os.path.join(app.config['etc_dir'], ".parameter.xml")
if not os.path.exists(param_path): if not os.path.exists(param_path):
default = '<?xml version="1.0" encoding="utf-8"?>\n' default = '<?xml version="1.0" encoding="utf-8"?>\n'
default += '<instance>\n</instance>' default += '<instance>\n</instance>'
...@@ -483,7 +474,6 @@ def getParameterXml(request): ...@@ -483,7 +474,6 @@ def getParameterXml(request):
@login_required() @login_required()
def updateAccount(): def updateAccount():
account = [] account = []
user = os.path.join(app.config['runner_workdir'], '.users')
account.append(request.form['username'].strip()) account.append(request.form['username'].strip())
account.append(request.form['password'].strip()) account.append(request.form['password'].strip())
account.append(request.form['email'].strip()) account.append(request.form['email'].strip())
...@@ -504,7 +494,6 @@ def configAccount(): ...@@ -504,7 +494,6 @@ def configAccount():
last_account = getSession(app.config) last_account = getSession(app.config)
if not last_account: if not last_account:
account = [] account = []
user = os.path.join(app.config['runner_workdir'], '.users')
account.append(request.form['username'].strip()) account.append(request.form['username'].strip())
account.append(request.form['password'].strip()) account.append(request.form['password'].strip())
account.append(request.form['email'].strip()) account.append(request.form['email'].strip())
...@@ -536,7 +525,6 @@ app.add_url_rule('/viewInstanceLog', 'viewInstanceLog', viewInstanceLog, methods ...@@ -536,7 +525,6 @@ app.add_url_rule('/viewInstanceLog', 'viewInstanceLog', viewInstanceLog, methods
app.add_url_rule('/stopAllPartition', 'stopAllPartition', stopAllPartition, methods=['GET']) app.add_url_rule('/stopAllPartition', 'stopAllPartition', stopAllPartition, methods=['GET'])
app.add_url_rule('/tailProcess/name/<process>', 'tailProcess', tailProcess, methods=['GET']) app.add_url_rule('/tailProcess/name/<process>', 'tailProcess', tailProcess, methods=['GET'])
app.add_url_rule('/startStopProccess/name/<process>/cmd/<action>', 'startStopProccess', startStopProccess, methods=['GET']) app.add_url_rule('/startStopProccess/name/<process>/cmd/<action>', 'startStopProccess', startStopProccess, methods=['GET'])
app.add_url_rule('/viewBuildoudAnnotate', 'viewBuildoudAnnotate', viewBuildoudAnnotate, methods=['GET'])
app.add_url_rule("/getParameterXml/<request>", 'getParameterXml', getParameterXml, methods=['GET']) app.add_url_rule("/getParameterXml/<request>", 'getParameterXml', getParameterXml, methods=['GET'])
app.add_url_rule("/stopSlapgrid", 'stopSlapgrid', stopSlapgrid, methods=['POST']) app.add_url_rule("/stopSlapgrid", 'stopSlapgrid', stopSlapgrid, methods=['POST'])
app.add_url_rule("/slapgridResult", 'slapgridResult', slapgridResult, methods=['POST']) app.add_url_rule("/slapgridResult", 'slapgridResult', slapgridResult, methods=['POST'])
...@@ -566,4 +554,4 @@ app.add_url_rule('/configRepo', 'configRepo', configRepo) ...@@ -566,4 +554,4 @@ app.add_url_rule('/configRepo', 'configRepo', configRepo)
app.add_url_rule("/saveParameterXml", 'saveParameterXml', saveParameterXml, methods=['POST']) app.add_url_rule("/saveParameterXml", 'saveParameterXml', saveParameterXml, methods=['POST'])
app.add_url_rule("/getPath", 'getPath', getPath, methods=['POST']) app.add_url_rule("/getPath", 'getPath', getPath, methods=['POST'])
app.add_url_rule("/myAccount", 'myAccount', myAccount) app.add_url_rule("/myAccount", 'myAccount', myAccount)
app.add_url_rule("/updateAccount", 'updateAccount', updateAccount, methods=['POST']) app.add_url_rule("/updateAccount", 'updateAccount', updateAccount, methods=['POST'])
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment