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
22
Merge Requests
22
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
f3462719
Commit
f3462719
authored
Nov 16, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Master is now stateless.
Slaptool should not try to update Packing List state.
parent
3f7f72cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
71 deletions
+20
-71
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+20
-71
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
f3462719
...
@@ -909,36 +909,16 @@ class SlapTool(BaseTool):
...
@@ -909,36 +909,16 @@ class SlapTool(BaseTool):
@
convertToREST
@
convertToREST
def
_buildingComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
def
_buildingComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
"""
"""
Reports that Computer Partition is being build
Kept for compatibility
"""
"""
instance
=
self
.
_getSoftwareInstanceForComputerPartition
(
pass
computer_id
,
computer_partition_id
)
delivery
=
instance
.
getCausalityValue
(
portal_type
=
[
"Sale Packing List"
])
if
delivery
is
not
None
:
portal
=
self
.
getPortalObject
()
line
=
delivery
.
contentValues
(
portal_type
=
"Sale Packing List Line"
)[
0
]
if
line
.
getResource
()
==
portal
.
portal_preferences
.
\
getPreferredInstanceSetupResource
():
if
portal
.
portal_workflow
.
isTransitionPossible
(
delivery
,
'start'
):
delivery
.
start
()
@
convertToREST
@
convertToREST
def
_availableComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
def
_availableComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
"""
"""
Reports that Computer Partition is available
Kept for compatibility
"""
"""
instance
=
self
.
_getSoftwareInstanceForComputerPartition
(
pass
computer_id
,
computer_partition_id
)
delivery
=
instance
.
getCausalityValue
(
portal_type
=
[
"Sale Packing List"
])
if
delivery
is
not
None
:
portal
=
self
.
getPortalObject
()
line
=
delivery
.
contentValues
(
portal_type
=
"Sale Packing List Line"
)[
0
]
if
line
.
getResource
()
==
portal
.
portal_preferences
.
\
getPreferredInstanceSetupResource
():
if
portal
.
portal_workflow
.
isTransitionPossible
(
delivery
,
'stop'
):
delivery
.
stop
()
@
convertToREST
@
convertToREST
def
_softwareInstanceError
(
self
,
computer_id
,
def
_softwareInstanceError
(
self
,
computer_id
,
...
@@ -1021,38 +1001,16 @@ class SlapTool(BaseTool):
...
@@ -1021,38 +1001,16 @@ class SlapTool(BaseTool):
@
convertToREST
@
convertToREST
def
_startedComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
def
_startedComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
"""
"""
Reports that Computer Partition is started
Kept for compatibility
"""
"""
instance
=
self
.
_getSoftwareInstanceForComputerPartition
(
pass
computer_id
,
computer_partition_id
)
delivery
=
instance
.
getCausalityValue
(
portal_type
=
[
"Sale Packing List"
])
if
delivery
is
not
None
:
portal
=
self
.
getPortalObject
()
line
=
delivery
.
contentValues
(
portal_type
=
"Sale Packing List Line"
)[
0
]
if
line
.
getResource
()
in
[
portal
.
portal_preferences
.
getPreferredInstanceHostingResource
(),
portal
.
portal_preferences
.
getPreferredInstanceUpdateResource
()]:
if
portal
.
portal_workflow
.
isTransitionPossible
(
delivery
,
'start'
):
delivery
.
start
()
@
convertToREST
@
convertToREST
def
_stoppedComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
def
_stoppedComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
"""
"""
Reports that Computer Partition is stopped
Kept for compatibility
"""
"""
instance
=
self
.
_getSoftwareInstanceForComputerPartition
(
pass
computer_id
,
computer_partition_id
)
delivery
=
instance
.
getCausalityValue
(
portal_type
=
[
"Sale Packing List"
])
if
delivery
is
not
None
:
portal
=
self
.
getPortalObject
()
line
=
delivery
.
contentValues
(
portal_type
=
"Sale Packing List Line"
)[
0
]
if
line
.
getResource
()
in
[
portal
.
portal_preferences
.
getPreferredInstanceHostingResource
(),
portal
.
portal_preferences
.
getPreferredInstanceUpdateResource
()]:
if
portal
.
portal_workflow
.
isTransitionPossible
(
delivery
,
'stop'
):
delivery
.
stop
()
@
convertToREST
@
convertToREST
def
_destroyedComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
def
_destroyedComputerPartition
(
self
,
computer_id
,
computer_partition_id
):
...
@@ -1071,28 +1029,19 @@ class SlapTool(BaseTool):
...
@@ -1071,28 +1029,19 @@ class SlapTool(BaseTool):
)
)
if
instance
.
getValidationState
()
==
'validated'
:
if
instance
.
getValidationState
()
==
'validated'
:
instance
.
invalidate
()
instance
.
invalidate
()
delivery
=
instance
.
getCausalityValue
(
portal_type
=
[
"Sale Packing List"
])
if
delivery
is
not
None
:
portal
=
self
.
getPortalObject
()
line
=
delivery
.
contentValues
(
portal_type
=
"Sale Packing List Line"
)[
0
]
if
line
.
getResource
()
in
[
portal
.
portal_preferences
.
getPreferredInstanceCleanupResource
()]:
if
portal
.
portal_workflow
.
isTransitionPossible
(
delivery
,
'stop'
):
delivery
.
stop
()
if
portal
.
portal_workflow
.
isTransitionPossible
(
delivery
,
'deliver'
):
delivery
.
deliver
()
# XXX Integrate with REST API
# XXX Integrate with REST API
# Code duplication will be needed until SlapTool is removed
# Code duplication will be needed until SlapTool is removed
# revoke certificate
# revoke certificate
try
:
portal
=
self
.
getPortalObject
()
portal
.
portal_certificate_authority
\
try
:
.
revokeCertificate
(
instance
.
getDestinationReference
())
portal
.
portal_certificate_authority
\
except
ValueError
:
.
revokeCertificate
(
instance
.
getDestinationReference
())
# Ignore already revoked certificates, as OpenSSL backend is
except
ValueError
:
# non transactional, so it is ok to allow multiple tries to destruction
# Ignore already revoked certificates, as OpenSSL backend is
# even if certificate was already revoked
# non transactional, so it is ok to allow multiple tries to destruction
pass
# even if certificate was already revoked
pass
@
convertToREST
@
convertToREST
...
...
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