Commit 6b53d073 authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel: simplify script

All outdated items should have a validation_state to validated
parent 40affc42
# This script might not be efficient to a large quantities of
# Compute Nodes
from DateTime import DateTime
kw.update({
"follow_up_uid": context.getUid(),
"portal_type": ['Instance Node', 'Remote Node', 'Compute Node', 'Instance Tree', 'Computer Network']
"follow_up__uid": context.getUid(),
"portal_type": ['Instance Node', 'Remote Node', 'Compute Node', 'Instance Tree', 'Computer Network'],
"validation_state": "validated"
})
def filter_per_portal_type(document):
if document.getPortalType() == "Compute Node" \
and document.getAllocationScope() != "close/forever":
return document
elif document.getPortalType() == "Instance Tree" \
and document.getSlapState() != "destroy_requested":
return document
elif document.getPortalType() == "Computer Network" \
and document.getValidationState() == "validated":
return document
return [ i.getObject()
for i in context.getPortalObject().portal_catalog(**kw)
if filter_per_portal_type(i.getObject())]
return context.getPortalObject().portal_catalog(**kw)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment