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
58ab7ea3
Commit
58ab7ea3
authored
Jul 31, 2019
by
Łukasz Nowak
Committed by
Rafael Monnerat
Aug 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Create auto upgrade decisions for Slave Instances too
parent
b931628c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_createUpgradeDecision.py
...s/slapos_pdm/HostingSubscription_createUpgradeDecision.py
+22
-8
No files found.
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/HostingSubscription_createUpgradeDecision.py
View file @
58ab7ea3
...
@@ -2,13 +2,19 @@ from DateTime import DateTime
...
@@ -2,13 +2,19 @@ from DateTime import DateTime
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
hosting_subscription
=
context
hosting_subscription
=
context
if
context
.
getUpgradeScope
()
==
"never"
:
upgrade_scope
=
context
.
getUpgradeScope
()
if
upgrade_scope
==
"never"
:
return
return
root_instance
=
hosting_subscription
.
getPredecessorValue
(
portal_type
=
"Software Instance"
)
root_instance
=
hosting_subscription
.
getPredecessorValue
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
]
)
if
root_instance
is
None
:
if
root_instance
is
None
:
return
return
slave_upgrade
=
False
if
root_instance
.
getPortalType
()
==
'Slave Instance'
:
slave_upgrade
=
True
upgrade_scope
=
"auto"
if
hosting_subscription
.
getSlapState
()
==
"destroy_requested"
:
if
hosting_subscription
.
getSlapState
()
==
"destroy_requested"
:
return
return
...
@@ -22,12 +28,20 @@ partition = root_instance.getAggregateValue(portal_type="Computer Partition")
...
@@ -22,12 +28,20 @@ partition = root_instance.getAggregateValue(portal_type="Computer Partition")
if
partition
is
None
:
if
partition
is
None
:
return
return
if
not
partition
.
getParentValue
().
getAllocationScopeUid
()
in
[
category
.
getUid
()
\
for
category
in
portal
.
portal_categories
.
allocation_scope
.
open
.
objectValues
()]:
return
decision_title
=
'A new upgrade is available for %s'
%
hosting_subscription
.
getTitle
()
decision_title
=
'A new upgrade is available for %s'
%
hosting_subscription
.
getTitle
()
newer_release
=
hosting_subscription
.
\
newer_release
=
None
if
slave_upgrade
:
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
if
software_instance
:
url_string
=
software_instance
.
getUrlString
()
if
url_string
!=
hosting_subscription
.
getUrlString
():
newer_release
=
context
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Release'
,
url_string
=
url_string
)
else
:
if
not
partition
.
getParentValue
().
getAllocationScopeUid
()
in
[
category
.
getUid
()
\
for
category
in
portal
.
portal_categories
.
allocation_scope
.
open
.
objectValues
()]:
return
newer_release
=
hosting_subscription
.
\
HostingSubscription_getUpgradableSoftwareRelease
()
HostingSubscription_getUpgradableSoftwareRelease
()
if
newer_release
is
None
:
if
newer_release
is
None
:
return
return
...
@@ -47,7 +61,7 @@ upgrade_decision = newer_release.SoftwareRelease_createUpgradeDecision(
...
@@ -47,7 +61,7 @@ upgrade_decision = newer_release.SoftwareRelease_createUpgradeDecision(
with
upgrade_decision
.
defaultActivateParameterDict
(
activate_kw
):
with
upgrade_decision
.
defaultActivateParameterDict
(
activate_kw
):
upgrade_decision
.
plan
()
upgrade_decision
.
plan
()
upgrade_decision
.
setStartDate
(
DateTime
())
upgrade_decision
.
setStartDate
(
DateTime
())
if
hosting_subscription
.
getUpgradeScope
()
==
"auto"
:
if
upgrade_scope
==
"auto"
:
upgrade_decision
.
start
()
upgrade_decision
.
start
()
# Prevent concurrent transaction to create 2 upgrade decision for the same hosting_subscription
# Prevent concurrent transaction to create 2 upgrade decision for the same hosting_subscription
...
...
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