Commit e3e7a9db authored by Romain Courteaud's avatar Romain Courteaud

slapos_*: drop open/personal allocation_scope

parent f05ebda1
...@@ -3,6 +3,7 @@ portal = context.getPortalObject() ...@@ -3,6 +3,7 @@ portal = context.getPortalObject()
compute_partition_list = portal.portal_catalog( compute_partition_list = portal.portal_catalog(
software_release_url=context.getUrlString(), software_release_url=context.getUrlString(),
free_for_request=1, free_for_request=1,
follow_up__uid=context.getFollowUpUid(),
group_by=("parent_uid",) group_by=("parent_uid",)
) )
......
...@@ -2,7 +2,6 @@ compute_node = state_change['object'] ...@@ -2,7 +2,6 @@ compute_node = state_change['object']
portal = compute_node.getPortalObject() portal = compute_node.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue() person = portal.portal_membership.getAuthenticatedMember().getUserValue()
compute_node.edit( compute_node.edit(
allocation_scope='open/personal',
source_administration_value=person, source_administration_value=person,
upgrade_scope='auto', upgrade_scope='auto',
capacity_scope='open' capacity_scope='open'
......
...@@ -109,6 +109,11 @@ if aggregate_portal_type == "Instance Tree": ...@@ -109,6 +109,11 @@ if aggregate_portal_type == "Instance Tree":
message_list.append("%s has error (%s, %s at %s scope %s)" % (instance.getReference(), instance.getTitle(), message_list.append("%s has error (%s, %s at %s scope %s)" % (instance.getReference(), instance.getTitle(),
instance.getUrlString(), compute_node.getReference(), instance.getUrlString(), compute_node.getReference(),
compute_node.getAllocationScope())) compute_node.getAllocationScope()))
if instance.getPortalType() == "Software Instance" and \
compute_node.getAllocationScope() in ["closed/outdated"] and \
instance.getSlapState() == "start_requested" and \
instance.SoftwareInstance_hasReportedError():
message_list.append("%s on a %s compute_node" % (instance.getReference(), compute_node.getAllocationScope()) )
else: else:
message_list.append("%s is not allocated" % instance.getReference()) message_list.append("%s is not allocated" % instance.getReference())
return ",".join(message_list) return ",".join(message_list)
......
...@@ -20,9 +20,5 @@ if scope == 'open/public': ...@@ -20,9 +20,5 @@ if scope == 'open/public':
return {"Auditor": ["R-SHADOW-PERSON"]} return {"Auditor": ["R-SHADOW-PERSON"]}
elif scope == 'open/subscription': elif scope == 'open/subscription':
return {"Auditor": ["R-SHADOW-PERSON"]} return {"Auditor": ["R-SHADOW-PERSON"]}
elif scope == 'open/personal':
person = compute_node.getSourceAdministrationValue(portal_type="Person")
if person is not None:
return {"Auditor": ["SHADOW-%s" % person.getUserId()]}
return category_list return category_list
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
.push(function (result) { .push(function (result) {
var i, value, value_jio_key, len = result.data.total_rows; var i, value, value_jio_key, len = result.data.total_rows;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.getAccessStatus) { if (1 || (result.data.rows[i].value.getAccessStatus)) {
value = result.data.rows[i].value.getAccessStatus; value = result.data.rows[i].value.getAccessStatus;
value_jio_key = result.data.rows[i].id; value_jio_key = result.data.rows[i].id;
result.data.rows[i].value.getAccessStatus = { result.data.rows[i].value.getAccessStatus = {
...@@ -101,14 +101,13 @@ ...@@ -101,14 +101,13 @@
"Closed for termination", "Closed for termination",
"Closed forever", "Closed forever",
"Closed outdated", "Closed outdated",
"Open for Friends only", // Not used anymore "Open for Friends only",
"Open",
"Open Public", "Open Public",
"Open for Subscribers only", "Open for Subscribers only",
"Network", "Network",
"Allocation Scope", "Allocation Scope",
"Monitoring", "Monitoring",
"Your Friends email", // Not used anymore "Your Friends email",
"Upgrade", "Upgrade",
"The name of a document in ERP5", "The name of a document in ERP5",
"Current Site", "Current Site",
...@@ -163,23 +162,16 @@ ...@@ -163,23 +162,16 @@
[results[2][10], 'auto'], [results[2][10], 'auto'],
[results[2][11], 'ask_confirmation'], [results[2][11], 'ask_confirmation'],
[results[2][12], 'never']], [results[2][12], 'never']],
supported_allocation_scope_list = ['',
'close/maintenance',
'close/termination',
'close/forever',
'close/outdated',
'close/noallocation',
'open/personal'],
allocation_scope_list = [['', ''], allocation_scope_list = [['', ''],
[results[2][13], 'close/maintenance'], [results[2][13], 'close/maintenance'],
[results[2][14], 'close/termination'], [results[2][14], 'close/termination'],
[results[2][15], 'close/forever'], [results[2][15], 'close/forever'],
[results[2][16], 'close/outdated'], [results[2][16], 'close/outdated'],
[results[2][33], 'close/noallocation'], [results[2][33], 'close/noallocation'],
[results[2][18], 'open/personal']], [results[2][17], 'open/friend'],
[results[2][18], 'open/public'],
[results[2][19], 'open/subscription']],
i, i,
hidden_allocation_scope = {'open/public': results[2][19],
'open/subscription': results[2][20]},
len = results[1].data.total_rows; len = results[1].data.total_rows;
...@@ -190,16 +182,6 @@ ...@@ -190,16 +182,6 @@
]); ]);
} }
if (!supported_allocation_scope_list.includes(
gadget.state.doc.allocation_scope
) && (hidden_allocation_scope.hasOwnProperty(gadget.state.doc.allocation_scope))) {
allocation_scope_list.push(
[hidden_allocation_scope[gadget.state.doc.allocation_scope],
gadget.state.doc.allocation_scope
]
);
}
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
...@@ -261,6 +243,17 @@ ...@@ -261,6 +243,17 @@
"hidden": 0, "hidden": 0,
"type": "ListField" "type": "ListField"
}, },
"my_subject_list": {
"description": "",
"title": results[2][24],
"default": gadget.state.doc.subject_list,
"css_class": "",
"required": 1,
"editable": 1,
"key": "subject_list",
"hidden": (gadget.state.doc.allocation_scope === "open/friend") ? 0 : 1,
"type": "LinesField"
},
"my_upgrade_scope": { "my_upgrade_scope": {
"description": "", "description": "",
"title": results[2][25], "title": results[2][25],
...@@ -367,7 +360,8 @@ ...@@ -367,7 +360,8 @@
], [ ], [
"right", "right",
[["my_source"], ["my_source_project"], ["my_monitor_scope"], [["my_source"], ["my_source_project"], ["my_monitor_scope"],
["my_upgrade_scope"], ["my_allocation_scope"]] ["my_upgrade_scope"], ["my_allocation_scope"],
["my_subject_list"]]
], [ ], [
"bottom", "bottom",
[["ticket_listbox"], ["listbox"]] [["ticket_listbox"], ["listbox"]]
......
...@@ -100,11 +100,9 @@ ...@@ -100,11 +100,9 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="_reconstructor" module="copy_reg"/> <global name="DateTime" module="DateTime.DateTime"/>
</klass> </klass>
<tuple> <tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/> <none/>
</tuple> </tuple>
<state> <state>
...@@ -209,11 +207,9 @@ ...@@ -209,11 +207,9 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="_reconstructor" module="copy_reg"/> <global name="DateTime" module="DateTime.DateTime"/>
</klass> </klass>
<tuple> <tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/> <none/>
</tuple> </tuple>
<state> <state>
...@@ -267,7 +263,7 @@ ...@@ -267,7 +263,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.39762.20916.26709</string> </value> <value> <string>998.18207.59213.64375</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -278,16 +274,14 @@ ...@@ -278,16 +274,14 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="_reconstructor" module="copy_reg"/> <global name="DateTime" module="DateTime.DateTime"/>
</klass> </klass>
<tuple> <tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/> <none/>
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1700505669.56</float> <float>1652949235.86</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -341,11 +335,9 @@ ...@@ -341,11 +335,9 @@
<value> <value>
<object> <object>
<klass> <klass>
<global name="_reconstructor" module="copy_reg"/> <global name="DateTime" module="DateTime.DateTime"/>
</klass> </klass>
<tuple> <tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/> <none/>
</tuple> </tuple>
<state> <state>
......
portal = context.getPortalObject() portal = context.getPortalObject()
category_public = portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None) category_public = portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None)
category_personal = portal.restrictedTraverse("portal_categories/allocation_scope/open/personal", None)
return portal.portal_catalog( return portal.portal_catalog(
portal_type='Compute Node', portal_type='Compute Node',
default_allocation_scope_uid=[ default_allocation_scope_uid=[
category_public.getUid(), category_public.getUid(),
category_personal.getUid()], ],
validation_state="validated", validation_state="validated",
sort_on=(("title", "ASC" ),) sort_on=(("title", "ASC" ),)
) )
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