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
Eric Zheng
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):
return
self
.
REQUEST
.
response
instance_path
=
self
.
REQUEST
[
'traverse_subpath'
][:
2
]
try
:
s
elf
.
software_instance
=
self
.
restrictedTraverse
(
instance_path
)
if
getattr
(
s
elf
.
s
oftware_instance
,
'getPortalType'
,
None
)
is
None
or
\
s
elf
.
s
oftware_instance
.
getPortalType
()
not
in
(
'Software Instance'
,
s
oftware_instance
=
self
.
getPortalObject
()
.
restrictedTraverse
(
instance_path
)
if
getattr
(
software_instance
,
'getPortalType'
,
None
)
is
None
or
\
software_instance
.
getPortalType
()
not
in
(
'Software Instance'
,
'Slave Instance'
):
raise
WrongRequest
(
'%r is not an instance'
%
instance_path
)
self
.
software_instance_url
=
software_instance
.
getRelativeUrl
()
except
WrongRequest
:
LOG
(
'VifibRestApiV1Tool'
,
ERROR
,
'Problem while trying to find instance:'
,
error
=
True
)
...
...
@@ -184,7 +185,8 @@ class InstancePublisher(GenericPublisher):
@
extractInstance
def
__bang
(
self
):
try
:
self
.
software_instance
.
reportComputerPartitionBang
(
comment
=
self
.
jbody
[
'log'
])
self
.
restrictedTraverse
(
self
.
software_instance_url
).
reportComputerPartitionBang
(
comment
=
self
.
jbody
[
'log'
])
except
Exception
:
LOG
(
'VifibRestApiV1Tool'
,
ERROR
,
'Problem while trying to generate instance dict:'
,
error
=
True
)
...
...
@@ -241,27 +243,28 @@ class InstancePublisher(GenericPublisher):
@
extractInstance
def
__instance_info
(
self
):
certificate
=
False
software_instance
=
self
.
restrictedTraverse
(
self
.
software_instance_url
)
if
self
.
REQUEST
[
'traverse_subpath'
]
and
self
.
REQUEST
[
'traverse_subpath'
][
-
1
]
==
'certificate'
:
certificate
=
True
try
:
if
certificate
:
d
=
{
"ssl_key"
:
s
elf
.
s
oftware_instance
.
getSslKey
(),
"ssl_certificate"
:
s
elf
.
s
oftware_instance
.
getSslCertificate
()
"ssl_key"
:
software_instance
.
getSslKey
(),
"ssl_certificate"
:
software_instance
.
getSslCertificate
()
}
else
:
d
=
{
"title"
:
s
elf
.
s
oftware_instance
.
getTitle
(),
"status"
:
s
elf
.
s
oftware_instance
.
getSlapState
(),
"title"
:
software_instance
.
getTitle
(),
"status"
:
software_instance
.
getSlapState
(),
"software_release"
:
""
,
# not ready yet
"software_type"
:
s
elf
.
s
oftware_instance
.
getSourceReference
(),
"slave"
:
s
elf
.
s
oftware_instance
.
getPortalType
()
==
'Slave Instance'
,
"connection"
:
s
elf
.
s
oftware_instance
.
getConnectionXmlAsDict
(),
"parameter"
:
s
elf
.
s
oftware_instance
.
getInstanceXmlAsDict
(),
"sla"
:
s
elf
.
s
oftware_instance
.
getSlaXmlAsDict
(),
"software_type"
:
software_instance
.
getSourceReference
(),
"slave"
:
software_instance
.
getPortalType
()
==
'Slave Instance'
,
"connection"
:
software_instance
.
getConnectionXmlAsDict
(),
"parameter"
:
software_instance
.
getInstanceXmlAsDict
(),
"sla"
:
software_instance
.
getSlaXmlAsDict
(),
"children_list"
:
[
q
.
absolute_url
()
for
q
in
\
s
elf
.
s
oftware_instance
.
getPredecessorValueList
()],
software_instance
.
getPredecessorValueList
()],
"partition"
:
{
# not ready yet
"public_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