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
791a849a
Commit
791a849a
authored
Feb 17, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: force using ledger=automated
Disable all simulation logic if the automated ledger is not used
parent
070480cc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
5 deletions
+17
-5
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.py
...m/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.py
+4
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_manageBuildingCalculatingDelivery.py
...pos_simulation/Alarm_manageBuildingCalculatingDelivery.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.py
...ation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.py
+5
-2
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSMovement.py
...slapos_simulation/DeliveryBuilder_selectSlapOSMovement.py
+5
-2
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_buildSlapOS.py
...skins/slapos_simulation/SimulationMovement_buildSlapOS.py
+2
-0
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_buildSlapOSPath.py
View file @
791a849a
portal
=
context
.
getPortalObject
()
kw
=
{}
select_dict
=
{
'delivery_uid'
:
None
}
kw
.
update
(
portal_type
=
'Simulation Movement'
,
ledger__uid
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
(),
# This is an optimisation to help mariadb selecting a better index
simulation_state
=
[
'draft'
,
'planned'
,
None
],
left_join_list
=
select_dict
.
keys
(),
delivery_uid
=
None
)
context
.
getPortalObject
()
.
portal_catalog
.
searchAndActivate
(
portal
.
portal_catalog
.
searchAndActivate
(
method_id
=
'SimulationMovement_buildSlapOS'
,
packet_size
=
1
,
# Separate calls to many transactions
method_kw
=
{
'tag'
:
tag
},
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/Alarm_manageBuildingCalculatingDelivery.py
View file @
791a849a
...
...
@@ -4,6 +4,7 @@ activate_kw = {
}
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
portal
.
getPortalDeliveryTypeList
(),
ledger__uid
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
(),
causality_state
=
(
'building'
,
'calculating'
),
activate_kw
=
activate_kw
,
packet_size
=
30
,
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSConfirmedInvoiceList.py
View file @
791a849a
portal
=
context
.
getPortalObject
()
portal_type
=
context
.
getDeliveryPortalType
()
simulation_state
=
'confirmed'
# use catalog to prefetch, but check later in ZODB
return
[
x
.
getObject
()
for
x
in
context
.
getPortalObject
()
.
portal_catalog
(
return
[
x
.
getObject
()
for
x
in
portal
.
portal_catalog
(
portal_type
=
portal_type
,
ledger__uid
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
(),
# BEWARE: it works only in case of per-tree building
default_destination_section_uid
=
movement_list
[
0
].
getDestinationSectionUid
(),
destination_section__uid
=
movement_list
[
0
].
getDestinationSectionUid
(),
destination_project__uid
=
movement_list
[
0
].
getDestinationProjectUid
(),
simulation_state
=
simulation_state
)
if
x
.
getSimulationState
()
==
simulation_state
]
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/DeliveryBuilder_selectSlapOSMovement.py
View file @
791a849a
...
...
@@ -3,7 +3,10 @@ kw['select_dict']=select_dict
kw
[
'left_join_list'
]
=
select_dict
.
keys
()
kw
[
'delivery_uid'
]
=
None
kw
[
'group_by'
]
=
(
'uid'
,)
portal
=
context
.
getPortalObject
()
kw
[
'ledger__uid'
]
=
portal
.
portal_categories
.
ledger
.
automated
.
getUid
()
if
src__
==
0
:
return
context
.
portal_catalog
(
**
kw
)
return
portal
.
portal_catalog
(
**
kw
)
else
:
return
context
.
portal_catalog
(
src__
=
1
,
**
kw
)
return
portal
.
portal_catalog
(
src__
=
1
,
**
kw
)
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SimulationMovement_buildSlapOS.py
View file @
791a849a
if
context
.
getDelivery
()
is
not
None
:
# movement build but not indexed, so do nothing
return
if
context
.
getLedger
()
!=
'automated'
:
return
root_applied_rule
=
context
.
getRootAppliedRule
()
root_applied_rule_path
=
root_applied_rule
.
getPath
()
...
...
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