Commit 5ee128d4 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Promises were replace by Constraints from slapos_erp5

parent 3606fa94
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_checkPromiseSlapOSModuleIdGenerator</string> </value>
</item>
<item>
<key> <string>alarm_notification_mode</string> </key>
<value>
<tuple>
<string>never</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>promise_slapos_module_id_generator</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>0.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value> <string>Alarm_fixWithActiveSense</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Module Id Generator SlapOS Promise</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_checkPromiseSlapOSPAS</string> </value>
</item>
<item>
<key> <string>alarm_notification_mode</string> </key>
<value>
<tuple>
<string>never</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>promise_slapos_pas</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>0.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value> <string>Alarm_fixWithActiveSense</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Pluggable Auth Service SlapOS Promise</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>60.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_cloud_promise</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject()
wrong_module_list = []
active_process = context.newActiveProcess()
for module_id in portal.objectIds(spec=('ERP5 Folder',)) + ["portal_simulation", "portal_activities"]:
module = portal.restrictedTraverse(module_id)
if not module.Module_assertIdGenerator('_generatePerDayId', fixit, active_process):
wrong_module_list.append(module.getRelativeUrl())
if len(wrong_module_list) != 0:
summary = "Some modules have incorrect ID generator"
if fixit:
summary += ", fixed."
severity = 0
else:
severity = 1
detail = "List: %s" % (', '.join(wrong_module_list), )
else:
severity = 0
summary = "Nothing to do."
detail = ""
active_result = ActiveResult()
active_result.edit(
summary=summary,
severity=severity,
detail=detail)
active_process.postResult(active_result)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_checkPromiseSlapOSModuleIdGenerator</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
promise_dict = {
'IExtractionPlugin': [
'SlapOS Machine Authentication Plugin',
'ERP5 Access Token Extraction Plugin',
],
'IGroupsPlugin': [
'SlapOS Shadow Authentication Plugin',
],
'IUserEnumerationPlugin': [
'SlapOS Shadow Authentication Plugin',
]
}
context.Alarm_checkPromiseSlapOSPASBase(promise_dict, tag, fixit=fixit, **kw)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_checkPromiseSlapOSPAS</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.CMFActivity.ActiveResult import ActiveResult
portal = context.getPortalObject()
def mergePASDictDifference(portal, d, fixit):
plugins = portal.acl_users.plugins
error_list = []
plugin_type_info = plugins.listPluginTypeInfo()
for plugin, active_list in d.iteritems():
plugin_info = [q for q in plugin_type_info if q['id'] == plugin][0]
found_list = plugins.listPlugins(plugin_info['interface'])
meta_type_list = [q[1].meta_type for q in found_list]
for expected in active_list:
if expected not in meta_type_list:
error = 'Plugin %s missing %s.' % (plugin, expected)
if fixit:
existing = [q for q in portal.acl_users.objectValues() if q.meta_type == expected]
if len(existing) == 0:
error_list.append('%s not found' % expected)
else:
plugins.activatePlugin(plugin_info['interface'], existing[0].getId())
error += ' Fixed.'
error_list.append(error)
return error_list
pas_difference = mergePASDictDifference(portal, promise_dict, fixit)
if len(pas_difference) != 0:
if fixit:
severity = 0
else:
severity = 1
summary = "PAS not configured as expected"
if fixit:
summary += ' (fixed)'
detail = "Difference:\n%s" % ('\n'.join(pas_difference), )
else:
severity = 0
summary = "Nothing to do."
detail = ""
active_result = ActiveResult()
active_result.edit(
summary=summary,
severity=severity,
detail=detail)
context.newActiveProcess().postResult(active_result)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>promise_dict, tag, fixit=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_checkPromiseSlapOSPASBase</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_fixWithActiveSense</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
current_id_generator = context.getIdGenerator()
if current_id_generator != id_generator:
if fixit:
context.setIdGenerator(id_generator)
return False
return True
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>id_generator, fixit, active_process=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Module_assertIdGenerator</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -8,8 +8,6 @@ computer_module/template_computer/** ...@@ -8,8 +8,6 @@ computer_module/template_computer/**
hosting_subscription_module/template_hosting_subscription hosting_subscription_module/template_hosting_subscription
person_module/template_member person_module/template_member
person_module/template_member/** person_module/template_member/**
portal_alarms/promise_slapos_module_id_generator
portal_alarms/promise_slapos_pas
portal_alarms/slapos_allocate_instance portal_alarms/slapos_allocate_instance
portal_alarms/slapos_assert_hosting_subscription_predecessor portal_alarms/slapos_assert_hosting_subscription_predecessor
portal_alarms/slapos_cloud_invalidate_destroyed_instance portal_alarms/slapos_cloud_invalidate_destroyed_instance
......
slapos_cloud slapos_cloud
slapos_cloud_promise \ No newline at end of file
\ No newline at end of file
...@@ -126,7 +126,6 @@ slapos_accounting ...@@ -126,7 +126,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -240,7 +239,6 @@ slapos_accounting ...@@ -240,7 +239,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -349,7 +347,6 @@ slapos_accounting ...@@ -349,7 +347,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -459,7 +456,6 @@ slapos_accounting ...@@ -459,7 +456,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -566,7 +562,6 @@ slapos_accounting ...@@ -566,7 +562,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -674,7 +669,6 @@ slapos_accounting ...@@ -674,7 +669,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -781,7 +775,6 @@ slapos_accounting ...@@ -781,7 +775,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -889,7 +882,6 @@ slapos_accounting ...@@ -889,7 +882,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -996,7 +988,6 @@ slapos_accounting ...@@ -996,7 +988,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -1105,7 +1096,6 @@ slapos_accounting ...@@ -1105,7 +1096,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
...@@ -1215,7 +1205,6 @@ slapos_accounting ...@@ -1215,7 +1205,6 @@ slapos_accounting
slapos_administration slapos_administration
slapos_cache slapos_cache
slapos_cloud slapos_cloud
slapos_cloud_promise
slapos_consumption slapos_consumption
slapos_core slapos_core
slapos_crm slapos_crm
......
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