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
7
Merge Requests
7
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
nexedi
slapos.toolbox
Commits
51ab20f4
Commit
51ab20f4
authored
Jun 29, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean slapproxy database when destroying all instances
parent
ff93f75e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
slapos/runner/utils.py
slapos/runner/utils.py
+4
-7
slapos/runner/views.py
slapos/runner/views.py
+9
-1
No files found.
slapos/runner/utils.py
View file @
51ab20f4
...
...
@@ -108,8 +108,7 @@ def updateProxy(config):
'address'
:
config
[
'ipv4_address'
],
'instance_root'
:
config
[
'instance_root'
],
'netmask'
:
'255.255.255.255'
,
'partition_list'
:
[
],
'partition_list'
:
[],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]}
for
i
in
xrange
(
0
,
int
(
config
[
'partition_amount'
])):
...
...
@@ -170,8 +169,6 @@ def updateInstanceParameter(config, software_type=None):
xml_result
=
readParameters
(
param_path
)
partition_parameter_kw
=
None
if
type
(
xml_result
)
!=
type
(
''
)
and
xml_result
.
has_key
(
'instance'
):
#for item in xml_result['instance'].keys():
# xml_result['instance'][item] = xml_result['instance'][item].decode('utf-8')
partition_parameter_kw
=
xml_result
[
'instance'
]
slap
.
registerOpenOrder
().
request
(
profile
,
partition_reference
=
getSoftwareReleaseName
(
config
),
partition_parameter_kw
=
partition_parameter_kw
,
software_type
=
software_type
,
...
...
@@ -542,10 +539,10 @@ def writeSoftwareData(runner_dir, data):
def removeSoftwareByName(config, folderName):
if isSoftwareRunning(config) or isInstanceRunning(config):
r
eturn jsonify(code=0, result=
"Software installation or instantiation in progress, cannot remove")
r
aise Exception(
"Software installation or instantiation in progress, cannot remove")
path = os.path.join(config['
software_root
'], folderName)
if not os.path.exists(path):
r
eturn jsonify(code=0, result="Can not remove softwar
e: No such file or directory")
r
aise Exception("Cannot remove software Releas
e: No such file or directory")
svcStopAll(config)
shutil.rmtree(path)
#update compiled software list
...
...
@@ -557,7 +554,7 @@ def removeSoftwareByName(config, folderName):
writeSoftwareData(config['
runner_workdir
'], data)
break
i = i+1
return
jsonify(code=1, result=data)
return
data
def tail(f, lines=20):
"""
...
...
slapos/runner/views.py
View file @
51ab20f4
...
...
@@ -11,6 +11,7 @@ from gittools import cloneRepo, gitStatus, switchBranch, addBranch, getDiff, \
app
=
Flask
(
__name__
)
#Access Control: Only static files and login pages are allowed to guest
@
app
.
before_request
def
before_request
():
if
(
not
session
.
has_key
(
'account'
)
or
not
session
[
'account'
])
\
...
...
@@ -146,6 +147,9 @@ def removeInstance():
if
isInstanceRunning
(
app
.
config
):
flash
(
'Instantiation in progress, cannot remove'
)
else
:
stopProxy
(
app
.
config
)
removeProxyDb
(
app
.
config
)
startProxy
(
app
.
config
)
removeInstanceRoot
(
app
.
config
)
flash
(
'Instance removed'
)
return
redirect
(
url_for
(
'inspectInstance'
))
...
...
@@ -286,7 +290,11 @@ def removeFile():
@
app
.
route
(
"/removeSoftwareDir"
,
methods
=
[
'POST'
])
def
removeSoftwareDir
():
return
removeSoftwareByName
(
app
.
config
,
request
.
form
[
'name'
])
try
:
data
=
removeSoftwareByName
(
app
.
config
,
request
.
form
[
'name'
])
return
jsonify
(
code
=
1
,
result
=
data
)
except
Exception
,
e
:
return
jsonify
(
code
=
0
,
result
=
str
(
e
))
@
app
.
route
(
"/getFileContent"
,
methods
=
[
'POST'
])
def
getFileContent
():
...
...
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