Commit e00424c1 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_*: No more Friend allocation scope

See merge request nexedi/slapos.core!491
parents b7a0e617 2be25c85
Pipeline #27083 failed with stage
in 0 seconds
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Allocate services for the owner of the friends of the compute_node</string> </value>
</item>
<item>
<key> <string>effective_date</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>friend</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Friend</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,7 +2,6 @@ portal = context.getPortalObject() ...@@ -2,7 +2,6 @@ portal = context.getPortalObject()
category_list = [portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None), category_list = [portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None),
portal.restrictedTraverse("portal_categories/allocation_scope/open/subscription", None), portal.restrictedTraverse("portal_categories/allocation_scope/open/subscription", None),
portal.restrictedTraverse("portal_categories/allocation_scope/open/friend", None),
portal.restrictedTraverse("portal_categories/allocation_scope/open/personal", None)] portal.restrictedTraverse("portal_categories/allocation_scope/open/personal", None)]
category_uid_list = [ i.getUid() for i in category_list if i is not None] category_uid_list = [ i.getUid() for i in category_list if i is not None]
......
...@@ -4,7 +4,7 @@ from zExceptions import Unauthorized ...@@ -4,7 +4,7 @@ from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
if compute_node.getAllocationScope() not in ['open/public', 'open/subscription', 'open/personal', 'open/friend']: if compute_node.getAllocationScope() not in ['open/public', 'open/subscription', 'open/personal']:
# Don't update non closed computers # Don't update non closed computers
return return
......
...@@ -108,7 +108,6 @@ ...@@ -108,7 +108,6 @@
<value> <value>
<list> <list>
<string>my_allocation_scope</string> <string>my_allocation_scope</string>
<string>my_subject_list</string>
<string>my_translated_validation_state_title</string> <string>my_translated_validation_state_title</string>
</list> </list>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="LinesField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_subject_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>line_too_long</string> </key>
<value> <string>A line was too long.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>You entered too many characters.</string> </value>
</item>
<item>
<key> <string>too_many_lines</string> </key>
<value> <string>You entered too many lines.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_linelength</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Friends (email)</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />
]]></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>40</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getSubjectList()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -4,7 +4,7 @@ kw['url_string'] = context.getUrlString() ...@@ -4,7 +4,7 @@ kw['url_string'] = context.getUrlString()
software_installation_list = context.portal_catalog(**kw) software_installation_list = context.portal_catalog(**kw)
compute_node_list = [] compute_node_list = []
allocation_scope_list = ['open/personal', 'open/public', 'open/friend'] allocation_scope_list = ['open/personal', 'open/public']
for software_installation in software_installation_list: for software_installation in software_installation_list:
compute_node = software_installation.getAggregateValue() compute_node = software_installation.getAggregateValue()
if software_installation.getSlapState() == 'start_requested' and \ if software_installation.getSlapState() == 'start_requested' and \
......
...@@ -177,19 +177,6 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin): ...@@ -177,19 +177,6 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
self.assertEqual('open', server.getCapacityScope()) self.assertEqual('open', server.getCapacityScope())
self.tic() self.tic()
@changeSkin('RJS')
def setServerOpenFriend(self, server, friend_list=None):
if friend_list is None:
friend_list = []
server.edit(
allocation_scope='open/friend', subject_list=friend_list)
self.assertEqual('open/friend', server.getAllocationScope())
# Called by alarm
server.ComputeNode_checkAndUpdateCapacityScope()
self.assertEqual('open', server.getCapacityScope())
self.assertSameSet(friend_list, server.getSubjectList())
self.tic()
def formatComputeNode(self, compute_node, partition_count=10): def formatComputeNode(self, compute_node, partition_count=10):
compute_node_dict = dict( compute_node_dict = dict(
software_root='/opt', software_root='/opt',
......
...@@ -480,9 +480,6 @@ class TestSlapOSComputeNode_checkAndUpdateCapacityScopeSubscription(TestSlapOSCo ...@@ -480,9 +480,6 @@ class TestSlapOSComputeNode_checkAndUpdateCapacityScopeSubscription(TestSlapOSCo
class TestSlapOSComputeNode_checkAndUpdateCapacityScopePersonal(TestSlapOSComputeNode_checkAndUpdateCapacityScope): class TestSlapOSComputeNode_checkAndUpdateCapacityScopePersonal(TestSlapOSComputeNode_checkAndUpdateCapacityScope):
allocation_scope_to_test = 'open/personal' allocation_scope_to_test = 'open/personal'
class TestSlapOSComputeNode_checkAndUpdateCapacityScopeFriend(TestSlapOSComputeNode_checkAndUpdateCapacityScope):
allocation_scope_to_test = 'open/friend'
class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin): class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
...@@ -513,10 +510,6 @@ class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin): ...@@ -513,10 +510,6 @@ class TestSlapOSUpdateComputeNodeCapacityScopeAlarm(SlapOSTestCaseMixin):
self.compute_node.edit(allocation_scope='open/personal') self.compute_node.edit(allocation_scope='open/personal')
self.test_alarm() self.test_alarm()
def test_alarm_friend(self):
self.compute_node.edit(allocation_scope='open/friend')
self.test_alarm()
def test_alarm_non_public(self): def test_alarm_non_public(self):
self.compute_node.edit(allocation_scope='close') self.compute_node.edit(allocation_scope='close')
self._test_alarm_not_visited( self._test_alarm_not_visited(
......
...@@ -242,80 +242,6 @@ return True""" ) ...@@ -242,80 +242,6 @@ return True""" )
self.assertEqual(self.partition.getRelativeUrl(), self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate(portal_type='Compute Partition')) self.software_instance.getAggregate(portal_type='Compute Partition'))
@simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True')
def test_allocation_allocation_scope_open_friend(self):
self._makeTree()
self._makeComputeNode()
self._installSoftware(self.compute_node,
self.software_instance.getUrlString())
# change compute_node owner
new_id = self.generateNewId()
person_user = self.portal.person_module.template_member.\
Base_createCloneDocument(batch_mode=1)
person_user.edit(
title="live_test_%s" % new_id,
reference="live_test_%s" % new_id,
default_email_text="live_test_%s@example.org" % new_id,
)
person_user.validate()
for assignment in person_user.contentValues(portal_type="Assignment"):
assignment.open()
self.compute_node.edit(
source_administration=person_user.getRelativeUrl(),
destination_section=self.person_user.getRelativeUrl(),
allocation_scope='open/friend')
self.compute_node.setAccessStatus("#access ok")
self.tic()
self.compute_node.ComputeNode_checkAndUpdateCapacityScope()
self.assertEqual(self.compute_node.getCapacityScope(), 'open')
self.tic()
self.assertEqual(None, self.software_instance.getAggregateValue(
portal_type='Compute Partition'))
self.software_instance.SoftwareInstance_tryToAllocatePartition()
self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate(portal_type='Compute Partition'))
@simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True')
def test_allocation_host_allocation_scope_open_friend(self):
self._makeSlaveTree()
self._makeComputeNode()
self._allocateHost(self.requested_software_instance,
self.partition)
# change compute_node owner
new_id = self.generateNewId()
person_user = self.portal.person_module.template_member.\
Base_createCloneDocument(batch_mode=1)
person_user.edit(
title="live_test_%s" % new_id,
reference="live_test_%s" % new_id,
default_email_text="live_test_%s@example.org" % new_id,
)
person_user.validate()
for assignment in person_user.contentValues(portal_type="Assignment"):
assignment.open()
self.compute_node.edit(
source_administration=person_user.getRelativeUrl(),
destination_section=self.person_user.getRelativeUrl(),
allocation_scope='open/friend')
self.compute_node.setAccessStatus("#access ok")
self.tic()
self.compute_node.ComputeNode_checkAndUpdateCapacityScope()
self.assertEqual(self.compute_node.getCapacityScope(), 'open')
self.tic()
self.assertEqual(None, self.software_instance.getAggregateValue(
portal_type='Compute Partition'))
self.software_instance.SoftwareInstance_tryToAllocatePartition()
self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate(portal_type='Compute Partition'))
@simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True') @simulate('Person_isAllowedToAllocate', '*args, **kwargs', 'return True')
def test_allocation_does_not_fail_on_instance_with_damaged_sla_xml(self): def test_allocation_does_not_fail_on_instance_with_damaged_sla_xml(self):
self._makeTree() self._makeTree()
......
...@@ -5,9 +5,6 @@ from Products.ERP5Type.Document import newTempBase ...@@ -5,9 +5,6 @@ from Products.ERP5Type.Document import newTempBase
public_category_uid = portal.restrictedTraverse( public_category_uid = portal.restrictedTraverse(
"portal_categories/allocation_scope/open/public", None).getUid() "portal_categories/allocation_scope/open/public", None).getUid()
friend_category_uid = portal.restrictedTraverse(
"portal_categories/allocation_scope/open/friend", None).getUid()
personal_category_uid = portal.restrictedTraverse( personal_category_uid = portal.restrictedTraverse(
"portal_categories/allocation_scope/open/personal", None).getUid() "portal_categories/allocation_scope/open/personal", None).getUid()
...@@ -24,7 +21,7 @@ def checkForError(reference): ...@@ -24,7 +21,7 @@ def checkForError(reference):
return 1 return 1
for compute_node in portal.portal_catalog( for compute_node in portal.portal_catalog(
default_allocation_scope_uid = [personal_category_uid, public_category_uid, friend_category_uid], default_allocation_scope_uid = [personal_category_uid, public_category_uid],
select_list={"reference": None}, select_list={"reference": None},
**kw): **kw):
......
...@@ -486,14 +486,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort) ...@@ -486,14 +486,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
slapos_crm_check_compute_node_state slapos_crm_check_compute_node_state
self._test_alarm(alarm, self.compute_node, "ComputeNode_checkState") self._test_alarm(alarm, self.compute_node, "ComputeNode_checkState")
def test_alarm_check_friend_compute_node_state(self):
self._makeComputeNode()
self.compute_node.edit(allocation_scope='open/friend')
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_compute_node_state
self._test_alarm(alarm, self.compute_node, "ComputeNode_checkState")
def test_alarm_check_personal_compute_node_state(self): def test_alarm_check_personal_compute_node_state(self):
self._makeComputeNode() self._makeComputeNode()
self.compute_node.edit(allocation_scope='open/personal') self.compute_node.edit(allocation_scope='open/personal')
...@@ -533,11 +525,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort) ...@@ -533,11 +525,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
allocation_scope='open/public', allocation_scope='open/public',
monitor_scope="disabled") monitor_scope="disabled")
def test_alarm_check_compute_node_state_on_friend_compute_node_with_monitor_scope_disabled(self):
self._test_alarm_check_compute_node_state_not_selected(
allocation_scope='open/friend',
monitor_scope="disabled")
def test_alarm_check_compute_node_state_on_personal_compute_node_with_monitor_scope_disabled(self): def test_alarm_check_compute_node_state_on_personal_compute_node_with_monitor_scope_disabled(self):
self._test_alarm_check_compute_node_state_not_selected( self._test_alarm_check_compute_node_state_not_selected(
allocation_scope='open/personal', allocation_scope='open/personal',
...@@ -569,15 +556,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase ...@@ -569,15 +556,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
slapos_crm_check_software_installation_state slapos_crm_check_software_installation_state
self._test_alarm(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState") self._test_alarm(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def test_alarm_run_on_open_friend(self):
self._makeComputeNode()
self.compute_node.edit(allocation_scope = 'open/friend')
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_software_installation_state
self._test_alarm(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def test_alarm_run_on_open_personal(self): def test_alarm_run_on_open_personal(self):
self._makeComputeNode() self._makeComputeNode()
self.compute_node.edit(allocation_scope = 'open/personal', self.compute_node.edit(allocation_scope = 'open/personal',
...@@ -597,16 +575,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase ...@@ -597,16 +575,6 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
slapos_crm_check_software_installation_state slapos_crm_check_software_installation_state
self._test_alarm_not_visited(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState") self._test_alarm_not_visited(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def test_alarm_dont_run_on_open_friend_with_monitor_scope_disabled(self):
self._makeComputeNode()
self.compute_node.edit(allocation_scope = 'open/friend')
self.tic()
self.compute_node.edit(monitor_scope = 'disabled')
self.tic()
alarm = self.portal.portal_alarms.\
slapos_crm_check_software_installation_state
self._test_alarm_not_visited(alarm, self.compute_node, "ComputeNode_checkSoftwareInstallationState")
def test_alarm_dont_run_on_open_personal_with_monitor_scope_disabled(self): def test_alarm_dont_run_on_open_personal_with_monitor_scope_disabled(self):
self._makeComputeNode() self._makeComputeNode()
self.compute_node.edit(allocation_scope = 'open/personal', self.compute_node.edit(allocation_scope = 'open/personal',
......
...@@ -24,9 +24,5 @@ elif scope == 'open/personal': ...@@ -24,9 +24,5 @@ elif scope == 'open/personal':
person = compute_node.getSourceAdministrationValue(portal_type="Person") person = compute_node.getSourceAdministrationValue(portal_type="Person")
if person is not None: if person is not None:
return {"Auditor": ["SHADOW-%s" % person.getUserId()]} return {"Auditor": ["SHADOW-%s" % person.getUserId()]}
elif scope == 'open/friend':
person_list = compute_node.getDestinationSectionValueList(portal_type="Person")
if person_list:
return {"Auditor": ["SHADOW-%s" % x.getUserId() for x in person_list]}
return category_list return category_list
...@@ -57,14 +57,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -57,14 +57,6 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.assertNotEqual(None, personal_server) self.assertNotEqual(None, personal_server)
self.setServerOpenPersonal(personal_server) self.setServerOpenPersonal(personal_server)
friend_server_title = 'Friend Server for %s' % owner_reference
friend_server_id = self.requestComputeNode(friend_server_title)
friend_server = self.portal.portal_catalog.getResultValue(
portal_type='Compute Node', reference=friend_server_id)
self.setAccessToMemcached(friend_server)
self.assertNotEqual(None, friend_server)
self.setServerOpenFriend(friend_server)
# and install some software on them # and install some software on them
public_server_software = self.generateNewSoftwareReleaseUrl() public_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(public_server, public_server_software) self.supplySoftware(public_server, public_server_software)
...@@ -72,14 +64,9 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -72,14 +64,9 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
personal_server_software = self.generateNewSoftwareReleaseUrl() personal_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(personal_server, personal_server_software) self.supplySoftware(personal_server, personal_server_software)
friend_server_software = self.generateNewSoftwareReleaseUrl()
self.supplySoftware(friend_server, friend_server_software)
# format the compute_nodes # format the compute_nodes
self.formatComputeNode(public_server) self.formatComputeNode(public_server)
self.formatComputeNode(personal_server) self.formatComputeNode(personal_server)
self.formatComputeNode(friend_server)
# join as the another visitor and request software instance on public # join as the another visitor and request software instance on public
# compute_node # compute_node
...@@ -99,68 +86,55 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -99,68 +86,55 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
public_server_software, public_instance_type, public_server_software, public_instance_type,
public_server) public_server)
# join as owner friend and request a software instance on compute_node # join as other person and request a software instance on compute_node
# configured by owner # configured by owner
self.logout() self.logout()
friend_reference = 'friend-%s' % self.generateNewId() other_reference = 'other-%s' % self.generateNewId()
self.joinSlapOS(self.web_site, friend_reference) self.joinSlapOS(self.web_site, other_reference)
self.login() self.login()
friend_person = self.portal.portal_catalog.getResultValue( other_person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=friend_reference).getParentValue() portal_type='ERP5 Login', reference=other_reference).getParentValue()
friend_email = friend_person.getDefaultEmailText()
# allow friend to alloce on friendly compute_node # allow other to alloce on public compute_node
self.login(owner_person.getUserId()) self.login(owner_person.getUserId())
self.setServerOpenFriend(friend_server, [friend_email])
friend_instance_title = 'Friend title %s' % self.generateNewId() other_instance_title = 'Other title %s' % self.generateNewId()
friend_instance_type = 'friend_type' other_instance_type = 'other_type'
self.checkInstanceAllocation(friend_person.getUserId(), friend_reference, self.checkInstanceAllocation(other_person.getUserId(), other_reference,
friend_instance_title, friend_server_software, friend_instance_type, other_instance_title, public_server_software, other_instance_type,
friend_server) public_server)
# check that friend is able to request slave instance matching the # check that other person is able to request slave instance matching the
# public's compute_node software instance # public's compute_node software instance
friend_slave_instance_title = 'Friend slave title %s' % self.\ other_slave_instance_title = 'Other slave title %s' % self.\
generateNewId() generateNewId()
self.checkSlaveInstanceAllocation(friend_person.getUserId(), self.checkSlaveInstanceAllocation(other_person.getUserId(),
friend_reference, friend_slave_instance_title, public_server_software, other_reference, other_slave_instance_title, public_server_software,
public_instance_type, public_server) public_instance_type, public_server)
# turn public guy to a friend and check that he can allocate slave # turn public guy to a other person and check that he can allocate slave
# instance on instance provided by friend # instance on instance provided by other person
self.login() self.login()
public_person = self.portal.portal_catalog.getResultValue( public_person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=public_reference).getParentValue() portal_type='ERP5 Login', reference=public_reference).getParentValue()
public_email = public_person.getDefaultEmailText()
self.login(owner_person.getUserId())
self.setServerOpenFriend(friend_server, [friend_email, public_email])
public_slave_instance_title = 'Public slave title %s' % self\
.generateNewId()
self.checkSlaveInstanceAllocation(public_person.getUserId(),
public_reference, public_slave_instance_title, friend_server_software,
friend_instance_type, friend_server)
# now deallocate the slaves # now deallocate the slaves
self.checkSlaveInstanceUnallocation(public_person.getUserId(), self.login(owner_person.getUserId())
public_reference, public_slave_instance_title, friend_server_software, self.checkSlaveInstanceUnallocation(other_person.getUserId(),
friend_instance_type, friend_server) other_reference, other_slave_instance_title, public_server_software,
other_instance_type, public_server)
self.checkSlaveInstanceUnallocation(friend_person.getUserId(),
friend_reference, friend_slave_instance_title, public_server_software,
public_instance_type, public_server)
# and the instances # and the instances
self.checkInstanceUnallocation(public_person.getUserId(), self.checkInstanceUnallocation(public_person.getUserId(),
public_reference, public_instance_title, public_reference, public_instance_title,
public_server_software, public_instance_type, public_server) public_server_software, public_instance_type, public_server)
self.checkInstanceUnallocation(friend_person.getUserId(), self.checkInstanceUnallocation(other_person.getUserId(),
friend_reference, friend_instance_title, other_reference, other_instance_title,
friend_server_software, friend_instance_type, friend_server) public_server_software, other_instance_type, public_server
)
# and uninstall some software on them # and uninstall some software on them
self.logout() self.logout()
...@@ -169,15 +143,12 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -169,15 +143,12 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
state='destroyed') state='destroyed')
self.supplySoftware(personal_server, personal_server_software, self.supplySoftware(personal_server, personal_server_software,
state='destroyed') state='destroyed')
self.supplySoftware(friend_server, friend_server_software,
state='destroyed')
self.logout() self.logout()
# Uninstall from compute_node # Uninstall from compute_node
self.login() self.login()
self.simulateSlapgridSR(public_server) self.simulateSlapgridSR(public_server)
self.simulateSlapgridSR(personal_server) self.simulateSlapgridSR(personal_server)
self.simulateSlapgridSR(friend_server)
# check the Open Sale Order coverage # check the Open Sale Order coverage
self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm() self.stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm()
...@@ -186,7 +157,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -186,7 +157,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.login() self.login()
self.assertOpenSaleOrderCoverage(owner_reference) self.assertOpenSaleOrderCoverage(owner_reference)
self.assertOpenSaleOrderCoverage(friend_reference) self.assertOpenSaleOrderCoverage(other_reference)
self.assertOpenSaleOrderCoverage(public_reference) self.assertOpenSaleOrderCoverage(public_reference)
# generate simulation for open order # generate simulation for open order
...@@ -257,7 +228,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -257,7 +228,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.tic() self.tic()
# check final document state # check final document state
for person_reference in (owner_reference, friend_reference, for person_reference in (owner_reference, other_reference,
public_reference): public_reference):
person = self.portal.portal_catalog.getResultValue( person = self.portal.portal_catalog.getResultValue(
portal_type='ERP5 Login', reference=person_reference).getParentValue() portal_type='ERP5 Login', reference=person_reference).getParentValue()
...@@ -266,8 +237,8 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin): ...@@ -266,8 +237,8 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
self.login(public_person.getUserId()) self.login(public_person.getUserId())
self.usePaymentManually(self.web_site, public_person.getUserId()) self.usePaymentManually(self.web_site, public_person.getUserId())
self.login(friend_person.getUserId()) self.login(other_person.getUserId())
self.usePaymentManually(self.web_site, friend_person.getUserId()) self.usePaymentManually(self.web_site, other_person.getUserId())
class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin): class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
...@@ -570,4 +541,4 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin): ...@@ -570,4 +541,4 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
self.tic() self.tic()
# check final document state # check final document state
self.assertPersonDocumentCoverage(person) self.assertPersonDocumentCoverage(person)
\ No newline at end of file
...@@ -206,23 +206,6 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin): ...@@ -206,23 +206,6 @@ class TestComputeNode(TestSlapOSGroupRoleSecurityMixin):
self.assertRoles(compute_node, self.user_id, ['Owner']) self.assertRoles(compute_node, self.user_id, ['Owner'])
self.assertRoles(compute_node, compute_node.getUserId(), ['Assignor']) self.assertRoles(compute_node, compute_node.getUserId(), ['Assignor'])
# open/friend
friend_reference = 'TESTPERSON-%s' % self.generateNewId()
friend_person = self.portal.person_module.newContent(portal_type='Person',
reference=friend_reference)
compute_node.edit(allocation_scope='open/friend',
destination_section=friend_person.getRelativeUrl()
)
compute_node.updateLocalRolesOnSecurityGroups()
shadow_friend_user_id = 'SHADOW-%s' % friend_person.getUserId()
self.assertSecurityGroup(compute_node,
[self.user_id, 'G-COMPANY', shadow_friend_user_id,
person.getUserId(), compute_node.getUserId()], False)
self.assertRoles(compute_node, shadow_friend_user_id, ['Auditor'])
self.assertRoles(compute_node, self.user_id, ['Owner'])
self.assertRoles(compute_node, compute_node.getUserId(), ['Assignor'])
def test_selfComputeNode(self): def test_selfComputeNode(self):
reference = 'TESTCOMP-%s' % self.generateNewId() reference = 'TESTCOMP-%s' % self.generateNewId()
compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node', compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node',
......
...@@ -60,101 +60,15 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope( ...@@ -60,101 +60,15 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
allocation_scope="open/subscription" allocation_scope="open/subscription"
) )
def test_ComputeNode_setAllocationScope_public_with_source_adm(self): def test_ComputeNode_setAllocationScope_personal(self,
person = self.makePerson() source_administration=None):
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_public(
source_administration=person.getRelativeUrl())
self.assertEqual(compute_node.getSubjectList(), [''])
self.assertEqual(compute_node.getDestinationSection(), None)
def test_ComputeNode_setAllocationScope_subscription_with_source_adm(self):
person = self.makePerson()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_public(
source_administration=person.getRelativeUrl(),
allocation_scope="open/subscription")
self.assertEqual(compute_node.getSubjectList(), [''])
self.assertEqual(compute_node.getDestinationSection(), None)
def _test_ComputeNode_setAllocationScope_personal(self,
source_administration=None,
subject_list=None):
compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node', compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node',
capacity_scope=None, capacity_scope=None,
monitor_scope=None, monitor_scope=None,
source_administration=source_administration) source_administration=source_administration)
if subject_list:
compute_node.setSubjectList(subject_list)
self.commit()
compute_node.edit(allocation_scope='open/personal')
self.commit() self.commit()
self.assertEqual(compute_node.getCapacityScope(), 'close')
self.assertEqual(compute_node.getMonitorScope(), 'enabled')
self.commit()
compute_node.edit(allocation_scope=None)
self.commit()
compute_node.edit(capacity_scope="open")
self.commit()
compute_node.edit(allocation_scope='open/personal') compute_node.edit(allocation_scope='open/personal')
self.commit()
self.assertEqual(compute_node.getCapacityScope(), 'close')
self.assertEqual(compute_node.getMonitorScope(), 'enabled')
return compute_node
def test_ComputeNode_setAllocationScope_personal(self):
compute_node = self._test_ComputeNode_setAllocationScope_personal()
self.assertEqual(compute_node.getSubjectList(), [])
self.assertEqual(compute_node.getDestinationSection(), None)
def test_ComputeNode_setAllocationScope_personal_with_source_adm(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_personal(
source_administration=person.getRelativeUrl(),
)
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def test_ComputeNode_setAllocationScope_personal_with_subject_list(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_personal(
source_administration=person.getRelativeUrl(),
subject_list=["some@example.com"]
)
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def _test_ComputeNode_setAllocationScope_friend(self,
source_administration=None,
subject_list=None):
compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node')
compute_node.edit(capacity_scope=None,
monitor_scope=None,
source_administration=source_administration)
if subject_list:
compute_node.setSubjectList(subject_list)
self.commit()
compute_node.edit(allocation_scope='open/friend')
self.commit() self.commit()
self.assertEqual(compute_node.getCapacityScope(), 'close') self.assertEqual(compute_node.getCapacityScope(), 'close')
...@@ -166,53 +80,22 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope( ...@@ -166,53 +80,22 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
compute_node.edit(capacity_scope="open") compute_node.edit(capacity_scope="open")
self.commit() self.commit()
compute_node.edit(allocation_scope='open/friend') compute_node.edit(allocation_scope='open/personal')
self.commit() self.commit()
self.assertEqual(compute_node.getCapacityScope(), 'close') self.assertEqual(compute_node.getCapacityScope(), 'close')
self.assertEqual(compute_node.getMonitorScope(), 'enabled') self.assertEqual(compute_node.getMonitorScope(), 'enabled')
return compute_node return compute_node
def test_ComputeNode_setAllocationScope_friend_with_source_adm(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_friend(
source_administration=person.getRelativeUrl())
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def test_ComputeNode_setAllocationScope_friend_with_subject_list(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_friend(
source_administration=person.getRelativeUrl(),
subject_list=["some@example.com"]
)
self.assertSameSet(compute_node.getSubjectList(),
['some@example.com', person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def _test_ComputeNode_setAllocationScope_closed(self, def _test_ComputeNode_setAllocationScope_closed(self,
source_administration=None, source_administration=None,
allocation_scope="close/forever", allocation_scope="close/forever",
subject_list=None,
monitor_scope='enabled'): monitor_scope='enabled'):
compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node', compute_node = self.portal.compute_node_module.newContent(portal_type='Compute Node',
capacity_scope=None, capacity_scope=None,
monitor_scope=None, monitor_scope=None,
source_administration=source_administration) source_administration=source_administration)
if subject_list:
compute_node.setSubjectList(subject_list)
self.commit() self.commit()
compute_node.edit(allocation_scope=allocation_scope) compute_node.edit(allocation_scope=allocation_scope)
...@@ -235,89 +118,25 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope( ...@@ -235,89 +118,25 @@ class TestSlapOSERP5InteractionWorkflowComputeNodeSetAllocationScope(
return compute_node return compute_node
def test_ComputeNode_setAllocationScope_closed_forever_no_source_adm(self): def test_ComputeNode_setAllocationScope_closed_forever(self):
self._test_ComputeNode_setAllocationScope_closed(monitor_scope='disabled') self._test_ComputeNode_setAllocationScope_closed(monitor_scope='disabled')
def test_ComputeNode_setAllocationScope_closed_forever_with_source_adm(self): def test_ComputeNode_setAllocationScope_closed_termination(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_closed(
source_administration=person.getRelativeUrl(), monitor_scope='disabled')
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def test_ComputeNode_setAllocationScope_closed_termination_no_source_adm(self):
self._test_ComputeNode_setAllocationScope_closed( self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/termination", allocation_scope="close/termination",
) )
def test_ComputeNode_setAllocationScope_closed_termination_with_source_adm(self): def test_ComputeNode_setAllocationScope_closed_outdated(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/termination",
source_administration=person.getRelativeUrl())
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def test_ComputeNode_setAllocationScope_closed_outdated_no_source_adm(self):
self._test_ComputeNode_setAllocationScope_closed( self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/outdated", allocation_scope="close/outdated",
) )
def test_ComputeNode_setAllocationScope_closed_outdated_with_source_adm(self): def test_ComputeNode_setAllocationScope_closed_maintenance(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/outdated",
source_administration=person.getRelativeUrl())
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def test_ComputeNode_setAllocationScope_closed_maintenance_no_source_adm(self):
self._test_ComputeNode_setAllocationScope_closed( self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/maintenance", allocation_scope="close/maintenance",
) )
def test_ComputeNode_setAllocationScope_closed_maintenance_with_source_adm(self): def test_ComputeNode_setAllocationScope_closed_noallocation(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/maintenance",
source_administration=person.getRelativeUrl())
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
def test_ComputeNode_setAllocationScope_closed_noallocation_no_source_adm(self):
self._test_ComputeNode_setAllocationScope_closed( self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/noallocation", allocation_scope="close/noallocation",
) )
\ No newline at end of file
def test_ComputeNode_setAllocationScope_closed_noallocation_with_source_adm(self):
person = self.makePerson()
self.tic()
self.assertNotIn(person.getDefaultEmailCoordinateText(), [None, ""])
compute_node = self._test_ComputeNode_setAllocationScope_closed(
allocation_scope="close/noallocation",
source_administration=person.getRelativeUrl())
self.assertEqual(compute_node.getSubjectList(), [person.getDefaultEmailCoordinateText()])
self.assertEqual(compute_node.getDestinationSectionList(),
[person.getRelativeUrl()])
\ No newline at end of file
compute_node = state_object["object"] compute_node = state_object["object"]
allocation_scope = compute_node.getAllocationScope()
edit_kw = {} edit_kw = {}
...@@ -12,28 +11,8 @@ if compute_node.getCapacityScope() != "close": ...@@ -12,28 +11,8 @@ if compute_node.getCapacityScope() != "close":
if compute_node.getMonitorScope() is None: if compute_node.getMonitorScope() is None:
edit_kw['monitor_scope'] = 'enabled' edit_kw['monitor_scope'] = 'enabled'
if allocation_scope == "close/forever": if compute_node.getAllocationScope() == "close/forever":
edit_kw['monitor_scope'] = 'disabled' edit_kw['monitor_scope'] = 'disabled'
self_person = compute_node.getSourceAdministrationValue(portal_type="Person") if edit_kw:
if self_person is None:
compute_node.edit(**edit_kw) compute_node.edit(**edit_kw)
return
self_email = self_person.getDefaultEmailCoordinateText()
if allocation_scope in ['open/public', 'open/subscription']:
# reset friends and update in place
edit_kw['subject_list'] = ['']
edit_kw['destination_section'] = None
elif allocation_scope == 'open/personal':
# reset friends to self and update in place
edit_kw['subject_list'] = [self_email]
edit_kw['destination_section'] = self_person.getRelativeUrl()
else:
subject_list = compute_node.getSubjectList()
if self_email not in subject_list:
# add self as friend
subject_list.append(self_email)
edit_kw['subject_list'] = subject_list
compute_node.edit(**edit_kw)
...@@ -68,9 +68,7 @@ ...@@ -68,9 +68,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <value> <string>None</string> </value>
<none/>
</value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -105,14 +105,14 @@ ...@@ -105,14 +105,14 @@
"Closed for termination", "Closed for termination",
"Closed forever", "Closed forever",
"Closed outdated", "Closed outdated",
"Open for Friends only", "Open for Friends only", // Not used anymore
"Open for Personal use 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", "Your Friends email", // Not used anymore
"Upgrade", "Upgrade",
"The name of a document in ERP5", "The name of a document in ERP5",
"Current Site", "Current Site",
...@@ -167,17 +167,23 @@ ...@@ -167,17 +167,23 @@
[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][17], 'open/friend'], [results[2][18], 'open/personal']],
[results[2][18], 'open/personal'],
[results[2][19], 'open/public'],
[results[2][20], '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;
...@@ -188,6 +194,17 @@ ...@@ -188,6 +194,17 @@
]); ]);
} }
if (!supported_allocation_scope_list.includes(
gadget.state.doc.allocation_scope
) && hidden_allocation_scope.keys().includes(
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": {
...@@ -249,17 +266,6 @@ ...@@ -249,17 +266,6 @@
"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],
...@@ -364,8 +370,7 @@ ...@@ -364,8 +370,7 @@
], [ ], [
"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"]]
......
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1006.16758.53785.31334</string> </value> <value> <string>1006.26651.31767.25907</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1675971435.26</float> <float>1676577476.87</float>
<string>UTC</string> <string>UTC</string>
</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_friend = portal.restrictedTraverse("portal_categories/allocation_scope/open/friend", None)
category_personal = portal.restrictedTraverse("portal_categories/allocation_scope/open/personal", 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_friend.getUid(),
category_personal.getUid()], category_personal.getUid()],
validation_state="validated", validation_state="validated",
) )
...@@ -100,7 +100,6 @@ ...@@ -100,7 +100,6 @@
<string>my_title</string> <string>my_title</string>
<string>my_reference</string> <string>my_reference</string>
<string>my_url_string</string> <string>my_url_string</string>
<string>my_subject_list</string>
<string>my_allocation_scope</string> <string>my_allocation_scope</string>
<string>my_subordination</string> <string>my_subordination</string>
<string>my_news</string> <string>my_news</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_subject_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Friends (email)</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -543,35 +543,11 @@ ...@@ -543,35 +543,11 @@
<tr> <tr>
<td>select</td> <td>select</td>
<td>//select[@id="allocation_scope"]</td> <td>//select[@id="allocation_scope"]</td>
<td tal:content="python: '%s' % (here.Base_translateString('Open for Friends only', lang=lang))"></td> <td tal:content="python: '%s' % (here.Base_translateString('Open', lang=lang))"></td>
</tr> </tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/save" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/save" />
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@id="subject_list"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@id="subject_list"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@id="subject_list"]</td>
<td>demo@user.com</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/save" />
<tr>
<td>assertValue</td>
<td>//textarea[@id="subject_list"]</td>
<td>demo@user.com</td>
</tr>
<tal:block define="menu_item python: 'Servers'; header menu_item"> <tal:block define="menu_item python: 'Servers'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" /> <tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block> </tal:block>
......
...@@ -94,29 +94,30 @@ class TestSlapOSUpgradeDecisionProcess(SlapOSTestCaseMixin): ...@@ -94,29 +94,30 @@ class TestSlapOSUpgradeDecisionProcess(SlapOSTestCaseMixin):
def test_alarm_compute_node_create_upgrade_decision_auto(self): def test_alarm_compute_node_create_upgrade_decision_auto(self):
self._test_alarm_compute_node_create_upgrade_decision('open/public', 'auto') self._test_alarm_compute_node_create_upgrade_decision('open/public', 'auto')
self._test_alarm_compute_node_create_upgrade_decision('open/personal', 'auto') self._test_alarm_compute_node_create_upgrade_decision('open/personal', 'auto')
self._test_alarm_compute_node_create_upgrade_decision('open/friend', 'auto')
self._test_alarm_compute_node_create_upgrade_decision('open/subscription', 'auto') self._test_alarm_compute_node_create_upgrade_decision('open/subscription', 'auto')
self._test_alarm_compute_node_create_upgrade_decision('close/outdated', 'auto') self._test_alarm_compute_node_create_upgrade_decision('close/outdated', 'auto')
self._test_alarm_compute_node_create_upgrade_decision('close/maintanance', 'auto') self._test_alarm_compute_node_create_upgrade_decision('close/maintanance', 'auto')
self._test_alarm_compute_node_create_upgrade_decision('close/termination', 'auto') self._test_alarm_compute_node_create_upgrade_decision('close/termination', 'auto')
self._test_alarm_compute_node_create_upgrade_decision('close/noallocation', 'auto')
def test_alarm_compute_node_create_upgrade_decision_ask_confirmation(self): def test_alarm_compute_node_create_upgrade_decision_ask_confirmation(self):
self._test_alarm_compute_node_create_upgrade_decision('open/public', 'confirmation') self._test_alarm_compute_node_create_upgrade_decision('open/public', 'confirmation')
self._test_alarm_compute_node_create_upgrade_decision('open/personal', 'confirmation') self._test_alarm_compute_node_create_upgrade_decision('open/personal', 'confirmation')
self._test_alarm_compute_node_create_upgrade_decision('open/friend', 'confirmation')
self._test_alarm_compute_node_create_upgrade_decision('open/subscription', 'confirmation') self._test_alarm_compute_node_create_upgrade_decision('open/subscription', 'confirmation')
self._test_alarm_compute_node_create_upgrade_decision('close/outdated', 'confirmation') self._test_alarm_compute_node_create_upgrade_decision('close/outdated', 'confirmation')
self._test_alarm_compute_node_create_upgrade_decision('close/maintanance', 'confirmation') self._test_alarm_compute_node_create_upgrade_decision('close/maintanance', 'confirmation')
self._test_alarm_compute_node_create_upgrade_decision('close/termination', 'confirmation') self._test_alarm_compute_node_create_upgrade_decision('close/termination', 'confirmation')
self._test_alarm_compute_node_create_upgrade_decision('close/noallocation', 'confirmation')
def test_alarm_compute_node_create_upgrade_decision_never(self): def test_alarm_compute_node_create_upgrade_decision_never(self):
self._test_alarm_compute_node_create_upgrade_decision_not_visited('open/public', 'never') self._test_alarm_compute_node_create_upgrade_decision_not_visited('open/public', 'never')
self._test_alarm_compute_node_create_upgrade_decision_not_visited('open/personal', 'never') self._test_alarm_compute_node_create_upgrade_decision_not_visited('open/personal', 'never')
self._test_alarm_compute_node_create_upgrade_decision_not_visited('open/friend', 'never')
self._test_alarm_compute_node_create_upgrade_decision_not_visited('open/subscription', 'never') self._test_alarm_compute_node_create_upgrade_decision_not_visited('open/subscription', 'never')
self._test_alarm_compute_node_create_upgrade_decision_not_visited('close/outdated', 'never') self._test_alarm_compute_node_create_upgrade_decision_not_visited('close/outdated', 'never')
self._test_alarm_compute_node_create_upgrade_decision_not_visited('close/maintanance', 'never') self._test_alarm_compute_node_create_upgrade_decision_not_visited('close/maintanance', 'never')
self._test_alarm_compute_node_create_upgrade_decision_not_visited('close/termination', 'never') self._test_alarm_compute_node_create_upgrade_decision_not_visited('close/termination', 'never')
self._test_alarm_compute_node_create_upgrade_decision_not_visited('close/noallocation', 'never')
def test_alarm_instance_tree_create_upgrade_decision(self): def test_alarm_instance_tree_create_upgrade_decision(self):
instance_tree = self._makeInstanceTree() instance_tree = self._makeInstanceTree()
......
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