Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
604b5108
Commit
604b5108
authored
Jul 12, 2011
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small styles changes.
parent
0e76f9ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
slapos/proxy/views.py
slapos/proxy/views.py
+7
-9
No files found.
slapos/proxy/views.py
View file @
604b5108
...
...
@@ -13,7 +13,7 @@ class UnauthorizedError(Exception):
pass
def
partitiondict2partition
(
partition
):
# XXX-Cedric : change function name, as it does no longer create a
# XXX-Cedric : change function name, as it does no longer create a
# Partition instance, but rather create a dict ready to be sent in json
slap_partition
=
dict
(
computer_id
=
app
.
config
[
'computer_id'
],
computer_partition_id
=
partition
[
'reference'
],
...
...
@@ -70,7 +70,7 @@ def after_request(response):
g
.
db
.
commit
()
g
.
db
.
close
()
return
response
@
app
.
route
(
'/<computer_id>'
,
methods
=
[
'GET'
])
def
getComputerInformation
(
computer_id
):
"""Returns information about computer"""
...
...
@@ -88,7 +88,7 @@ def getComputerInformation(computer_id):
else
:
raise
UnauthorizedError
,
"Only accept request for: %s"
%
\
app
.
config
[
'computer_id'
]
@
app
.
route
(
'/<computer_id>/partition/<computer_partition_id>'
,
methods
=
[
'POST'
])
def
setComputerPartitionConnectionJson
(
computer_id
,
computer_partition_id
):
# XXX-Cedric : change connection_xml to connection_json in sql
...
...
@@ -96,7 +96,7 @@ def setComputerPartitionConnectionJson(computer_id, computer_partition_id):
argument_list
=
[
request
.
json
,
computer_partition_id
.
encode
()]
execute_db
(
'partition'
,
query
,
argument_list
)
return
'done'
@
app
.
route
(
'/buildingSoftwareRelease'
,
methods
=
[
'POST'
])
def
buildingSoftwareRelease
():
return
'Ignored'
...
...
@@ -206,7 +206,7 @@ def requestComputerPartition(partition_reference = ''):
a
(
partition_id
)
if
instance_json
:
# XXX-Cedric : change xml to sjon in sql
q
+=
' ,xml=?'
q
+=
' ,xml=?'
a
(
instance_json
)
q
+=
' WHERE reference=?'
a
(
partition
[
'reference'
].
encode
())
...
...
@@ -252,19 +252,17 @@ def loadComputerConfigurationFromXML():
xml
=
request
.
form
[
'xml'
]
computer_dict
=
xml_marshaller
.
xml_marshaller
.
loads
(
str
(
xml
))
if
app
.
config
[
'computer_id'
]
==
computer_dict
[
'reference'
]:
args
=
[]
a
=
args
.
append
execute_db
(
'computer'
,
'INSERT OR REPLACE INTO %s values(:address, :netmask)'
,
computer_dict
)
for
partition
in
computer_dict
[
'partition_list'
]:
execute_db
(
'partition'
,
'INSERT OR IGNORE INTO %s (reference) values(:reference)'
,
partition
)
execute_db
(
'partition_network'
,
'DELETE FROM %s WHERE partition_reference = ?'
,
[
partition
[
'reference'
]])
for
address
in
partition
[
'address_list'
]:
address
[
'reference'
]
=
partition
[
'tap'
][
'name'
]
address
[
'partition_reference'
]
=
partition
[
'reference'
]
execute_db
(
'partition_network'
,
'INSERT OR REPLACE INTO %s (reference, partition_reference, address, netmask) values(:reference, :partition_reference, :addr, :netmask)'
,
address
)
return
'done'
else
:
raise
UnauthorizedError
,
"Only accept request for: %s"
%
\
...
...
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