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
Titouan Soulard
slapos.core
Commits
d211db1f
Commit
d211db1f
authored
Mar 22, 2023
by
Cédric Le Ninivin
Committed by
Titouan Soulard
Oct 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Add useRevision to SoftwareInstance
parent
7b81a5a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
19 deletions
+32
-19
master/bt5/slapos_cloud/DocumentTemplateItem/portal_components/document.erp5.SoftwareInstance.py
...eItem/portal_components/document.erp5.SoftwareInstance.py
+32
-19
No files found.
master/bt5/slapos_cloud/DocumentTemplateItem/portal_components/document.erp5.SoftwareInstance.py
View file @
d211db1f
...
@@ -183,6 +183,9 @@ class SoftwareInstance(Item, JSONType):
...
@@ -183,6 +183,9 @@ class SoftwareInstance(Item, JSONType):
def
getSlapTimestamp
(
self
):
def
getSlapTimestamp
(
self
):
return
self
.
_getSlapTimestamp
()
return
self
.
_getSlapTimestamp
()
def
useRevision
(
self
):
return
getattr
(
self
,
"use_jio_api_revision"
,
False
)
@
UnrestrictedMethod
@
UnrestrictedMethod
def
_getSlapTimestamp
(
self
):
def
_getSlapTimestamp
(
self
):
compute_partition
=
self
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
compute_partition
=
self
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
...
@@ -198,6 +201,8 @@ class SoftwareInstance(Item, JSONType):
...
@@ -198,6 +201,8 @@ class SoftwareInstance(Item, JSONType):
# XXX In the current what shared instances are processed, they cannot be reprocessed if the
# XXX In the current what shared instances are processed, they cannot be reprocessed if the
# host instance is not processed
# host instance is not processed
if
(
self
.
getPortalType
()
==
"Software Instance"
):
if
(
self
.
getPortalType
()
==
"Software Instance"
):
shared_instance_sql_list
=
[]
if
self
.
useRevision
():
shared_instance_sql_list
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
shared_instance_sql_list
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
default_aggregate_uid
=
compute_partition
.
getUid
(),
default_aggregate_uid
=
compute_partition
.
getUid
(),
portal_type
=
'Slave Instance'
,
portal_type
=
'Slave Instance'
,
...
@@ -207,13 +212,20 @@ class SoftwareInstance(Item, JSONType):
...
@@ -207,13 +212,20 @@ class SoftwareInstance(Item, JSONType):
limit
=
1
,
limit
=
1
,
**
{
"slapos_item.slap_state"
:
"start_requested"
}
**
{
"slapos_item.slap_state"
:
"start_requested"
}
)
)
if
shared_instance_sql_list
:
else
:
shared_instance
=
shared_instance_sql_list
[
0
].
getObject
()
shared_instance_sql_list
=
self
.
getPortalObject
().
portal_catalog
.
unrestrictedSearchResults
(
most_recent_hosted_instance_timestamp
=
int
(
default_aggregate_uid
=
compute_partition
.
getUid
(),
shared_instance
.
getBangTimestamp
(
int
(
shared_instance
.
getModificationDate
()))
portal_type
=
'Slave Instance'
,
validation_state
=
"validated"
,
**
{
"slapos_item.slap_state"
:
"start_requested"
}
)
)
if
(
most_recent_hosted_instance_timestamp
>
timestamp
):
for
shared_instance
in
shared_instance_sql_list
:
timestamp
=
most_recent_hosted_instance_timestamp
shared_instance
=
_assertACI
(
shared_instance
.
getObject
())
# XXX Use catalog to filter more efficiently
if
shared_instance
.
getSlapState
()
==
"start_requested"
:
newtimestamp
=
int
(
shared_instance
.
getBangTimestamp
(
int
(
shared_instance
.
getModificationDate
())))
if
(
newtimestamp
>
timestamp
):
timestamp
=
newtimestamp
return
timestamp
return
timestamp
...
@@ -397,6 +409,7 @@ class SoftwareInstance(Item, JSONType):
...
@@ -397,6 +409,7 @@ class SoftwareInstance(Item, JSONType):
"access_status_message"
:
self
.
getTextAccessStatus
(),
"access_status_message"
:
self
.
getTextAccessStatus
(),
"portal_type"
:
self
.
getPortalType
(),
"portal_type"
:
self
.
getPortalType
(),
}
}
if
self
.
useRevision
():
web_section
=
self
.
getWebSectionValue
()
web_section
=
self
.
getWebSectionValue
()
web_section
=
web_section
.
getRelativeUrl
()
if
web_section
else
self
.
REQUEST
.
get
(
"web_section_relative_url"
,
None
)
web_section
=
web_section
.
getRelativeUrl
()
if
web_section
else
self
.
REQUEST
.
get
(
"web_section_relative_url"
,
None
)
if
web_section
:
if
web_section
:
...
...
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