Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.toolbox
Commits
e459a6c1
Commit
e459a6c1
authored
Oct 12, 2012
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Line length
parent
761fb158
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
43 deletions
+89
-43
slapos/runner/views.py
slapos/runner/views.py
+89
-43
No files found.
slapos/runner/views.py
View file @
e459a6c1
...
@@ -12,16 +12,23 @@ from flask import (Flask, request, redirect, url_for, render_template,
...
@@ -12,16 +12,23 @@ from flask import (Flask, request, redirect, url_for, render_template,
g
,
flash
,
jsonify
,
session
,
abort
,
send_file
)
g
,
flash
,
jsonify
,
session
,
abort
,
send_file
)
from
slapos.runner.process
import
killRunningProcess
from
slapos.runner.process
import
killRunningProcess
from
slapos.runner.utils
import
(
checkSoftwareFolder
,
configNewSR
,
getFolder
,
getFolderContent
,
getProfilePath
,
from
slapos.runner.utils
import
(
checkSoftwareFolder
,
configNewSR
,
getFolder
,
getProjectList
,
getProjectTitle
,
getSession
,
getSlapStatus
,
getSvcStatus
,
getFolderContent
,
getProfilePath
,
getSvcTailProcess
,
isInstanceRunning
,
isSoftwareRunning
,
isText
,
getProjectList
,
getProjectTitle
,
getSession
,
loadSoftwareRList
,
md5sum
,
newSoftware
,
readFileFrom
,
readParameters
,
realpath
,
getSlapStatus
,
getSvcStatus
,
removeInstanceRoot
,
removeProxyDb
,
removeSoftwareByName
,
runInstanceWithLock
,
getSvcTailProcess
,
isInstanceRunning
,
runSoftwareWithLock
,
saveSession
,
svcStartStopProcess
,
svcStopAll
,
tail
,
isSoftwareRunning
,
isText
,
loadSoftwareRList
,
md5sum
,
newSoftware
,
readFileFrom
,
readParameters
,
realpath
,
removeInstanceRoot
,
removeProxyDb
,
removeSoftwareByName
,
runInstanceWithLock
,
runSoftwareWithLock
,
saveSession
,
svcStartStopProcess
,
svcStopAll
,
tail
,
updateInstanceParameter
)
updateInstanceParameter
)
from
slapos.runner.fileBrowser
import
FileBrowser
from
slapos.runner.fileBrowser
import
FileBrowser
from
slapos.runner.gittools
import
(
cloneRepo
,
gitStatus
,
switchBranch
,
addBranch
,
getDiff
,
from
slapos.runner.gittools
import
(
cloneRepo
,
gitStatus
,
switchBranch
,
gitPush
,
gitPull
)
addBranch
,
getDiff
,
gitPush
,
gitPull
)
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
...
@@ -177,10 +184,16 @@ def supervisordStatus():
...
@@ -177,10 +184,16 @@ def supervisordStatus():
html
=
"<tr><th>Partition and Process name</th><th>Status</th><th>Process PID </th><th> UpTime</th><th></th></tr>"
html
=
"<tr><th>Partition and Process name</th><th>Status</th><th>Process PID </th><th> UpTime</th><th></th></tr>"
for
item
in
result
:
for
item
in
result
:
html
+=
"<tr>"
html
+=
"<tr>"
html
+=
"<td class='first'><b><a href='"
+
url_for
(
'tailProcess'
,
process
=
item
[
0
])
+
"'>"
+
item
[
0
]
+
"</a></b></td>"
html
+=
"<td class='first'><b><a href='"
\
html
+=
"<td align='center'><a href='"
+
url_for
(
'startStopProccess'
,
process
=
item
[
0
],
action
=
item
[
1
])
+
"'>"
+
item
[
1
]
+
"</a></td>"
+
url_for
(
'tailProcess'
,
process
=
item
[
0
])
+
"'>"
\
+
item
[
0
]
+
"</a></b></td>"
html
+=
"<td align='center'><a href='"
\
+
url_for
(
'startStopProccess'
,
process
=
item
[
0
],
action
=
item
[
1
])
\
+
"'>"
+
item
[
1
]
+
"</a></td>"
html
+=
"<td align='center'>"
+
item
[
3
]
+
"</td><td>"
+
item
[
5
]
+
"</td>"
html
+=
"<td align='center'>"
+
item
[
3
]
+
"</td><td>"
+
item
[
5
]
+
"</td>"
html
+=
"<td align='center'><a href='"
+
url_for
(
'startStopProccess'
,
process
=
item
[
0
],
action
=
'RESTART'
)
+
"'>Restart</a></td>"
html
+=
"<td align='center'><a href='"
\
+
url_for
(
'startStopProccess'
,
process
=
item
[
0
],
action
=
'RESTART'
)
\
+
"'>Restart</a></td>"
html
+=
"</tr>"
html
+=
"</tr>"
return
jsonify
(
code
=
1
,
result
=
html
)
return
jsonify
(
code
=
1
,
result
=
html
)
...
@@ -398,7 +411,8 @@ def checkFileType():
...
@@ -398,7 +411,8 @@ def checkFileType():
if
isText
(
path
):
if
isText
(
path
):
return
jsonify
(
code
=
1
,
result
=
"text"
)
return
jsonify
(
code
=
1
,
result
=
"text"
)
else
:
else
:
return
jsonify
(
code
=
0
,
result
=
"Can not open a binary file, please select a text file!"
)
return
jsonify
(
code
=
0
,
result
=
"Can not open a binary file, please select a text file!"
)
@
login_required
()
@
login_required
()
def
getmd5sum
():
def
getmd5sum
():
...
@@ -444,7 +458,8 @@ def getPath():
...
@@ -444,7 +458,8 @@ def getPath():
list
.
append
(
path
)
list
.
append
(
path
)
realfile
=
'#'
.
join
(
list
)
realfile
=
'#'
.
join
(
list
)
if
not
realfile
:
if
not
realfile
:
return
jsonify
(
code
=
0
,
result
=
"Can not access to this file: Permission Denied!"
)
return
jsonify
(
code
=
0
,
result
=
"Can not access to this file: Permission Denied!"
)
else
:
else
:
return
jsonify
(
code
=
1
,
result
=
realfile
)
return
jsonify
(
code
=
1
,
result
=
realfile
)
...
@@ -474,7 +489,9 @@ def saveParameterXml():
...
@@ -474,7 +489,9 @@ def saveParameterXml():
try
:
try
:
updateInstanceParameter
(
app
.
config
,
software_type
)
updateInstanceParameter
(
app
.
config
,
software_type
)
except
Exception
as
e
:
except
Exception
as
e
:
return
jsonify
(
code
=
0
,
result
=
"An error occurred while applying your settings!<br/>"
+
str
(
e
))
return
jsonify
(
code
=
0
,
result
=
"An error occurred while applying your settings!<br/>"
+
str
(
e
))
return
jsonify
(
code
=
1
,
result
=
""
)
return
jsonify
(
code
=
1
,
result
=
""
)
#read instance parameters into the local xml file and return a dict
#read instance parameters into the local xml file and return a dict
...
@@ -532,7 +549,8 @@ def configAccount():
...
@@ -532,7 +549,8 @@ def configAccount():
return
jsonify
(
code
=
0
,
result
=
result
)
return
jsonify
(
code
=
0
,
result
=
result
)
else
:
else
:
return
jsonify
(
code
=
1
,
result
=
""
)
return
jsonify
(
code
=
1
,
result
=
""
)
return
jsonify
(
code
=
0
,
result
=
"Unable to respond to your request, permission denied."
)
return
jsonify
(
code
=
0
,
result
=
"Unable to respond to your request, permission denied."
)
#Global File Manager
#Global File Manager
@
login_required
()
@
login_required
()
...
@@ -608,49 +626,77 @@ def editFile():
...
@@ -608,49 +626,77 @@ def editFile():
#Setup List of URLs
#Setup List of URLs
app
.
add_url_rule
(
'/'
,
'home'
,
home
)
app
.
add_url_rule
(
'/'
,
'home'
,
home
)
app
.
add_url_rule
(
'/editSoftwareProfile'
,
'editSoftwareProfile'
,
editSoftwareProfile
)
app
.
add_url_rule
(
'/editSoftwareProfile'
,
'editSoftwareProfile'
,
editSoftwareProfile
)
app
.
add_url_rule
(
'/inspectSoftware'
,
'inspectSoftware'
,
inspectSoftware
)
app
.
add_url_rule
(
'/inspectSoftware'
,
'inspectSoftware'
,
inspectSoftware
)
app
.
add_url_rule
(
'/removeSoftware'
,
'removeSoftware'
,
removeSoftware
)
app
.
add_url_rule
(
'/removeSoftware'
,
'removeSoftware'
,
removeSoftware
)
app
.
add_url_rule
(
'/runSoftwareProfile'
,
'runSoftwareProfile'
,
runSoftwareProfile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/runSoftwareProfile'
,
'runSoftwareProfile'
,
app
.
add_url_rule
(
'/viewSoftwareLog'
,
'viewSoftwareLog'
,
viewSoftwareLog
,
methods
=
[
'GET'
])
runSoftwareProfile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/editInstanceProfile'
,
'editInstanceProfile'
,
editInstanceProfile
)
app
.
add_url_rule
(
'/viewSoftwareLog'
,
'viewSoftwareLog'
,
app
.
add_url_rule
(
'/inspectInstance'
,
'inspectInstance'
,
inspectInstance
,
methods
=
[
'GET'
])
viewSoftwareLog
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/supervisordStatus'
,
'supervisordStatus'
,
supervisordStatus
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/editInstanceProfile'
,
'editInstanceProfile'
,
app
.
add_url_rule
(
'/runInstanceProfile'
,
'runInstanceProfile'
,
runInstanceProfile
,
methods
=
[
'POST'
])
editInstanceProfile
)
app
.
add_url_rule
(
'/inspectInstance'
,
'inspectInstance'
,
inspectInstance
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/supervisordStatus'
,
'supervisordStatus'
,
supervisordStatus
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/runInstanceProfile'
,
'runInstanceProfile'
,
runInstanceProfile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/removeInstance'
,
'removeInstance'
,
removeInstance
)
app
.
add_url_rule
(
'/removeInstance'
,
'removeInstance'
,
removeInstance
)
app
.
add_url_rule
(
'/viewInstanceLog'
,
'viewInstanceLog'
,
viewInstanceLog
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/viewInstanceLog'
,
'viewInstanceLog'
,
app
.
add_url_rule
(
'/stopAllPartition'
,
'stopAllPartition'
,
stopAllPartition
,
methods
=
[
'GET'
])
viewInstanceLog
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/tailProcess/name/<process>'
,
'tailProcess'
,
tailProcess
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/stopAllPartition'
,
'stopAllPartition'
,
app
.
add_url_rule
(
'/startStopProccess/name/<process>/cmd/<action>'
,
'startStopProccess'
,
startStopProccess
,
methods
=
[
'GET'
])
stopAllPartition
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/getParameterXml/<request>"
,
'getParameterXml'
,
getParameterXml
,
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
(
"/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'
])
app
.
add_url_rule
(
"/getmd5sum"
,
'getmd5sum'
,
getmd5sum
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/getmd5sum"
,
'getmd5sum'
,
getmd5sum
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/checkFileType"
,
'checkFileType'
,
checkFileType
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/checkFileType"
,
'checkFileType'
,
checkFileType
,
app
.
add_url_rule
(
"/pullProjectFiles"
,
'pullProjectFiles'
,
pullProjectFiles
,
methods
=
[
'POST'
])
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/pushProjectFiles"
,
'pushProjectFiles'
,
pushProjectFiles
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/pullProjectFiles"
,
'pullProjectFiles'
,
pullProjectFiles
,
app
.
add_url_rule
(
"/getProjectDiff/<project>"
,
'getProjectDiff'
,
getProjectDiff
,
methods
=
[
'GET'
])
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/pushProjectFiles"
,
'pushProjectFiles'
,
pushProjectFiles
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/getProjectDiff/<project>"
,
'getProjectDiff'
,
getProjectDiff
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/newBranch"
,
'newBranch'
,
newBranch
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/newBranch"
,
'newBranch'
,
newBranch
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/changeBranch"
,
'changeBranch'
,
changeBranch
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/changeBranch"
,
'changeBranch'
,
changeBranch
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/saveFileContent"
,
'saveFileContent'
,
saveFileContent
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/saveFileContent"
,
'saveFileContent'
,
saveFileContent
,
app
.
add_url_rule
(
"/removeSoftwareDir"
,
'removeSoftwareDir'
,
removeSoftwareDir
,
methods
=
[
'POST'
])
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/getFileContent"
,
'getFileContent'
,
getFileContent
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/removeSoftwareDir"
,
'removeSoftwareDir'
,
removeSoftwareDir
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/getFileContent"
,
'getFileContent'
,
getFileContent
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/removeFile"
,
'removeFile'
,
removeFile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/removeFile"
,
'removeFile'
,
removeFile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/createFile"
,
'createFile'
,
createFile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/createFile"
,
'createFile'
,
createFile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/editCurrentProject"
,
'editCurrentProject'
,
editCurrentProject
)
app
.
add_url_rule
(
"/editCurrentProject"
,
'editCurrentProject'
,
editCurrentProject
)
app
.
add_url_rule
(
"/getProjectStatus"
,
'getProjectStatus'
,
getProjectStatus
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/getProjectStatus"
,
'getProjectStatus'
,
getProjectStatus
,
app
.
add_url_rule
(
'/openProject/<method>'
,
'openProject'
,
openProject
,
methods
=
[
'GET'
])
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/openProject/<method>'
,
'openProject'
,
openProject
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/manageProject"
,
'manageProject'
,
manageProject
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/manageProject"
,
'manageProject'
,
manageProject
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/setCurrentProject"
,
'setCurrentProject'
,
setCurrentProject
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/setCurrentProject"
,
'setCurrentProject'
,
setCurrentProject
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/checkFolder"
,
'checkFolder'
,
checkFolder
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/checkFolder"
,
'checkFolder'
,
checkFolder
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/createSoftware'
,
'createSoftware'
,
createSoftware
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/createSoftware'
,
'createSoftware'
,
createSoftware
,
app
.
add_url_rule
(
'/cloneRepository'
,
'cloneRepository'
,
cloneRepository
,
methods
=
[
'POST'
])
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/cloneRepository'
,
'cloneRepository'
,
cloneRepository
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/openFolder'
,
'openFolder'
,
openFolder
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/openFolder'
,
'openFolder'
,
openFolder
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/readFolder'
,
'readFolder'
,
readFolder
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/readFolder'
,
'readFolder'
,
readFolder
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/configRepo'
,
'configRepo'
,
configRepo
)
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
,
app
.
add_url_rule
(
"/fileBrowser"
,
'fileBrowser'
,
fileBrowser
,
methods
=
[
'GET'
,
'POST'
])
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/fileBrowser"
,
'fileBrowser'
,
fileBrowser
,
methods
=
[
'GET'
,
'POST'
])
app
.
add_url_rule
(
"/editFile"
,
'editFile'
,
editFile
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/editFile"
,
'editFile'
,
editFile
,
methods
=
[
'GET'
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment