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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rafael Monnerat
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
Hide 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,
g
,
flash
,
jsonify
,
session
,
abort
,
send_file
)
from
slapos.runner.process
import
killRunningProcess
from
slapos.runner.utils
import
(
checkSoftwareFolder
,
configNewSR
,
getFolder
,
getFolderContent
,
getProfilePath
,
getProjectList
,
getProjectTitle
,
getSession
,
getSlapStatus
,
getSvcStatus
,
getSvcTailProcess
,
isInstanceRunning
,
isSoftwareRunning
,
isText
,
loadSoftwareRList
,
md5sum
,
newSoftware
,
readFileFrom
,
readParameters
,
realpath
,
removeInstanceRoot
,
removeProxyDb
,
removeSoftwareByName
,
runInstanceWithLock
,
runSoftwareWithLock
,
saveSession
,
svcStartStopProcess
,
svcStopAll
,
tail
,
from
slapos.runner.utils
import
(
checkSoftwareFolder
,
configNewSR
,
getFolder
,
getFolderContent
,
getProfilePath
,
getProjectList
,
getProjectTitle
,
getSession
,
getSlapStatus
,
getSvcStatus
,
getSvcTailProcess
,
isInstanceRunning
,
isSoftwareRunning
,
isText
,
loadSoftwareRList
,
md5sum
,
newSoftware
,
readFileFrom
,
readParameters
,
realpath
,
removeInstanceRoot
,
removeProxyDb
,
removeSoftwareByName
,
runInstanceWithLock
,
runSoftwareWithLock
,
saveSession
,
svcStartStopProcess
,
svcStopAll
,
tail
,
updateInstanceParameter
)
from
slapos.runner.fileBrowser
import
FileBrowser
from
slapos.runner.gittools
import
(
cloneRepo
,
gitStatus
,
switchBranch
,
addBranch
,
getDiff
,
gitPush
,
gitPull
)
from
slapos.runner.gittools
import
(
cloneRepo
,
gitStatus
,
switchBranch
,
addBranch
,
getDiff
,
gitPush
,
gitPull
)
app
=
Flask
(
__name__
)
...
...
@@ -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>"
for
item
in
result
:
html
+=
"<tr>"
html
+=
"<td class='first'><b><a href='"
+
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 class='first'><b><a href='"
\
+
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'><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>"
return
jsonify
(
code
=
1
,
result
=
html
)
...
...
@@ -398,7 +411,8 @@ def checkFileType():
if
isText
(
path
):
return
jsonify
(
code
=
1
,
result
=
"text"
)
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
()
def
getmd5sum
():
...
...
@@ -444,7 +458,8 @@ def getPath():
list
.
append
(
path
)
realfile
=
'#'
.
join
(
list
)
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
:
return
jsonify
(
code
=
1
,
result
=
realfile
)
...
...
@@ -474,7 +489,9 @@ def saveParameterXml():
try
:
updateInstanceParameter
(
app
.
config
,
software_type
)
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
=
""
)
#read instance parameters into the local xml file and return a dict
...
...
@@ -532,7 +549,8 @@ def configAccount():
return
jsonify
(
code
=
0
,
result
=
result
)
else
:
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
@
login_required
()
...
...
@@ -608,49 +626,77 @@ def editFile():
#Setup List of URLs
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
(
'/removeSoftware'
,
'removeSoftware'
,
removeSoftware
)
app
.
add_url_rule
(
'/runSoftwareProfile'
,
'runSoftwareProfile'
,
runSoftwareProfile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/viewSoftwareLog'
,
'viewSoftwareLog'
,
viewSoftwareLog
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/editInstanceProfile'
,
'editInstanceProfile'
,
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
(
'/runSoftwareProfile'
,
'runSoftwareProfile'
,
runSoftwareProfile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/viewSoftwareLog'
,
'viewSoftwareLog'
,
viewSoftwareLog
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/editInstanceProfile'
,
'editInstanceProfile'
,
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
(
'/viewInstanceLog'
,
'viewInstanceLog'
,
viewInstanceLog
,
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
(
'/startStopProccess/name/<process>/cmd/<action>'
,
'startStopProccess'
,
startStopProccess
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/getParameterXml/<request>"
,
'getParameterXml'
,
getParameterXml
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
'/viewInstanceLog'
,
'viewInstanceLog'
,
viewInstanceLog
,
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
(
'/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
(
"/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
(
"/checkFileType"
,
'checkFileType'
,
checkFileType
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/pullProjectFiles"
,
'pullProjectFiles'
,
pullProjectFiles
,
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
(
"/checkFileType"
,
'checkFileType'
,
checkFileType
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/pullProjectFiles"
,
'pullProjectFiles'
,
pullProjectFiles
,
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
(
"/changeBranch"
,
'changeBranch'
,
changeBranch
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/saveFileContent"
,
'saveFileContent'
,
saveFileContent
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/removeSoftwareDir"
,
'removeSoftwareDir'
,
removeSoftwareDir
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/getFileContent"
,
'getFileContent'
,
getFileContent
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/saveFileContent"
,
'saveFileContent'
,
saveFileContent
,
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
(
"/createFile"
,
'createFile'
,
createFile
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/editCurrentProject"
,
'editCurrentProject'
,
editCurrentProject
)
app
.
add_url_rule
(
"/getProjectStatus"
,
'getProjectStatus'
,
getProjectStatus
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/openProject/<method>'
,
'openProject'
,
openProject
,
methods
=
[
'GET'
])
app
.
add_url_rule
(
"/getProjectStatus"
,
'getProjectStatus'
,
getProjectStatus
,
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
(
"/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
(
'/createSoftware'
,
'createSoftware'
,
createSoftware
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/cloneRepository'
,
'cloneRepository'
,
cloneRepository
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/createSoftware'
,
'createSoftware'
,
createSoftware
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/cloneRepository'
,
'cloneRepository'
,
cloneRepository
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/openFolder'
,
'openFolder'
,
openFolder
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
'/readFolder'
,
'readFolder'
,
readFolder
,
methods
=
[
'POST'
])
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
(
"/myAccount"
,
'myAccount'
,
myAccount
)
app
.
add_url_rule
(
"/updateAccount"
,
'updateAccount'
,
updateAccount
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/fileBrowser"
,
'fileBrowser'
,
fileBrowser
,
methods
=
[
'GET'
,
'POST'
])
app
.
add_url_rule
(
"/updateAccount"
,
'updateAccount'
,
updateAccount
,
methods
=
[
'POST'
])
app
.
add_url_rule
(
"/fileBrowser"
,
'fileBrowser'
,
fileBrowser
,
methods
=
[
'GET'
,
'POST'
])
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