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
Hardik Juneja
slapos.toolbox
Commits
5ad93361
Commit
5ad93361
authored
Mar 11, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update md5sum of instance for slaprunner SR
parent
4c815ff9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
+48
-3
slapos/runner/static/js/scripts/inspectInstance.js
slapos/runner/static/js/scripts/inspectInstance.js
+3
-0
slapos/runner/templates/instanceInspect.html
slapos/runner/templates/instanceInspect.html
+2
-2
slapos/runner/utils.py
slapos/runner/utils.py
+20
-0
slapos/runner/views.py
slapos/runner/views.py
+23
-1
No files found.
slapos/runner/static/js/scripts/inspectInstance.js
View file @
5ad93361
...
@@ -18,6 +18,9 @@ $(document).ready( function() {
...
@@ -18,6 +18,9 @@ $(document).ready( function() {
//User have double click on file in to the fileTree
//User have double click on file in to the fileTree
loadFileContent
(
file
);
loadFileContent
(
file
);
}
}
$
(
"
#update
"
).
click
(
function
(){
alert
(
$
(
"
#parameter
"
).
val
());
});
function
loadFileContent
(
file
){
function
loadFileContent
(
file
){
$
.
ajax
({
$
.
ajax
({
...
...
slapos/runner/templates/instanceInspect.html
View file @
5ad93361
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
<li><a
href=
"#tab4"
>
Partitions Content
</a></li>
<li><a
href=
"#tab4"
>
Partitions Content
</a></li>
</ul>
<!-- //Tab buttons -->
</ul>
<!-- //Tab buttons -->
<div
class=
"tabDetails"
>
<div
class=
"tabDetails"
>
<div
id=
"tab1"
class=
"tabContents"
>
<div
id=
"tab1"
class=
"tabContents"
>
<p>
Add your instance parameters here and click on the update button
</p>
<p>
Add your instance parameters here and click on the update button
</p>
<textarea
class=
"parameter"
>
<
?xml version='1.0' encoding='utf-8'?
>
</textarea>
<textarea
class=
"parameter"
id=
"parameter"
>
<
?xml version='1.0' encoding='utf-8'?
>
</textarea>
<input
type=
"submit"
name=
"update"
id =
"update"
value=
"Update"
class=
"button"
/>
<input
type=
"submit"
name=
"update"
id =
"update"
value=
"Update"
class=
"button"
/>
</div>
<!-- end tab1 -->
</div>
<!-- end tab1 -->
<div
id=
"tab2"
class=
"tabContents"
>
<div
id=
"tab2"
class=
"tabContents"
>
...
...
slapos/runner/utils.py
View file @
5ad93361
...
@@ -3,6 +3,7 @@ import time
...
@@ -3,6 +3,7 @@ import time
import
subprocess
import
subprocess
import
os
import
os
from
xml_marshaller
import
xml_marshaller
from
xml_marshaller
import
xml_marshaller
from
xml.dom
import
minidom
import
re
import
re
import
urllib
import
urllib
from
flask
import
jsonify
from
flask
import
jsonify
...
@@ -12,6 +13,7 @@ import hashlib
...
@@ -12,6 +13,7 @@ import hashlib
import
signal
import
signal
class
Popen
(
subprocess
.
Popen
):
class
Popen
(
subprocess
.
Popen
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'stdin'
]
=
subprocess
.
PIPE
kwargs
[
'stdin'
]
=
subprocess
.
PIPE
...
@@ -549,3 +551,21 @@ def realpath(config, path, check_exist=True):
...
@@ -549,3 +551,21 @@ def realpath(config, path, check_exist=True):
else:
else:
return path
return path
return False
return False
def readParameters(path):
if os.path.exists(path):
try:
xmldoc = minidom.parse(path)
object = {}
for elt in xmldoc.childNodes:
sub_object = {}
for subnode in elt.childNodes:
if subnode.nodeType != subnode.TEXT_NODE:
sub_object[str(subnode.getAttribute('
id
'))] = str(subnode.
childNodes[0].data)
object[str(elt.tagName)] = sub_object
return object
except Exception, e:
return str(e)
else:
return "No such file or directory: " + path
\ No newline at end of file
slapos/runner/views.py
View file @
5ad93361
...
@@ -357,4 +357,26 @@ def getPath():
...
@@ -357,4 +357,26 @@ def getPath():
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
)
\ No newline at end of file
@
app
.
route
(
"/loadParameterXml"
,
methods
=
[
'POST'
])
def
redParameterXml
():
content
=
request
.
form
[
'parameter'
]
param_path
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
".parameter.xml"
)
f
=
open
(
param_path
,
'w'
)
f
.
write
(
content
)
f
.
close
()
result
=
readParameters
(
param_path
)
if
type
(
result
)
==
type
(
''
):
return
jsonify
(
code
=
0
,
result
=
"XML Error: "
+
result
)
else
:
return
jsonify
(
code
=
1
,
result
=
""
)
@
app
.
route
(
"/getParameterXml"
,
methods
=
[
'GET'
])
def
getParameterXml
():
param_path
=
os
.
path
.
join
(
app
.
config
[
'runner_workdir'
],
".parameter.xml"
)
if
os
.
path
.
exists
(
param_path
):
content
=
open
(
param_path
,
'w'
).
read
()
return
jsonify
(
code
=
1
,
result
=
content
)
else
:
return
jsonify
(
code
=
0
,
result
=
"Error: Can not load default instance parameters"
)
\ No newline at end of file
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