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
Thomas Gambier
slapos.core
Commits
60b7e90d
Commit
60b7e90d
authored
May 10, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid setting persistent object on portal type.
parent
e8a079f5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
master/product/Vifib/Tool/VifibRestApiV1Tool.py
master/product/Vifib/Tool/VifibRestApiV1Tool.py
+17
-14
No files found.
master/product/Vifib/Tool/VifibRestApiV1Tool.py
View file @
60b7e90d
...
@@ -137,11 +137,12 @@ def extractInstance(fn):
...
@@ -137,11 +137,12 @@ def extractInstance(fn):
return
self
.
REQUEST
.
response
return
self
.
REQUEST
.
response
instance_path
=
self
.
REQUEST
[
'traverse_subpath'
][:
2
]
instance_path
=
self
.
REQUEST
[
'traverse_subpath'
][:
2
]
try
:
try
:
s
elf
.
software_instance
=
self
.
restrictedTraverse
(
instance_path
)
s
oftware_instance
=
self
.
getPortalObject
()
.
restrictedTraverse
(
instance_path
)
if
getattr
(
s
elf
.
s
oftware_instance
,
'getPortalType'
,
None
)
is
None
or
\
if
getattr
(
software_instance
,
'getPortalType'
,
None
)
is
None
or
\
s
elf
.
s
oftware_instance
.
getPortalType
()
not
in
(
'Software Instance'
,
software_instance
.
getPortalType
()
not
in
(
'Software Instance'
,
'Slave Instance'
):
'Slave Instance'
):
raise
WrongRequest
(
'%r is not an instance'
%
instance_path
)
raise
WrongRequest
(
'%r is not an instance'
%
instance_path
)
self
.
software_instance_url
=
software_instance
.
getRelativeUrl
()
except
WrongRequest
:
except
WrongRequest
:
LOG
(
'VifibRestApiV1Tool'
,
ERROR
,
LOG
(
'VifibRestApiV1Tool'
,
ERROR
,
'Problem while trying to find instance:'
,
error
=
True
)
'Problem while trying to find instance:'
,
error
=
True
)
...
@@ -184,7 +185,8 @@ class InstancePublisher(GenericPublisher):
...
@@ -184,7 +185,8 @@ class InstancePublisher(GenericPublisher):
@
extractInstance
@
extractInstance
def
__bang
(
self
):
def
__bang
(
self
):
try
:
try
:
self
.
software_instance
.
reportComputerPartitionBang
(
comment
=
self
.
jbody
[
'log'
])
self
.
restrictedTraverse
(
self
.
software_instance_url
).
reportComputerPartitionBang
(
comment
=
self
.
jbody
[
'log'
])
except
Exception
:
except
Exception
:
LOG
(
'VifibRestApiV1Tool'
,
ERROR
,
LOG
(
'VifibRestApiV1Tool'
,
ERROR
,
'Problem while trying to generate instance dict:'
,
error
=
True
)
'Problem while trying to generate instance dict:'
,
error
=
True
)
...
@@ -241,27 +243,28 @@ class InstancePublisher(GenericPublisher):
...
@@ -241,27 +243,28 @@ class InstancePublisher(GenericPublisher):
@
extractInstance
@
extractInstance
def
__instance_info
(
self
):
def
__instance_info
(
self
):
certificate
=
False
certificate
=
False
software_instance
=
self
.
restrictedTraverse
(
self
.
software_instance_url
)
if
self
.
REQUEST
[
'traverse_subpath'
]
and
self
.
REQUEST
[
if
self
.
REQUEST
[
'traverse_subpath'
]
and
self
.
REQUEST
[
'traverse_subpath'
][
-
1
]
==
'certificate'
:
'traverse_subpath'
][
-
1
]
==
'certificate'
:
certificate
=
True
certificate
=
True
try
:
try
:
if
certificate
:
if
certificate
:
d
=
{
d
=
{
"ssl_key"
:
s
elf
.
s
oftware_instance
.
getSslKey
(),
"ssl_key"
:
software_instance
.
getSslKey
(),
"ssl_certificate"
:
s
elf
.
s
oftware_instance
.
getSslCertificate
()
"ssl_certificate"
:
software_instance
.
getSslCertificate
()
}
}
else
:
else
:
d
=
{
d
=
{
"title"
:
s
elf
.
s
oftware_instance
.
getTitle
(),
"title"
:
software_instance
.
getTitle
(),
"status"
:
s
elf
.
s
oftware_instance
.
getSlapState
(),
"status"
:
software_instance
.
getSlapState
(),
"software_release"
:
""
,
# not ready yet
"software_release"
:
""
,
# not ready yet
"software_type"
:
s
elf
.
s
oftware_instance
.
getSourceReference
(),
"software_type"
:
software_instance
.
getSourceReference
(),
"slave"
:
s
elf
.
s
oftware_instance
.
getPortalType
()
==
'Slave Instance'
,
"slave"
:
software_instance
.
getPortalType
()
==
'Slave Instance'
,
"connection"
:
s
elf
.
s
oftware_instance
.
getConnectionXmlAsDict
(),
"connection"
:
software_instance
.
getConnectionXmlAsDict
(),
"parameter"
:
s
elf
.
s
oftware_instance
.
getInstanceXmlAsDict
(),
"parameter"
:
software_instance
.
getInstanceXmlAsDict
(),
"sla"
:
s
elf
.
s
oftware_instance
.
getSlaXmlAsDict
(),
"sla"
:
software_instance
.
getSlaXmlAsDict
(),
"children_list"
:
[
q
.
absolute_url
()
for
q
in
\
"children_list"
:
[
q
.
absolute_url
()
for
q
in
\
s
elf
.
s
oftware_instance
.
getPredecessorValueList
()],
software_instance
.
getPredecessorValueList
()],
"partition"
:
{
# not ready yet
"partition"
:
{
# not ready yet
"public_ip"
:
[],
"public_ip"
:
[],
"private_ip"
:
[],
"private_ip"
:
[],
...
...
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