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
3c4e7c61
Commit
3c4e7c61
authored
Feb 20, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: archive Compute Node, Project open order and hosting subscription
parent
493e95b4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
14 deletions
+4
-14
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_archiveIfUnusedItem.py
...ns/slapos_accounting/OpenSaleOrder_archiveIfUnusedItem.py
+4
-14
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/OpenSaleOrder_archiveIfUnusedItem.py
View file @
3c4e7c61
...
...
@@ -14,26 +14,16 @@ for open_order_line in open_sale_order.contentValues(
content_list
=
[
open_order_line
]
for
open_order_cell
in
content_list
:
item
=
open_order_cell
.
getAggregateValue
(
portal_type
=
[
'Instance Tree'
,
'Compute Node'
,
'Project'
])
hosting_subscription
=
open_order_cell
.
getAggregateValue
(
portal_type
=
'Hosting Subscription'
)
if
item
is
None
:
raise
AssertionError
(
'No matching item on: %s'
%
open_order_cell
.
getRelativeUrl
())
elif
item
.
getPortalType
()
==
'Instance Tree'
:
if
item
.
getSlapState
()
!=
'destroy_requested'
:
# Do not touch if the instance is still started/stopped
if
item
.
getValidationState
()
not
in
[
'invalidated'
,
'archived'
]:
# Do not touch if the item is not clean yet
return
elif
item
.
getPortalType
()
==
'Compute Node'
:
# XXX TODO how to officially close a Compute Node
#raise NotImplementedError('what is the finished state for Compute Node')
return
elif
item
.
getPortalType
()
==
'Project'
:
# Do not close project for now
return
else
:
raise
KeyError
(
'Unexpected portal type: %s on %s'
%
(
item
.
getPortalType
(),
open_order_cell
.
getRelativeUrl
()))
hosting_subscription
.
archive
(
comment
=
'No item in used anymore'
)
# if the script didn't return before, we can archive the open sale order
now
=
DateTime
()
...
...
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