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
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
Ivan Tyagov
slapos.core
Commits
255f21fb
Commit
255f21fb
authored
Jun 13, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
raise exceptions with ()
parent
2530f76d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
30 deletions
+26
-30
slapos/proxy/views.py
slapos/proxy/views.py
+26
-30
No files found.
slapos/proxy/views.py
View file @
255f21fb
...
@@ -153,8 +153,7 @@ def getFullComputerInformation():
...
@@ -153,8 +153,7 @@ def getFullComputerInformation():
partition
))
partition
))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
else
:
else
:
raise
NotFoundError
,
"Only accept request for: %s"
%
\
raise
NotFoundError
(
'Only accept request for: %s'
%
app
.
config
[
'computer_id'
])
app
.
config
[
'computer_id'
]
@
app
.
route
(
'/setComputerPartitionConnectionXml'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/setComputerPartitionConnectionXml'
,
methods
=
[
'POST'
])
def
setComputerPartitionConnectionXml
():
def
setComputerPartitionConnectionXml
():
...
@@ -238,8 +237,7 @@ def loadComputerConfigurationFromXML():
...
@@ -238,8 +237,7 @@ def loadComputerConfigurationFromXML():
return
'done'
return
'done'
else
:
else
:
raise
UnauthorizedError
,
"Only accept request for: %s"
%
\
raise
UnauthorizedError
(
'Only accept request for: %s'
%
app
.
config
[
'computer_id'
])
app
.
config
[
'computer_id'
]
@
app
.
route
(
'/registerComputerPartition'
,
methods
=
[
'GET'
])
@
app
.
route
(
'/registerComputerPartition'
,
methods
=
[
'GET'
])
def
registerComputerPartition
():
def
registerComputerPartition
():
...
@@ -253,8 +251,7 @@ def registerComputerPartition():
...
@@ -253,8 +251,7 @@ def registerComputerPartition():
return
xml_marshaller
.
xml_marshaller
.
dumps
(
return
xml_marshaller
.
xml_marshaller
.
dumps
(
partitiondict2partition
(
partition
))
partitiondict2partition
(
partition
))
else
:
else
:
raise
UnauthorizedError
,
"Only accept request for: %s"
%
\
raise
UnauthorizedError
(
'Only accept request for: %s'
%
app
.
config
[
'computer_id'
])
app
.
config
[
'computer_id'
]
@
app
.
route
(
'/supplySupply'
,
methods
=
[
'POST'
])
@
app
.
route
(
'/supplySupply'
,
methods
=
[
'POST'
])
def
supplySupply
():
def
supplySupply
():
...
@@ -266,8 +263,7 @@ def supplySupply():
...
@@ -266,8 +263,7 @@ def supplySupply():
else
:
else
:
execute_db
(
'software'
,
'INSERT OR REPLACE INTO %s VALUES(?)'
,
[
url
])
execute_db
(
'software'
,
'INSERT OR REPLACE INTO %s VALUES(?)'
,
[
url
])
else
:
else
:
raise
UnauthorizedError
,
"Only accept request for: %s"
%
\
raise
UnauthorizedError
(
'Only accept request for: %s'
%
app
.
config
[
'computer_id'
])
app
.
config
[
'computer_id'
]
return
'%r added'
%
url
return
'%r added'
%
url
...
@@ -361,8 +357,7 @@ def request_not_shared():
...
@@ -361,8 +357,7 @@ def request_not_shared():
address_list
.
append
((
address
[
'reference'
],
address
[
'address'
]))
address_list
.
append
((
address
[
'reference'
],
address
[
'address'
]))
# XXX it should be ComputerPartition, not a SoftwareInstance
# XXX it should be ComputerPartition, not a SoftwareInstance
return
xml_marshaller
.
xml_marshaller
.
dumps
(
SoftwareInstance
(
software_instance
=
SoftwareInstance
(
xml
=
partition
[
'xml'
],
xml
=
partition
[
'xml'
],
connection_xml
=
partition
[
'connection_xml'
],
connection_xml
=
partition
[
'connection_xml'
],
slap_computer_id
=
app
.
config
[
'computer_id'
],
slap_computer_id
=
app
.
config
[
'computer_id'
],
slap_computer_partition_id
=
partition
[
'reference'
],
slap_computer_partition_id
=
partition
[
'reference'
],
...
@@ -371,8 +366,9 @@ def request_not_shared():
...
@@ -371,8 +366,9 @@ def request_not_shared():
slap_software_type
=
partition
[
'software_type'
],
slap_software_type
=
partition
[
'software_type'
],
slave_instance_list
=
partition
[
'slave_instance_list'
],
slave_instance_list
=
partition
[
'slave_instance_list'
],
instance_guid
=
partition
[
'reference'
],
instance_guid
=
partition
[
'reference'
],
ip_list
=
address_list
ip_list
=
address_list
)
))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
software_instance
)
def
request_slave
():
def
request_slave
():
...
@@ -471,13 +467,13 @@ def request_slave():
...
@@ -471,13 +467,13 @@ def request_slave():
address_list
.
append
((
address
[
'reference'
],
address
[
'address'
]))
address_list
.
append
((
address
[
'reference'
],
address
[
'address'
]))
# XXX it should be ComputerPartition, not a SoftwareInstance
# XXX it should be ComputerPartition, not a SoftwareInstance
return
xml_marshaller
.
xml_marshaller
.
dumps
(
SoftwareInstance
(
software_instance
=
SoftwareInstance
(
_connection_dict
=
xml2dict
(
slave
[
'connection_xml'
]),
_connection_dict
=
xml2dict
(
slave
[
'connection_xml'
]),
xml
=
instance_xml
,
xml
=
instance_xml
,
slap_computer_id
=
app
.
config
[
'computer_id'
],
slap_computer_id
=
app
.
config
[
'computer_id'
],
slap_computer_partition_id
=
slave
[
'hosted_by'
],
slap_computer_partition_id
=
slave
[
'hosted_by'
],
slap_software_release_url
=
partition
[
'software_release'
],
slap_software_release_url
=
partition
[
'software_release'
],
slap_server_url
=
'slap_server_url'
,
slap_server_url
=
'slap_server_url'
,
slap_software_type
=
partition
[
'software_type'
],
slap_software_type
=
partition
[
'software_type'
],
ip_list
=
address_list
ip_list
=
address_list
)
))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
software_instance
)
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