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
Jérome Perrin
slapos.core
Commits
ff7450b6
Commit
ff7450b6
authored
Jan 08, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Include alarm for check and fix duplicated software instances
parent
80da84b2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
327 additions
and
0 deletions
+327
-0
master/bt5/slapos_erp5/PathTemplateItem/portal_alarms/slapos_check_duplicated_software_instance.xml
...rtal_alarms/slapos_check_duplicated_software_instance.xml
+55
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.xml
...administration/Alarm_searchDuplicatedSoftwareInstance.xml
+74
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/HostingSubscription_checkDuplicatedInstance.xml
...istration/HostingSubscription_checkDuplicatedInstance.xml
+110
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/SoftwareInstance_destroyAsSelf.xml
.../slapos_administration/SoftwareInstance_destroyAsSelf.xml
+87
-0
master/bt5/slapos_erp5/bt/template_path_list
master/bt5/slapos_erp5/bt/template_path_list
+1
-0
No files found.
master/bt5/slapos_erp5/PathTemplateItem/portal_alarms/slapos_check_duplicated_software_instance.xml
0 → 100644
View file @
ff7450b6
<?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_searchDuplicatedSoftwareInstance
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Search for Duplicated Software Instance on a Single Hosting Subscription
</string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_check_duplicated_software_instance
</string>
</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>
433814400.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Search Duplicated Software Instances
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Alarm_searchDuplicatedSoftwareInstance.xml
0 → 100644
View file @
ff7450b6
<?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>
_body
</string>
</key>
<value>
<string>
active_process = context.newActiveProcess().getRelativeUrl()\n
\n
context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id=\'HostingSubscription_checkDuplicatedInstance\',\n
method_kw=dict(fixit=fixit, active_process=active_process),\n
activate_kw=dict(tag=tag, priority=5),\n
portal_type="Hosting Subscription", \n
validation_state="validated")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_searchDuplicatedSoftwareInstance
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/HostingSubscription_checkDuplicatedInstance.xml
0 → 100644
View file @
ff7450b6
<?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>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.CMFActivity.ActiveResult import ActiveResult\n
portal = context.getPortalObject()\n
\n
software_instance_list = context.getSpecialiseRelatedValueList(\n
portal_type=["Slave Instance", "Software Instance"])\n
\n
if len(software_instance_list) == 1:\n
return \n
\n
title_dict = {}\n
\n
active_process = portal.restrictedTraverse(active_process)\n
\n
for software_instance in software_instance_list:\n
if software_instance.getSlapState() == "destroy_requested":\n
continue\n
\n
title = software_instance.getTitle() \n
if title in title_dict:\n
title_dict[title].append(software_instance.getObject())\n
else:\n
title_dict[title] = [software_instance.getObject()]\n
\n
\n
for title in title_dict:\n
if len(title_dict[title]) >
1:\n
if fixit:\n
for software_instance in title_dict[title]:\n
if len(software_instance.getAggregate([])) == 0:\n
active_process.postResult(ActiveResult(\n
summary="Fixing %s which duplication and is not allocated (%s)" \\\n
% (software_instance.getRelativeUrl(), context.getRelativeUrl()),\n
severity=0,\n
detail=""))\n
software_instance.activate().SoftwareInstance_destroyAsSelf() \n
else:\n
active_process.postResult(ActiveResult(\n
summary="%s has duplication" % context.getRelativeUrl(),\n
severity=100,\n
detail="%s has duplication on %s (%s)" % (context.getRelativeUrl(), title, len(title_dict[title]))))\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
fixit, active_process
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
HostingSubscription_checkDuplicatedInstance
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/SoftwareInstance_destroyAsSelf.xml
0 → 100644
View file @
ff7450b6
<?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>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getAggregate() is not None:\n
raise ValueError(\'Do not destroy allocated instances automatically!\')\n
\n
# Change desired state\n
promise_kw = {\n
\'instance_xml\': context.getTextContent(),\n
\'software_type\': context.getSourceReference(),\n
\'sla_xml\': context.getSlaXml(),\n
\'software_release\': context.getUrlString(),\n
\'shared\': context.getPortalType()=="Slave Instance",\n
}\n
\n
request_software_instance_url = context.getRelativeUrl()\n
context.REQUEST.set(\'request_instance\', context)\n
\n
context.requestDestroy(**promise_kw)\n
context.REQUEST.set(\'request_instance\', None)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SoftwareInstance_destroyAsSelf
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/bt/template_path_list
View file @
ff7450b6
portal_alarms/slapos_check_duplicated_software_instance
portal_alarms/slapos_erp5_cleanup_active_process
\ No newline at end of file
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