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
Arnaud Véron
slapos.core
Commits
b1e92198
Commit
b1e92198
authored
Jul 13, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the way of fetching API root.
API is not an object, so generate virtual URLs.
parent
53cefc00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
.../DocumentTemplateItem/portal_components/VifibRestAPIV1.py
+10
-4
master/bt5/vifib_slapos_rest_api_v1/bt/revision
master/bt5/vifib_slapos_rest_api_v1/bt/revision
+1
-1
No files found.
master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py
View file @
b1e92198
...
@@ -176,7 +176,7 @@ def responseSupport(anonymous=False):
...
@@ -176,7 +176,7 @@ def responseSupport(anonymous=False):
# force login
# force login
self
.
REQUEST
.
response
.
setStatus
(
401
)
self
.
REQUEST
.
response
.
setStatus
(
401
)
self
.
REQUEST
.
response
.
setHeader
(
'WWW-Authenticate'
,
'Bearer realm="%s"'
%
self
.
REQUEST
.
response
.
setHeader
(
'WWW-Authenticate'
,
'Bearer realm="%s"'
%
self
.
absolute_url
())
self
.
getAPIRoot
())
self
.
REQUEST
.
response
.
setHeader
(
'Location'
,
self
.
getPortalObject
()
\
self
.
REQUEST
.
response
.
setHeader
(
'Location'
,
self
.
getPortalObject
()
\
.
portal_preferences
.
getPreferredRestApiTokenServerUrl
())
.
portal_preferences
.
getPreferredRestApiTokenServerUrl
())
return
self
.
REQUEST
.
response
return
self
.
REQUEST
.
response
...
@@ -374,8 +374,8 @@ class InstancePublisher(GenericPublisher):
...
@@ -374,8 +374,8 @@ class InstancePublisher(GenericPublisher):
"connection"
:
software_instance
.
getConnectionXmlAsDict
(),
"connection"
:
software_instance
.
getConnectionXmlAsDict
(),
"parameter"
:
software_instance
.
getInstanceXmlAsDict
(),
"parameter"
:
software_instance
.
getInstanceXmlAsDict
(),
"sla"
:
software_instance
.
getSlaXmlAsDict
(),
"sla"
:
software_instance
.
getSlaXmlAsDict
(),
"children_list"
:
[
q
.
absolute_url
()
for
q
in
\
"children_list"
:
[
self
.
getAPIRoot
()
+
'/'
+
q
.
getRelativeUrl
()
\
software_instance
.
getPredecessorValueList
()],
for
q
in
software_instance
.
getPredecessorValueList
()],
"partition"
:
{
# not ready yet
"partition"
:
{
# not ready yet
"public_ip"
:
[],
"public_ip"
:
[],
"private_ip"
:
[],
"private_ip"
:
[],
...
@@ -410,7 +410,7 @@ class InstancePublisher(GenericPublisher):
...
@@ -410,7 +410,7 @@ class InstancePublisher(GenericPublisher):
d
=
{
"list"
:
[]}
d
=
{
"list"
:
[]}
a
=
d
[
'list'
].
append
a
=
d
[
'list'
].
append
for
si
in
self
.
getPortalObject
().
portal_catalog
(
**
kw
):
for
si
in
self
.
getPortalObject
().
portal_catalog
(
**
kw
):
a
(
'/'
.
join
([
self
.
absolute_url
(),
'instance'
,
si
.
getRelativeUrl
()]))
a
(
'/'
.
join
([
self
.
getAPIRoot
(),
'instance'
,
si
.
getRelativeUrl
()]))
try
:
try
:
d
[
'list'
][
0
]
d
[
'list'
][
0
]
except
IndexError
:
except
IndexError
:
...
@@ -504,6 +504,12 @@ class VifibRestAPIV1(Implicit):
...
@@ -504,6 +504,12 @@ class VifibRestAPIV1(Implicit):
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declarePublic
(
'instance'
)
security
.
declarePublic
(
'instance'
)
security
.
declarePublic
(
'getAPIRoot'
)
def
getAPIRoot
(
self
):
"""Returns the root of API"""
return
self
.
absolute_url
()
+
'/v1'
@
ComputedAttribute
@
ComputedAttribute
def
instance
(
self
):
def
instance
(
self
):
"""Instance publisher"""
"""Instance publisher"""
...
...
master/bt5/vifib_slapos_rest_api_v1/bt/revision
View file @
b1e92198
11
12
\ No newline at end of file
\ 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