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
Ophélie Gagnard
slapos.core
Commits
42e72e67
Commit
42e72e67
authored
Sep 04, 2014
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into operation-control
parents
64c208f6
14904721
Changes
35
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
2118 additions
and
190 deletions
+2118
-190
CHANGES.txt
CHANGES.txt
+14
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdateComputerAllocationScope.xml
...onitoring/Alarm_checkAndUpdateComputerAllocationScope.xml
+20
-2
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdateAllocationScope.xml
...crm_monitoring/Computer_checkAndUpdateAllocationScope.xml
+15
-10
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdatePersonalAllocationScope.xml
...toring/Computer_checkAndUpdatePersonalAllocationScope.xml
+69
-0
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSkins.py
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSkins.py
+39
-5
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSupportRequestGeneration.py
...TestTemplateItem/testSlapOSCRMSupportRequestGeneration.py
+50
-5
master/bt5/slapos_crm/bt/revision
master/bt5/slapos_crm/bt/revision
+1
-1
master/bt5/slapos_crm/bt/template_path_list
master/bt5/slapos_crm/bt/template_path_list
+0
-1
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Restricted%20Access%20Token.xml
...rtalTypeRolesTemplateItem/Restricted%20Access%20Token.xml
+5
-0
master/bt5/slapos_erp5/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
...rtalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
+4
-0
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/interactions/RestrictedAccessToken_edit.xml
...tion_workflow/interactions/RestrictedAccessToken_edit.xml
+96
-0
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/interactions/UpgradeDecision_edit.xml
...nteraction_workflow/interactions/UpgradeDecision_edit.xml
+96
-0
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
master/bt5/slapos_erp5/bt/template_portal_type_workflow_chain_list
...5/slapos_erp5/bt/template_portal_type_workflow_chain_list
+1
-0
master/bt5/slapos_pdm/PathTemplateItem/portal_alarms/slapos_pdm_upgrade_decision_process_stopped.xml
...al_alarms/slapos_pdm_upgrade_decision_process_stopped.xml
+14
-14
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.xml
..._skins/slapos_pdm/Alarm_processStoppedUpgradeDecision.xml
+7
-14
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_createUpgradeDecision.xml
...kins/slapos_pdm/SoftwareRelease_createUpgradeDecision.xml
+6
-5
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputerNotificationMessage.xml
...os_pdm/UpgradeDecision_getComputerNotificationMessage.xml
+92
-0
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
...al_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished.xml
+25
-25
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.xml
...rtal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.xml
+126
-0
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMAlarm.py
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMAlarm.py
+17
-0
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
+162
-1
master/bt5/slapos_pdm/bt/revision
master/bt5/slapos_pdm/bt/revision
+1
-1
master/bt5/slapos_pdm/bt/template_path_list
master/bt5/slapos_pdm/bt/template_path_list
+1
-0
master/bt5/slapos_web/SkinTemplateItem/portal_skins/slapos_rss/WebSection_getUserRssTicketList.xml
...rtal_skins/slapos_rss/WebSection_getUserRssTicketList.xml
+2
-2
master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_generateRssRestrictedAccessTokenFromJS.xml
...b_hosting/Base_generateRssRestrictedAccessTokenFromJS.xml
+7
-2
master/bt5/slapos_web/bt/revision
master/bt5/slapos_web/bt/revision
+1
-1
slapos/collect/__init__.py
slapos/collect/__init__.py
+1
-1
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+11
-1
slapos/proxy/schema.sql
slapos/proxy/schema.sql
+18
-6
slapos/proxy/views.py
slapos/proxy/views.py
+171
-91
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+3
-0
slapos/tests/slapproxy/__init__.py
slapos/tests/slapproxy/__init__.py
+930
-0
slapos/tests/slapproxy/database_dump_version_10.sql
slapos/tests/slapproxy/database_dump_version_10.sql
+111
-0
slapos/version.py
slapos/version.py
+1
-1
No files found.
CHANGES.txt
View file @
42e72e67
Changes
=======
1.2.1 (2014-08-21)
------------------
* slapproxy: add automatic migration to new database schema if needed.
1.2.0 (2014-08-18)
------------------
Note: not officially released as egg.
* slapproxy: add correct support for slaves, instance_guid, state.
* slapproxy: add getComputerPartitionStatus dummy support.
* slapproxy: add multi-nodes support
1.1.2 (2014-06-02)
------------------
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkAndUpdateComputerAllocationScope.xml
View file @
42e72e67
...
...
@@ -50,10 +50,13 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject()\n
\n
category_public = portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None)\n
category_friend = portal.restrictedTraverse("portal_categories/allocation_scope/open/friend", None)\n
category_personal = portal.restrictedTraverse("portal_categories/allocation_scope/open/personal", None)\n
\n
if category_public is not None:\n
portal.portal_catalog.searchAndActivate(\n
...
...
@@ -63,8 +66,23 @@ if category_public is not None:\n
method_id=\'Computer_checkAndUpdateAllocationScope\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
if category_personal is not None:\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Computer\', \n
validation_state=\'validated\', \n
modification_date=(DateTime() - 30).strftime(\'<=%Y/%m/%d\'), \n
order_by=((\'modification_date\', "ASC"), ), \n
default_allocation_scope_uid=category_personal.getUid(), \n
left_join_list=[\'aggregate_related_uid\'], \n
aggregate_related_uid=None,\n
method_id=\'Computer_checkAndUpdatePersonalAllocationScope\',\n
activate_kw={\'tag\': tag})\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdateAllocationScope.xml
View file @
42e72e67
...
...
@@ -57,7 +57,11 @@ portal = context.getPortalObject()\n
allocation_scope = computer.getAllocationScope()\n
computer_reference = computer.getReference()\n
\n
if allocation_scope not in [\'open/public\', \'open/friend\']:\n
if allocation_scope not in [\'open/public\', \'open/friend\', \'open/personal\']:\n
return\n
\n
if allocation_scope == target_allocation_scope:\n
# already changed\n
return\n
\n
person = computer.getSourceAdministrationValue(portal_type="Person")\n
...
...
@@ -65,17 +69,15 @@ if not person:\n
return\n
\n
if not person.Person_isServiceProvider():\n
#Turn this computer allocation scope to \'open/personal\'\n
edit_kw = {\n
\'allocation_scope\':
\'open/personal\'
,\n
\'allocation_scope\':
target_allocation_scope
,\n
}\n
computer.edit(**edit_kw)\n
\n
# Create a ticket (or re-open it) for this issue!\n
support_request = None\n
request_title = \'We have changed allocation scope for %s\' % computer_reference\n
request_description = \'Allocation scope has been changed
back
to \' \\\n
\'
open/personal for %s\' % computer_reference
\n
request_description = \'Allocation scope has been changed to \' \\\n
\'
%s for %s\' % (target_allocation_scope, computer_reference)
\n
\n
support_request_url = context.Base_generateSupportRequestForSlapOS(\n
request_title,\n
...
...
@@ -91,7 +93,7 @@ if not person.Person_isServiceProvider():\n
support_request = portal.portal_catalog.getResultValue(\n
portal_type = \'Support Request\',\n
title = request_title,\n
simulation_state =
\'suspended\'
,\n
simulation_state =
[\'suspended\', \'open\']
,\n
source_project_uid = computer.getUid()\n
)\n
if support_request is None:\n
...
...
@@ -100,7 +102,7 @@ if not person.Person_isServiceProvider():\n
\n
# Send notification message\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=
\'slapos-crm-computer_allocation_scope.notification\'
)\n
reference=
notification_message_reference
)\n
\n
if notification_message is not None:\n
mapping_dict = {\'computer_title\':computer.getTitle(),\n
...
...
@@ -111,13 +113,16 @@ if not person.Person_isServiceProvider():\n
else:\n
message = request_description\n
\n
support_request.SupportRequest_trySendNotificationMessage(request_title,\n
event =
support_request.SupportRequest_trySendNotificationMessage(request_title,\n
message, person.getRelativeUrl())\n
\n
if event is not None:\n
computer.edit(**edit_kw)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
target_allocation_scope=\'open/personal\', notification_message_reference=\'slapos-crm-computer_allocation_scope.notification\'
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkAndUpdatePersonalAllocationScope.xml
0 → 100644
View file @
42e72e67
<?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>
context.Computer_checkAndUpdateAllocationScope(\n
target_allocation_scope = \'close/termination\',\n
notification_message_reference=\'slapos-crm-computer_personal_allocation_scope.notification\')\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Computer_checkAndUpdatePersonalAllocationScope
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSkins.py
View file @
42e72e67
...
...
@@ -1867,7 +1867,8 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by SupportRequest_trySendNotificationMessage '
\
'%s %s %s %s" % (message_title, message, source_relative_url, interval_of_day))'
)
'%s %s %s %s" % (message_title, message, source_relative_url, interval_of_day))
\
n
'
\
'return 1'
)
def
test_computerNotAllowedAllocationScope_OpenPublic
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
person
=
computer
.
getSourceAdministrationValue
()
...
...
@@ -1899,7 +1900,8 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by SupportRequest_trySendNotificationMessage '
\
'%s %s %s %s" % (message_title, message, source_relative_url, interval_of_day))'
)
'%s %s %s %s" % (message_title, message, source_relative_url, interval_of_day))
\
n
'
\
'return 1'
)
def
test_computerNotAllowedAllocationScope_OpenFriend
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
person
=
computer
.
getSourceAdministrationValue
()
...
...
@@ -1922,6 +1924,38 @@ class TestSlapOSComputer_notifyWrongAllocationScope(testSlapOSMixin):
'Test NM content
\
n
%s
\
n
'
%
computer
.
getReference
(),
person
.
getRelativeUrl
(),
'1'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-crm-computer_personal_allocation_scope.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_computerToCloseAllocationScope_OpenPersonal"])'
)
@
simulate
(
'SupportRequest_trySendNotificationMessage'
,
'message_title, message, source_relative_url, interval_of_day=1'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by SupportRequest_trySendNotificationMessage '
\
'%s %s %s %s" % (message_title, message, source_relative_url, interval_of_day))
\
n
'
\
'return 1'
)
def
test_computerToCloseAllocationScope_OpenPersonal
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
person
=
computer
.
getSourceAdministrationValue
()
self
.
portal
.
REQUEST
[
'test_computerToCloseAllocationScope_OpenPersonal'
]
=
\
self
.
_makeNotificationMessage
(
computer
.
getReference
())
friend_person
=
self
.
_makePerson
(
self
.
generateNewId
())
computer
.
edit
(
allocation_scope
=
'open/personal'
,
destination_section
=
friend_person
.
getRelativeUrl
())
computer
.
Computer_checkAndUpdatePersonalAllocationScope
()
self
.
tic
()
self
.
assertEquals
(
computer
.
getAllocationScope
(),
'close/termination'
)
ticket
=
self
.
_getGeneratedSupportRequest
(
computer
)
self
.
assertEquals
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
'Visited by SupportRequest_trySendNotificationMessage '
\
'%s %s %s %s'
%
\
(
'We have changed allocation scope for %s'
%
computer
.
getReference
(),
'Test NM content
\
n
%s
\
n
'
%
computer
.
getReference
(),
person
.
getRelativeUrl
(),
'1'
),
ticket
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_computerNormalAllocationScope_OpenPersonal
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
...
...
master/bt5/slapos_crm/TestTemplateItem/testSlapOSCRMSupportRequestGeneration.py
View file @
42e72e67
...
...
@@ -367,8 +367,6 @@ class TestSlapOSCloudSupportRequestGeneration(testSlapOSMixin):
self
.
assertEqual
(
event
.
getTitle
(),
title
)
def
test_Computer_checkState_empty_cache
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
...
...
@@ -838,6 +836,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
assertEqual
(
'Visited by Computer_checkAndUpdateAllocationScope'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_Alarm_notAllowedAllocationScope_OpenFriend
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/friend'
)
...
...
@@ -868,6 +867,52 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
assertNotEqual
(
'Visited by Computer_checkAndUpdateAllocationScope'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_Alarm_AllowedAllocationScope_OpenPersonal_old_computer
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/personal'
)
def
getModificationDate
(
self
):
return
DateTime
()
-
50
from
Products.ERP5Type.Base
import
Base
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
original_get_modification
=
Base
.
getModificationDate
Base
.
getModificationDate
=
getModificationDate
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_update_allocation_scope
.
activeSense
()
self
.
tic
()
finally
:
Base
.
getModificationDate
=
original_get_modification
self
.
_dropComputer_checkAndUpdateAllocationScope
()
self
.
assertEqual
(
'Visited by Computer_checkAndUpdateAllocationScope'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_Alarm_AllowedAllocationScope_OpenPersonalWithSoftwareInstallation
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/personal'
)
software_installation
=
self
.
_makeSoftwareInstallation
(
self
.
new_id
,
computer
,
"http://..."
)
def
getModificationDate
(
self
):
return
DateTime
()
-
50
from
Products.ERP5Type.Base
import
Base
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
original_get_modification
=
Base
.
getModificationDate
Base
.
getModificationDate
=
getModificationDate
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_update_allocation_scope
.
activeSense
()
self
.
tic
()
finally
:
Base
.
getModificationDate
=
original_get_modification
self
.
_dropComputer_checkAndUpdateAllocationScope
()
self
.
assertNotEqual
(
'Visited by Computer_checkAndUpdateAllocationScope'
,
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_simulateHostingSubscription_checkSofwareInstanceState
(
self
):
script_name
=
'HostingSubscription_checkSofwareInstanceAllocationState'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
...
master/bt5/slapos_crm/bt/revision
View file @
42e72e67
49
51
\ No newline at end of file
master/bt5/slapos_crm/bt/template_path_list
View file @
42e72e67
event_module/slapos_crm_web_message_template
person_module/allocation_tester
portal_alarms/slapos_check_cloud_is_full
portal_alarms/slapos_check_computer_state
portal_alarms/slapos_check_software_instance_state
portal_alarms/slapos_crm_cancel_invoice
...
...
master/bt5/slapos_erp5/PortalTypeRolesTemplateItem/Restricted%20Access%20Token.xml
View file @
42e72e67
<type_roles>
<role
id=
'Auditor'
>
<property
id=
'title'
>
Agent as auditor
</property>
<property
id=
'base_category_script'
>
ERP5Type_getSecurityCategoryFromContent
</property>
<multi_property
id=
'base_category'
>
agent
</multi_property>
</role>
<role
id=
'Assignor'
>
<property
id=
'title'
>
Group company
</property>
<multi_property
id=
'category'
>
group/company
</multi_property>
...
...
master/bt5/slapos_erp5/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml
View file @
42e72e67
...
...
@@ -35,6 +35,10 @@
<type>
Person
</type>
<workflow>
local_permission_slapos_interaction_workflow
</workflow>
</chain>
<chain>
<type>
Restricted Access Token
</type>
<workflow>
local_permission_slapos_interaction_workflow
</workflow>
</chain>
<chain>
<type>
Sale Invoice Transaction
</type>
<workflow>
local_permission_slapos_interaction_workflow
</workflow>
...
...
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/interactions/RestrictedAccessToken_edit.xml
0 → 100644
View file @
42e72e67
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"InteractionDefinition"
module=
"Products.ERP5.Interaction"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
activate_script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<list>
<string>
Base_updateAllLocalRoles
</string>
</list>
</value>
</item>
<item>
<key>
<string>
before_commit_script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
RestrictedAccessToken_edit
</string>
</value>
</item>
<item>
<key>
<string>
method_id
</string>
</key>
<value>
<list>
<string>
_setAgent.*
</string>
</list>
</value>
</item>
<item>
<key>
<string>
once_per_transaction
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
portal_type_filter
</string>
</key>
<value>
<list>
<string>
Restricted Access Token
</string>
</list>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
temporary_document_disallowed
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/WorkflowTemplateItem/portal_workflow/local_permission_slapos_interaction_workflow/interactions/UpgradeDecision_edit.xml
0 → 100644
View file @
42e72e67
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"InteractionDefinition"
module=
"Products.ERP5.Interaction"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
activate_script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<list>
<string>
Base_updateAllLocalRoles
</string>
</list>
</value>
</item>
<item>
<key>
<string>
before_commit_script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_edit
</string>
</value>
</item>
<item>
<key>
<string>
method_id
</string>
</key>
<value>
<list>
<string>
_setDestinationSection.*
</string>
</list>
</value>
</item>
<item>
<key>
<string>
once_per_transaction
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
portal_type_filter
</string>
</key>
<value>
<list>
<string>
Upgrade Decision
</string>
</list>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
temporary_document_disallowed
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/bt/revision
View file @
42e72e67
178
\ No newline at end of file
181
master/bt5/slapos_erp5/bt/template_portal_type_workflow_chain_list
View file @
42e72e67
...
...
@@ -7,6 +7,7 @@ Integration Site | local_permission_slapos_interaction_workflow
Payment Transaction | local_permission_slapos_interaction_workflow
Payzen Event | local_permission_slapos_interaction_workflow
Person | local_permission_slapos_interaction_workflow
Restricted Access Token | local_permission_slapos_interaction_workflow
Sale Invoice Transaction | local_permission_slapos_interaction_workflow
Sale Packing List | local_permission_slapos_interaction_workflow
Slave Instance | local_permission_slapos_interaction_workflow
...
...
master/bt5/slapos_
crm/PathTemplateItem/portal_alarms/slapos_check_cloud_is_full
.xml
→
master/bt5/slapos_
pdm/PathTemplateItem/portal_alarms/slapos_pdm_upgrade_decision_process_stopped
.xml
View file @
42e72e67
...
...
@@ -8,7 +8,7 @@
<dictionary>
<item>
<key>
<string>
active_sense_method_id
</string>
</key>
<value>
<string>
Alarm_
checkCloudIsFull
</string>
</value>
<value>
<string>
Alarm_
processStoppedUpgradeDecision
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
...
...
@@ -22,7 +22,13 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_check_cloud_is_full
</string>
</value>
<value>
<string>
slapos_pdm_upgrade_decision_process_stopped
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_day_frequency
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
...
...
@@ -32,7 +38,9 @@
</item>
<item>
<key>
<string>
periodicity_hour_frequency
</string>
</key>
<value>
<int>
1
</int>
</value>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
...
...
@@ -42,9 +50,7 @@
</item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<value>
<none/>
</value>
<value>
<int>
5
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
...
...
@@ -70,7 +76,7 @@
</tuple>
<state>
<tuple>
<float>
137760864
0.0
</float>
<float>
366
0.0
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
@@ -87,15 +93,9 @@
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Alarm
</string>
</value>
</item>
<item>
<key>
<string>
sense_method_id
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Check if vifib cloud is full
</string>
</value>
<value>
<string>
Process Stopped Upgrade Decisions
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_
crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkCloudIsFull
.xml
→
master/bt5/slapos_
pdm/SkinTemplateItem/portal_skins/slapos_pdm/Alarm_processStoppedUpgradeDecision
.xml
View file @
42e72e67
...
...
@@ -51,19 +51,12 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
software_release_preference = portal.portal_preferences.getPreferredSoftwareReleaseToTestForSpace()\n
\n
if software_release_preference != \'\':\n
software_release_list = software_release_preference.split("\\n")\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type = \'Software Release\',\n
url_string = software_release_list,\n
\n
method_id = \'SoftwareRelease_testForAllocation\',\n
activate_kw = {\'tag\':tag} \n
)\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Upgrade Decision\',\n
simulation_state=\'stopped\',\n
method_id=\'UpgradeDecision_notifyDelivered\',\n
activate_kw={\'tag\': tag }\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
...
...
@@ -74,7 +67,7 @@ context.activate(after_tag=tag).getId()\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Alarm_
checkCloudIsFull
</string>
</value>
<value>
<string>
Alarm_
processStoppedUpgradeDecision
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/SoftwareRelease_createUpgradeDecision.xml
View file @
42e72e67
...
...
@@ -74,11 +74,12 @@ if not person_url:\n
\n
upgrade_decision = portal.upgrade_decision_module.\\\n
template_upgrade_decision.Base_createCloneDocument(batch_mode=1)\n
upgrade_decision.edit(\n
title=title,\n
destination_section=person_url,\n
destination_decision=person_url\n
)\n
\n
upgrade_decision.edit(title=title)\n
\n
upgrade_decision.setDestinationSection(person_url)\n
upgrade_decision.setDestinationDecision(person_url)\n
\n
decision_line_list = upgrade_decision.contentValues(\n
portal_type=\'Upgrade Decision Line\')\n
if len(decision_line_list) >
0:\n
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_getComputerNotificationMessage.xml
0 → 100644
View file @
42e72e67
<?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>
portal = context.getPortalObject()\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=\'slapos-upgrade-computer.notification\')\n
\n
title = "New Software available for Installation at %s" % computer.getTitle()\n
mapping_dict = {\'software_product_title\': software_product_title,\n
\'computer_title\': computer.getTitle(),\n
\'computer_reference\': computer.getReference(),\n
\'software_release_name\': software_release.getTitle(),\n
\'software_release_reference\': software_release.getReference(),\n
\'upgrade_accept_link\': \n
\'Base_acceptUpgradeDecision?reference=%s\' % reference,\n
\'upgrade_reject_link\':\n
\'Base_rejectUpgradeDecision?reference=%s\' % reference,\n
\'new_software_release_url\': software_release.getUrlString(),\n
}\n
\n
\n
if notification_message is not None:\n
message = notification_message.asEntireHTML(\n
substitution_method_parameter_dict={\'mapping_dict\': mapping_dict})\n
else:\n
raise ValueError("No Notification Message")\n
\n
return title, message\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
computer
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_getComputerNotificationMessage
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_
crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareRelease_testForAllocation
.xml
→
master/bt5/slapos_
pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_isUpgradeFinished
.xml
View file @
42e72e67
...
...
@@ -50,34 +50,34 @@
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
>
portal = context.getPortalObject()\n
software_release = context\n
software_release_url = software_release.getUrlString
()\n
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject
()\n
\n
user = portal.person_module.allocation_tester\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
\n
result = user.Person_restrictMethodAsShadowUser(\n
shadow_document=user,\n
callable_object=user.Person_findPartition,\n
argument_list=[\n
software_release_url,\n
\'\',\n
\'Software Instance\',\n
{}\n
],\n
argument_dict={\n
\'test_mode\': True})\n
if hosting_subscription is not None:\n
if hosting_subscription.getUrlString() == software_release.getUrlString():\n
return True\n
\n
if not result:\n
title = "Can\'t allocate new instances for software release %s" % software_release_url\n
description = "Need more public computers that can instanciate the software release %s" % software_release_url\n
elif computer is not None:\n
full_software_release_list = [si for si in \n
portal.portal_catalog(\n
portal_type=\'Software Installation\',\n
url_string=software_release.getUrlString(),\n
default_aggregate_uid=computer.getUid(),\n
validation_state=\'validated\'\n
) if si.getSlapState() == \'start_requested\']\n
\n
return software_release.Base_generateSupportRequestForSlapOS(\n
title,\n
description,\n
software_release.getRelativeUrl()\n
)\n
</string>
</value>
if len(full_software_release_list) >
0:\n
return True\n
\n
return False\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
...
...
@@ -85,7 +85,7 @@ if not result:\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SoftwareRelease_testForAllocation
</string>
</value>
<value>
<string>
UpgradeDecision_isUpgradeFinished
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
master/bt5/slapos_pdm/SkinTemplateItem/portal_skins/slapos_pdm/UpgradeDecision_notifyDelivered.xml
0 → 100644
View file @
42e72e67
<?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 DateTime import DateTime\n
\n
if context.getSimulationState() != \'stopped\':\n
return \n
\n
if context.UpgradeDecision_isUpgradeFinished():\n
return \n
\n
portal = context.getPortalObject()\n
\n
person = context.getDestinationDecisionValue(portal_type="Person")\n
if not person:\n
raise ValueError("Inconsistent Upgrade Decision, No Destination Decision")\n
\n
hosting_subscription = context.UpgradeDecision_getHostingSubscription()\n
computer = context.UpgradeDecision_getComputer()\n
software_release = context.UpgradeDecision_getSoftwareRelease()\n
software_product_title = software_release.getAggregateTitle(\n
portal_type="Software Product")\n
\n
reference = context.getReference()\n
\n
mapping_dict = {\n
\'software_product_title\': software_product_title,\n
\'software_release_name\': software_release.getTitle(),\n
\'software_release_reference\': software_release.getReference(),\n
\'new_software_release_url\': software_release.getUrlString(),\n
}\n
\n
if hosting_subscription is not None:\n
notification_message_reference = \'slapos-upgrade-delivered-hosting-subscription.notification\'\n
title = "Upgrade Processed for %s (%s)" % (hosting_subscription.getTitle(), \n
software_release.getReference())\n
mapping_dict.update(**{\n
\'hosting_subscription_title\': hosting_subscription.getTitle(),\n
\'old_software_release_url\': hosting_subscription.getUrlString()})\n
\n
elif computer is not None:\n
\n
notification_message_reference = \'slapos-upgrade-delivered-computer.notification\' \n
\n
title = "Upgrade processed at %s for %s" % (computer.getTitle(), software_release.getReference()) \n
mapping_dict.update(**{\'computer_title\': computer.getTitle(),\n
\'computer_reference\': computer.getReference()})\n
\n
\n
if notification_message_reference is None:\n
raise ValueError("No Notification Message")\n
\n
notification_message = portal.portal_notifications.getDocumentValue(\n
reference=notification_message_reference)\n
\n
message = notification_message.asEntireHTML(\n
substitution_method_parameter_dict={\'mapping_dict\': mapping_dict})\n
\n
event = context.SupportRequest_trySendNotificationMessage(title,\n
message, person.getRelativeUrl())\n
\n
if event is not None:\n
context.deliver()\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
UpgradeDecision_notifyDelivered
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMAlarm.py
View file @
42e72e67
...
...
@@ -87,6 +87,23 @@ return %s
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_upgrade_decision_process_stopped
(
self
):
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
start
()
upgrade_decision
.
stop
()
self
.
tic
()
self
.
_simulateScript
(
'UpgradeDecision_notifyDelivered'
)
try
:
self
.
portal
.
portal_alarms
.
slapos_pdm_upgrade_decision_process_stopped
.
\
activeSense
()
self
.
tic
()
finally
:
self
.
_dropScript
(
'UpgradeDecision_notifyDelivered'
)
self
.
assertEqual
(
'Visited by UpgradeDecision_notifyDelivered'
,
upgrade_decision
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_computer_create_upgrade_decision
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
computer
.
edit
(
allocation_scope
=
'open/public'
)
...
...
master/bt5/slapos_pdm/TestTemplateItem/testSlapOSPDMSkins.py
View file @
42e72e67
...
...
@@ -1394,6 +1394,37 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
"?portal_status_message=Upgrade%20Decision%20is%20already%20Rejected%21"
),
"%s contains the wrong message"
%
redirect_url
)
def
testUpgradeDecision_isUpgradeFinished_computer
(
self
):
computer
=
self
.
_makeComputer
(
self
.
new_id
)
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
computer
])
upgrade_decision
.
confirm
()
upgrade_decision
.
stop
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
self
.
_makeSoftwareInstallation
(
self
.
new_id
,
computer
,
software_release
.
getUrlString
())
self
.
tic
()
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
def
testUpgradeDecision_isUpgradeFinished_hosting_subscription
(
self
):
hosting_subscription
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
hosting_subscription
])
upgrade_decision
.
confirm
()
upgrade_decision
.
stop
()
self
.
assertFalse
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
hosting_subscription
.
setUrlString
(
software_release
.
getUrlString
())
self
.
assertTrue
(
upgrade_decision
.
UpgradeDecision_isUpgradeFinished
())
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-upgrade-computer.notification"
\
n
'
\
...
...
@@ -1525,3 +1556,133 @@ ${new_software_release_url}""",
self
.
assertEquals
(
event
.
getSimulationState
(),
"delivered"
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-upgrade-delivered-computer.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecision_notifyDelivered_computer"])'
)
@
simulate
(
'UpgradeDecision_isUpgradeFinished'
,
''
,
'return 0'
)
def
testUpgradeDecision_notifyDelivered_computer
(
self
):
person
=
self
.
_makePerson
(
self
.
new_id
)
computer
=
self
.
_makeComputer
(
self
.
new_id
)
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
software_product
=
self
.
_makeSoftwareProduct
(
self
.
new_id
)
software_release
.
setAggregateValue
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
edit
(
destination_decision_value
=
person
)
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
computer
])
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
self
.
new_id
,
text_content_substitution_mapping_method_id
=
"NotificationMessage_getSubstitutionMappingDictFromArgument"
,
text_content
=
"""${software_product_title}
${computer_title}
${computer_reference}
${software_release_name}
${software_release_reference}
${new_software_release_url}"""
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'testUpgradeDecision_notifyDelivered_computer'
]
=
\
notification_message
.
getRelativeUrl
()
self
.
tic
()
self
.
assertEquals
(
None
,
upgrade_decision
.
UpgradeDecision_notifyDelivered
())
upgrade_decision
.
start
()
upgrade_decision
.
stop
()
self
.
tic
()
self
.
assertEquals
(
None
,
upgrade_decision
.
UpgradeDecision_notifyDelivered
())
self
.
tic
()
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'delivered'
)
self
.
assertEquals
(
len
(
upgrade_decision
.
getFollowUpRelatedValueList
()),
1
)
event
=
upgrade_decision
.
getFollowUpRelatedValue
()
self
.
assertEquals
(
event
.
getTitle
(),
"Upgrade processed at %s for %s"
%
(
computer
.
getTitle
(),
software_release
.
getReference
()))
self
.
assertEqual
(
event
.
getTextContent
().
splitlines
(),
[
software_product
.
getTitle
(),
computer
.
getTitle
(),
computer
.
getReference
(),
software_release
.
getTitle
(),
software_release
.
getReference
(),
software_release
.
getUrlString
()])
self
.
assertEquals
(
event
.
getSimulationState
(),
"delivered"
)
@
simulate
(
'NotificationTool_getDocumentValue'
,
'reference=None'
,
'assert reference == "slapos-upgrade-delivered-hosting-subscription.notification"
\
n
'
\
'return context.restrictedTraverse('
\
'context.REQUEST["testUpgradeDecision_notifyDelivered_hosting_subscription"])'
)
@
simulate
(
'UpgradeDecision_isUpgradeFinished'
,
''
,
'return 0'
)
def
testUpgradeDecision_notifyDelivered_hosting_subscription
(
self
):
person
=
self
.
_makePerson
(
self
.
new_id
)
hosting_subscription
=
self
.
_makeHostingSubscription
(
self
.
new_id
)
software_release
=
self
.
_makeSoftwareRelease
(
self
.
new_id
)
software_product
=
self
.
_makeSoftwareProduct
(
self
.
new_id
)
software_release
.
setAggregateValue
(
software_product
)
upgrade_decision
=
self
.
_makeUpgradeDecision
()
upgrade_decision
.
edit
(
destination_decision_value
=
person
)
upgrade_decision_line
=
self
.
_makeUpgradeDecisionLine
(
upgrade_decision
)
upgrade_decision_line
.
setAggregateValueList
([
software_release
,
hosting_subscription
])
old_url
=
hosting_subscription
.
getUrlString
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
title
=
'Test NM title %s'
%
self
.
new_id
,
text_content_substitution_mapping_method_id
=
"NotificationMessage_getSubstitutionMappingDictFromArgument"
,
text_content
=
"""${software_product_title}
${hosting_subscription_title}
${old_software_release_url}
${software_release_name}
${software_release_reference}
${new_software_release_url}"""
,
content_type
=
'text/html'
,
)
self
.
portal
.
REQUEST
\
[
'testUpgradeDecision_notifyDelivered_hosting_subscription'
]
=
\
notification_message
.
getRelativeUrl
()
self
.
tic
()
self
.
assertEquals
(
None
,
upgrade_decision
.
UpgradeDecision_notifyDelivered
())
upgrade_decision
.
start
()
upgrade_decision
.
stop
()
self
.
tic
()
self
.
assertEquals
(
None
,
upgrade_decision
.
UpgradeDecision_notifyDelivered
())
self
.
tic
()
self
.
assertEquals
(
upgrade_decision
.
getSimulationState
(),
'delivered'
)
self
.
assertEquals
(
len
(
upgrade_decision
.
getFollowUpRelatedValueList
()),
1
)
event
=
upgrade_decision
.
getFollowUpRelatedValue
()
self
.
assertEquals
(
event
.
getTitle
(),
"Upgrade Processed for %s (%s)"
%
(
hosting_subscription
.
getTitle
(),
software_release
.
getReference
()))
self
.
assertEqual
(
event
.
getTextContent
().
splitlines
(),
[
software_product
.
getTitle
(),
hosting_subscription
.
getTitle
(),
old_url
,
software_release
.
getTitle
(),
software_release
.
getReference
(),
software_release
.
getUrlString
()])
self
.
assertEquals
(
event
.
getSimulationState
(),
"delivered"
)
master/bt5/slapos_pdm/bt/revision
View file @
42e72e67
32
\ No newline at end of file
37
master/bt5/slapos_pdm/bt/template_path_list
View file @
42e72e67
...
...
@@ -3,6 +3,7 @@ portal_alarms/slapos_pdm_computer_create_upgrade_decision
portal_alarms/slapos_pdm_hosting_subscription_create_upgrade_decision
portal_alarms/slapos_pdm_upgrade_decision_process_planned
portal_alarms/slapos_pdm_upgrade_decision_process_started
portal_alarms/slapos_pdm_upgrade_decision_process_stopped
software_product_module/template_software_product
software_release_module/template_software_release
upgrade_decision_module/template_upgrade_decision
\ No newline at end of file
master/bt5/slapos_web/SkinTemplateItem/portal_skins/slapos_rss/WebSection_getUserRssTicketList.xml
View file @
42e72e67
...
...
@@ -51,8 +51,8 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
kw[\'portal_type\'] = ["Support Request", "Regularisation Request"]\n
kw[\'simulation_state\'] = [\'validated\',\'submitted\']
\n
kw[\'portal_type\'] = ["Support Request", "Regularisation Request"
, "Upgrader Decision"
]\n
\n
\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
if person:\n
...
...
master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_generateRssRestrictedAccessTokenFromJS.xml
View file @
42e72e67
...
...
@@ -57,6 +57,9 @@ import json\n
portal = context.getPortalObject()\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
if person is None:\n
raise ValueError("User Not Found")\n
\n
web_site = context.getWebSiteValue()\n
request_url = "%s/%s" % (web_site.absolute_url(), "feed")\n
\n
...
...
@@ -69,22 +72,24 @@ for token_item in portal.portal_catalog(\n
):\n
if token_item.getUrlString() == request_url:\n
access_token = token_item\n
reference = access_token.getReference()\n
break;\n
\n
if access_token is None:\n
access_token = portal.access_token_module.newContent(\n
portal_type="Restricted Access Token",\n
agent_value=person,\n
url_string=request_url,\n
url_method="GET",\n
)\n
access_token.setAgentValue(person)\n
reference = access_token.getReference() \n
access_token.validate()\n
\n
url = "%s/%s?portal_skin=RSS&access_token=%s&access_token_secret=%s" % (\n
web_site.absolute_url(),\n
"feed",\n
access_token.getId(),\n
access_token.getReference()
)\n
reference
)\n
\n
request = context.REQUEST\n
response = request.RESPONSE\n
...
...
master/bt5/slapos_web/bt/revision
View file @
42e72e67
63
\ No newline at end of file
65
slapos/collect/__init__.py
View file @
42e72e67
...
...
@@ -79,7 +79,7 @@ def do_collect(conf):
raise
log_directory
=
"%s/var/data-log"
%
conf
.
get
(
"slapos"
,
"instance_root"
)
mkdir_p
(
log_directory
)
mkdir_p
(
log_directory
,
0o755
)
database
=
Database
(
log_directory
)
computer
=
Computer
(
ComputerSnapshot
())
...
...
slapos/grid/slapgrid.py
View file @
42e72e67
...
...
@@ -37,6 +37,7 @@ import subprocess
import
sys
import
tempfile
import
time
import
stat
import
traceback
import
warnings
import
logging
...
...
@@ -352,8 +353,17 @@ class Slapgrid(object):
raise
OSError
(
'%s does not exist.'
%
self
.
instance_root
)
# Creates everything needed
# Create directory accessible for the instances.
var_directory
=
os
.
path
.
join
(
self
.
instance_root
,
'var'
)
if
not
os
.
path
.
isdir
(
var_directory
):
os
.
mkdir
(
var_directory
)
os
.
chmod
(
var_directory
,
stat
.
S_IRWXU
|
stat
.
S_IROTH
|
stat
.
S_IXOTH
|
\
stat
.
S_IRGRP
|
stat
.
S_IXGRP
)
mkdir_p
(
os
.
path
.
join
(
self
.
instance_root
,
'var'
),
0o755
)
# Creates instance_root structure
createPrivateDirectory
(
os
.
path
.
join
(
self
.
instance_root
,
'var'
))
createPrivateDirectory
(
os
.
path
.
join
(
self
.
instance_root
,
'var'
,
'log'
))
createPrivateDirectory
(
os
.
path
.
join
(
self
.
instance_root
,
'var'
,
'run'
))
...
...
slapos/proxy/schema.sql
View file @
42e72e67
--version:10
CREATE
TABLE
IF
NOT
EXISTS
software
%
(
version
)
s
(
url
VARCHAR
(
255
)
UNIQUE
);
--version:11
CREATE
TABLE
IF
NOT
EXISTS
software
%
(
version
)
s
(
url
VARCHAR
(
255
),
computer_reference
VARCHAR
(
255
)
DEFAULT
'%(computer)s'
,
CONSTRAINT
uniq
PRIMARY
KEY
(
url
,
computer_reference
)
);
CREATE
TABLE
IF
NOT
EXISTS
computer
%
(
version
)
s
(
reference
VARCHAR
(
255
)
DEFAULT
'%(computer)s'
,
address
VARCHAR
(
255
),
netmask
VARCHAR
(
255
),
CONSTRAINT
uniq
PRIMARY
KEY
(
address
,
netmask
));
CONSTRAINT
uniq
PRIMARY
KEY
(
reference
)
);
CREATE
TABLE
IF
NOT
EXISTS
partition
%
(
version
)
s
(
reference
VARCHAR
(
255
)
UNIQUE
,
reference
VARCHAR
(
255
),
computer_reference
VARCHAR
(
255
)
DEFAULT
'%(computer)s'
,
slap_state
VARCHAR
(
255
)
DEFAULT
'free'
,
software_release
VARCHAR
(
255
),
xml
TEXT
,
...
...
@@ -16,11 +24,13 @@ CREATE TABLE IF NOT EXISTS partition%(version)s (
partition_reference
VARCHAR
(
255
),
requested_by
VARCHAR
(
255
),
-- only used for debugging,
-- slapproxy does not support proper scope
requested_state
VARCHAR
(
255
)
NOT
NULL
DEFAULT
'started'
requested_state
VARCHAR
(
255
)
NOT
NULL
DEFAULT
'started'
,
CONSTRAINT
uniq
PRIMARY
KEY
(
reference
,
computer_reference
)
);
CREATE
TABLE
IF
NOT
EXISTS
slave
%
(
version
)
s
(
reference
VARCHAR
(
255
)
UNIQUE
,
reference
VARCHAR
(
255
),
computer_reference
VARCHAR
(
255
)
DEFAULT
'%(computer)s'
,
connection_xml
TEXT
,
hosted_by
VARCHAR
(
255
),
asked_by
VARCHAR
(
255
)
-- only used for debugging,
...
...
@@ -29,7 +39,9 @@ CREATE TABLE IF NOT EXISTS slave%(version)s (
CREATE
TABLE
IF
NOT
EXISTS
partition_network
%
(
version
)
s
(
partition_reference
VARCHAR
(
255
),
computer_reference
VARCHAR
(
255
)
DEFAULT
'%(computer)s'
,
reference
VARCHAR
(
255
),
address
VARCHAR
(
255
),
netmask
VARCHAR
(
255
)
);
slapos/proxy/views.py
View file @
42e72e67
This diff is collapsed.
Click to expand it.
slapos/tests/slapgrid.py
View file @
42e72e67
...
...
@@ -34,6 +34,7 @@ import shutil
import
signal
import
socket
import
sys
import
stat
import
tempfile
import
textwrap
import
time
...
...
@@ -535,6 +536,8 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self
.
assertEqual
(
self
.
grid
.
processComputerPartitionList
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertItemsEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'etc'
,
'var'
])
self
.
assertItemsEqual
(
os
.
listdir
(
self
.
software_root
),
[])
st
=
os
.
stat
(
os
.
path
.
join
(
self
.
instance_root
,
'var'
))
self
.
assertEquals
(
stat
.
S_IMODE
(
st
.
st_mode
),
0o755
)
def
test_one_partition
(
self
):
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
...
...
slapos/tests/slapproxy.py
→
slapos/tests/slapproxy
/__init__
.py
View file @
42e72e67
This diff is collapsed.
Click to expand it.
slapos/tests/slapproxy/database_dump_version_10.sql
0 → 100644
View file @
42e72e67
-- Real world example of webrunner database running version 10 of proxy db.
PRAGMA
foreign_keys
=
OFF
;
BEGIN
TRANSACTION
;
CREATE
TABLE
software10
(
url
VARCHAR
(
255
)
UNIQUE
);
INSERT
INTO
"software10"
VALUES
(
'/srv/slapgrid//srv//runner/project//slapos/software.cfg'
);
CREATE
TABLE
computer10
(
address
VARCHAR
(
255
),
netmask
VARCHAR
(
255
),
CONSTRAINT
uniq
PRIMARY
KEY
(
address
,
netmask
));
INSERT
INTO
"computer10"
VALUES
(
'127.0.0.1'
,
'255.255.255.255'
);
CREATE
TABLE
partition10
(
reference
VARCHAR
(
255
)
UNIQUE
,
slap_state
VARCHAR
(
255
)
DEFAULT
'free'
,
software_release
VARCHAR
(
255
),
xml
TEXT
,
connection_xml
TEXT
,
slave_instance_list
TEXT
,
software_type
VARCHAR
(
255
),
partition_reference
VARCHAR
(
255
),
requested_by
VARCHAR
(
255
),
-- only used for debugging,
-- slapproxy does not support proper scope
requested_state
VARCHAR
(
255
)
NOT
NULL
DEFAULT
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart0'
,
'busy'
,
'/srv/slapgrid//srv//runner/project//slapos/software.cfg'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="json">{
"site-id": "erp5"
}
}</parameter>
</instance>
'
,
NULL
,
NULL
,
'production'
,
'slapos'
,
NULL
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart1'
,
'busy'
,
'/srv/slapgrid//srv//runner/project//slapos/software.cfg'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance/>
'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="url">mysql://127.0.0.1:45678/erp5</parameter>
</instance>
'
,
NULL
,
'mariadb'
,
'MariaDB DataBase'
,
'slappart0'
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart2'
,
'busy'
,
'/srv/slapgrid//srv//runner/project//slapos/software.cfg'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="cloudooo-json"></parameter>
</instance>
'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="url">cloudooo://127.0.0.1:23000/</parameter>
</instance>
'
,
NULL
,
'cloudooo'
,
'Cloudooo'
,
'slappart0'
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart3'
,
'busy'
,
'/srv/slapgrid//srv//runner/project//slapos/software.cfg'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance/>
'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="url">memcached://127.0.0.1:11000/</parameter>
</instance>
'
,
NULL
,
'memcached'
,
'Memcached'
,
'slappart0'
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart4'
,
'busy'
,
'/srv/slapgrid//srv//runner/project//slapos/software.cfg'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance/>
'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="url">memcached://127.0.0.1:13301/</parameter>
</instance>
'
,
NULL
,
'kumofs'
,
'KumoFS'
,
'slappart0'
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart5'
,
'busy'
,
'/srv/slapgrid//srv//runner/project//slapos/software.cfg'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="kumofs-url">memcached://127.0.0.1:13301/</parameter>
<parameter id="memcached-url">memcached://127.0.0.1:11000/</parameter>
<parameter id="cloudooo-url">cloudooo://127.0.0.1:23000/</parameter>
</instance>
'
,
'<?xml version=
''
1.0
''
encoding=
''
utf-8
''
?>
<instance>
<parameter id="url">https://[fc00::1]:10001</parameter>
</instance>
'
,
NULL
,
'tidstorage'
,
'TidStorage'
,
'slappart0'
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart6'
,
'free'
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart7'
,
'free'
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart8'
,
'free'
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
'started'
);
INSERT
INTO
"partition10"
VALUES
(
'slappart9'
,
'free'
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
'started'
);
CREATE
TABLE
slave10
(
reference
VARCHAR
(
255
)
UNIQUE
,
connection_xml
TEXT
,
hosted_by
VARCHAR
(
255
),
asked_by
VARCHAR
(
255
)
-- only used for debugging,
-- slapproxy does not support proper scope
);
CREATE
TABLE
partition_network10
(
partition_reference
VARCHAR
(
255
),
reference
VARCHAR
(
255
),
address
VARCHAR
(
255
),
netmask
VARCHAR
(
255
)
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart0'
,
'slappart0'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart0'
,
'slappart0'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart1'
,
'slappart1'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart1'
,
'slappart1'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart2'
,
'slappart2'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart2'
,
'slappart2'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart3'
,
'slappart3'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart3'
,
'slappart3'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart4'
,
'slappart4'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart4'
,
'slappart4'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart5'
,
'slappart5'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart5'
,
'slappart5'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart6'
,
'slappart6'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart6'
,
'slappart6'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart7'
,
'slappart7'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart7'
,
'slappart7'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart8'
,
'slappart8'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart8'
,
'slappart8'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart9'
,
'slappart9'
,
'127.0.0.1'
,
'255.255.255.255'
);
INSERT
INTO
"partition_network10"
VALUES
(
'slappart9'
,
'slappart9'
,
'fc00::1'
,
'ffff:ffff:ffff::'
);
COMMIT
;
slapos/version.py
View file @
42e72e67
...
...
@@ -26,4 +26,4 @@
#
##############################################################################
version
=
'1.
1.2
'
version
=
'1.
2.1
'
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