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
f449cb6c
Commit
f449cb6c
authored
Apr 11, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud migrated to new business template format
parent
66cb8262
Changes
190
Show whitespace changes
Inline
Side-by-side
Showing
190 changed files
with
2022 additions
and
2488 deletions
+2022
-2488
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_computer_partition.sql
..._catalog/erp5_mysql_innodb/z0_drop_computer_partition.sql
+1
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_computer_partition.xml
..._catalog/erp5_mysql_innodb/z0_drop_computer_partition.xml
+0
-5
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_software_instance_tree.sql
...alog/erp5_mysql_innodb/z0_drop_software_instance_tree.sql
+1
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_software_instance_tree.xml
...alog/erp5_mysql_innodb/z0_drop_software_instance_tree.xml
+0
-5
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_computer_partition.sql
...log/erp5_mysql_innodb/z0_uncatalog_computer_partition.sql
+1
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_computer_partition.xml
...log/erp5_mysql_innodb/z0_uncatalog_computer_partition.xml
+0
-9
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_email.sql
...m/portal_catalog/erp5_mysql_innodb/z0_uncatalog_email.sql
+1
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_email.xml
...m/portal_catalog/erp5_mysql_innodb/z0_uncatalog_email.xml
+0
-8
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_software_instance.sql
...alog/erp5_mysql_innodb/z0_uncatalog_software_instance.sql
+1
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_software_instance.xml
...alog/erp5_mysql_innodb/z0_uncatalog_software_instance.xml
+0
-9
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_computer_partition_list.sql
...g/erp5_mysql_innodb/z_catalog_computer_partition_list.sql
+40
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_computer_partition_list.xml
...g/erp5_mysql_innodb/z_catalog_computer_partition_list.xml
+0
-48
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_email_list.sql
...portal_catalog/erp5_mysql_innodb/z_catalog_email_list.sql
+19
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_email_list.xml
...portal_catalog/erp5_mysql_innodb/z_catalog_email_list.xml
+0
-26
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.sql
...5_mysql_innodb/z_catalog_no_workflow_date_object_list.sql
+43
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.xml
...5_mysql_innodb/z_catalog_no_workflow_date_object_list.xml
+0
-51
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.sql
...ortal_catalog/erp5_mysql_innodb/z_catalog_object_list.sql
+46
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.xml
...ortal_catalog/erp5_mysql_innodb/z_catalog_object_list.xml
+0
-54
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_software_instance_list.sql
...og/erp5_mysql_innodb/z_catalog_software_instance_list.sql
+32
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_software_instance_list.xml
...og/erp5_mysql_innodb/z_catalog_software_instance_list.xml
+0
-40
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_computer_partition.sql
...catalog/erp5_mysql_innodb/z_create_computer_partition.sql
+11
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_computer_partition.xml
...catalog/erp5_mysql_innodb/z_create_computer_partition.xml
+0
-15
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_software_instance_tree.sql
...log/erp5_mysql_innodb/z_create_software_instance_tree.sql
+9
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_software_instance_tree.xml
...log/erp5_mysql_innodb/z_create_software_instance_tree.xml
+0
-13
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_versioning.sql
.../portal_catalog/erp5_mysql_innodb/z_create_versioning.sql
+18
-0
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_versioning.xml
.../portal_catalog/erp5_mysql_innodb/z_create_versioning.xml
+0
-22
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_allocateInstance.py
...eItem/portal_skins/slapos_cloud/Alarm_allocateInstance.py
+15
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_allocateInstance.xml
...Item/portal_skins/slapos_cloud/Alarm_allocateInstance.xml
+0
-19
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_assertHostingSubscriptionHasPredecessor.py
...os_cloud/Alarm_assertHostingSubscriptionHasPredecessor.py
+13
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_assertHostingSubscriptionHasPredecessor.xml
...s_cloud/Alarm_assertHostingSubscriptionHasPredecessor.xml
+0
-21
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectDestroyedRootTree.py
...ins/slapos_cloud/Alarm_garbageCollectDestroyedRootTree.py
+11
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectDestroyedRootTree.xml
...ns/slapos_cloud/Alarm_garbageCollectDestroyedRootTree.xml
+0
-15
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectNonAllocatedRootTree.py
.../slapos_cloud/Alarm_garbageCollectNonAllocatedRootTree.py
+14
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectNonAllocatedRootTree.xml
...slapos_cloud/Alarm_garbageCollectNonAllocatedRootTree.xml
+0
-18
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_invalidateDestroyedInstance.py
...l_skins/slapos_cloud/Alarm_invalidateDestroyedInstance.py
+14
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_invalidateDestroyedInstance.xml
..._skins/slapos_cloud/Alarm_invalidateDestroyedInstance.xml
+0
-18
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_managePublicComputerCapacityScope.py
...s/slapos_cloud/Alarm_managePublicComputerCapacityScope.py
+12
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_managePublicComputerCapacityScope.xml
.../slapos_cloud/Alarm_managePublicComputerCapacityScope.xml
+0
-16
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_searchComputerPartitionAndMarkFree.py
.../slapos_cloud/Alarm_searchComputerPartitionAndMarkFree.py
+11
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_searchComputerPartitionAndMarkFree.xml
...slapos_cloud/Alarm_searchComputerPartitionAndMarkFree.xml
+0
-15
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_stopCollectInstance.py
...em/portal_skins/slapos_cloud/Alarm_stopCollectInstance.py
+11
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_stopCollectInstance.xml
...m/portal_skins/slapos_cloud/Alarm_stopCollectInstance.xml
+0
-15
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseStateOnComputer.py
...ns/slapos_cloud/Base_getSoftwareReleaseStateOnComputer.py
+4
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseStateOnComputer.xml
...s/slapos_cloud/Base_getSoftwareReleaseStateOnComputer.xml
+0
-8
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseUsageOnComputer.py
...ns/slapos_cloud/Base_getSoftwareReleaseUsageOnComputer.py
+9
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseUsageOnComputer.xml
...s/slapos_cloud/Base_getSoftwareReleaseUsageOnComputer.xml
+0
-13
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getReleatedSoftwareRelease.py
...lapos_cloud/ComputerNetwork_getReleatedSoftwareRelease.py
+9
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getReleatedSoftwareRelease.xml
...apos_cloud/ComputerNetwork_getReleatedSoftwareRelease.xml
+0
-13
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareInstanceAmount.py
...slapos_cloud/ComputerNetwork_getSoftwareInstanceAmount.py
+12
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareInstanceAmount.xml
...lapos_cloud/ComputerNetwork_getSoftwareInstanceAmount.xml
+0
-16
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseAllocableState.py
...cloud/ComputerNetwork_getSoftwareReleaseAllocableState.py
+27
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseAllocableState.xml
...loud/ComputerNetwork_getSoftwareReleaseAllocableState.xml
+0
-31
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseUrl.py
...ins/slapos_cloud/ComputerNetwork_getSoftwareReleaseUrl.py
+12
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseUrl.xml
...ns/slapos_cloud/ComputerNetwork_getSoftwareReleaseUrl.xml
+0
-16
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.py
...uterPartition_getAvailableSoftwareReleaseUrlStringList.py
+22
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.xml
...terPartition_getAvailableSoftwareReleaseUrlStringList.xml
+0
-26
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getCustomAllocationParameterDict.py
...oud/ComputerPartition_getCustomAllocationParameterDict.py
+3
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getCustomAllocationParameterDict.xml
...ud/ComputerPartition_getCustomAllocationParameterDict.xml
+0
-7
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getInstanceUrlString.py
...ns/slapos_cloud/ComputerPartition_getInstanceUrlString.py
+6
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getInstanceUrlString.xml
...s/slapos_cloud/ComputerPartition_getInstanceUrlString.xml
+0
-10
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getLastestContactedDate.py
...slapos_cloud/ComputerPartition_getLastestContactedDate.py
+30
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getLastestContactedDate.xml
...lapos_cloud/ComputerPartition_getLastestContactedDate.xml
+0
-34
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getOwnerAsHtml.py
...al_skins/slapos_cloud/ComputerPartition_getOwnerAsHtml.py
+6
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getOwnerAsHtml.xml
...l_skins/slapos_cloud/ComputerPartition_getOwnerAsHtml.xml
+0
-14
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedImageAbsoluteUrl.py
...pos_cloud/ComputerPartition_getRelatedImageAbsoluteUrl.py
+15
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedImageAbsoluteUrl.xml
...os_cloud/ComputerPartition_getRelatedImageAbsoluteUrl.xml
+0
-19
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedInstanceCreationDate.py
...cloud/ComputerPartition_getRelatedInstanceCreationDate.py
+7
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedInstanceCreationDate.xml
...loud/ComputerPartition_getRelatedInstanceCreationDate.xml
+0
-11
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareInstanceStatus.py
...apos_cloud/ComputerPartition_getSoftwareInstanceStatus.py
+13
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareInstanceStatus.xml
...pos_cloud/ComputerPartition_getSoftwareInstanceStatus.xml
+0
-21
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareType.py
...l_skins/slapos_cloud/ComputerPartition_getSoftwareType.py
+9
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareType.xml
..._skins/slapos_cloud/ComputerPartition_getSoftwareType.xml
+0
-13
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getUsageReportUrl.py
...skins/slapos_cloud/ComputerPartition_getUsageReportUrl.py
+1
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getUsageReportUrl.xml
...kins/slapos_cloud/ComputerPartition_getUsageReportUrl.xml
+0
-5
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_isFreeForRequest.py
..._skins/slapos_cloud/ComputerPartition_isFreeForRequest.py
+3
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_isFreeForRequest.xml
...skins/slapos_cloud/ComputerPartition_isFreeForRequest.xml
+0
-7
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_applyComputerModel.py
.../portal_skins/slapos_cloud/Computer_applyComputerModel.py
+58
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_applyComputerModel.xml
...portal_skins/slapos_cloud/Computer_applyComputerModel.xml
+0
-62
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkAndUpdateCapacityScope.py
...kins/slapos_cloud/Computer_checkAndUpdateCapacityScope.py
+105
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkAndUpdateCapacityScope.xml
...ins/slapos_cloud/Computer_checkAndUpdateCapacityScope.xml
+0
-113
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getBusyComputerPartitionList.py
...ins/slapos_cloud/Computer_getBusyComputerPartitionList.py
+1
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getBusyComputerPartitionList.xml
...ns/slapos_cloud/Computer_getBusyComputerPartitionList.xml
+0
-5
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseList.py
...tal_skins/slapos_cloud/Computer_getSoftwareReleaseList.py
+11
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseList.xml
...al_skins/slapos_cloud/Computer_getSoftwareReleaseList.xml
+0
-15
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseState.py
...al_skins/slapos_cloud/Computer_getSoftwareReleaseState.py
+22
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseState.xml
...l_skins/slapos_cloud/Computer_getSoftwareReleaseState.xml
+0
-26
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUrlStringList.py
.../slapos_cloud/Computer_getSoftwareReleaseUrlStringList.py
+11
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUrlStringList.xml
...slapos_cloud/Computer_getSoftwareReleaseUrlStringList.xml
+0
-15
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUsage.py
...al_skins/slapos_cloud/Computer_getSoftwareReleaseUsage.py
+11
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUsage.xml
...l_skins/slapos_cloud/Computer_getSoftwareReleaseUsage.xml
+0
-15
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getUsageReportUrl.py
...m/portal_skins/slapos_cloud/Computer_getUsageReportUrl.py
+1
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getUsageReportUrl.xml
.../portal_skins/slapos_cloud/Computer_getUsageReportUrl.xml
+0
-5
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/HostingSubscription_assertPredecessor.py
...ins/slapos_cloud/HostingSubscription_assertPredecessor.py
+16
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/HostingSubscription_assertPredecessor.xml
...ns/slapos_cloud/HostingSubscription_assertPredecessor.xml
+0
-20
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollect.py
...portal_skins/slapos_cloud/Instance_tryToGarbageCollect.py
+29
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollect.xml
...ortal_skins/slapos_cloud/Instance_tryToGarbageCollect.xml
+0
-33
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollectNonAllocatedRootTree.py
...cloud/Instance_tryToGarbageCollectNonAllocatedRootTree.py
+47
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollectNonAllocatedRootTree.xml
...loud/Instance_tryToGarbageCollectNonAllocatedRootTree.xml
+0
-55
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToStopCollect.py
...em/portal_skins/slapos_cloud/Instance_tryToStopCollect.py
+33
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToStopCollect.xml
...m/portal_skins/slapos_cloud/Instance_tryToStopCollect.xml
+0
-37
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToUnallocatePartition.py
...l_skins/slapos_cloud/Instance_tryToUnallocatePartition.py
+30
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToUnallocatePartition.xml
..._skins/slapos_cloud/Instance_tryToUnallocatePartition.xml
+0
-34
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
...ateItem/portal_skins/slapos_cloud/Person_findPartition.py
+122
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.xml
...teItem/portal_skins/slapos_cloud/Person_findPartition.xml
+0
-130
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_isAllowedToAllocate.py
...m/portal_skins/slapos_cloud/Person_isAllowedToAllocate.py
+12
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_isAllowedToAllocate.xml
.../portal_skins/slapos_cloud/Person_isAllowedToAllocate.xml
+0
-20
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getCurrentStatus.py
...l_skins/slapos_cloud/SoftwareInstance_getCurrentStatus.py
+31
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getCurrentStatus.xml
..._skins/slapos_cloud/SoftwareInstance_getCurrentStatus.xml
+0
-35
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getDefaultImageAbsoluteUrl.py
...apos_cloud/SoftwareInstance_getDefaultImageAbsoluteUrl.py
+1
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getDefaultImageAbsoluteUrl.xml
...pos_cloud/SoftwareInstance_getDefaultImageAbsoluteUrl.xml
+0
-5
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
...s/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
+121
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.xml
.../slapos_cloud/SoftwareInstance_tryToAllocatePartition.xml
+0
-129
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToInvalidateIfDestroyed.py
...apos_cloud/SoftwareInstance_tryToInvalidateIfDestroyed.py
+12
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToInvalidateIfDestroyed.xml
...pos_cloud/SoftwareInstance_tryToInvalidateIfDestroyed.xml
+0
-16
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.py
...loud/SoftwareRelease_getCurrentInstallationStateAsHtml.py
+36
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.xml
...oud/SoftwareRelease_getCurrentInstallationStateAsHtml.xml
+0
-44
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getRelatedNetworkList.py
...ins/slapos_cloud/SoftwareRelease_getRelatedNetworkList.py
+7
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getRelatedNetworkList.xml
...ns/slapos_cloud/SoftwareRelease_getRelatedNetworkList.xml
+0
-11
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerList.py
...ins/slapos_cloud/SoftwareRelease_getUsableComputerList.py
+14
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerList.xml
...ns/slapos_cloud/SoftwareRelease_getUsableComputerList.xml
+0
-18
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerWithoutSInstanceList.py
.../SoftwareRelease_getUsableComputerWithoutSInstanceList.py
+9
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerWithoutSInstanceList.xml
...SoftwareRelease_getUsableComputerWithoutSInstanceList.xml
+0
-13
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_requestDestroyOnComputerList.py
...pos_cloud/SoftwareRelease_requestDestroyOnComputerList.py
+24
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_requestDestroyOnComputerList.xml
...os_cloud/SoftwareRelease_requestDestroyOnComputerList.xml
+0
-28
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSModuleIdGenerator.py
...loud_promise/Alarm_checkPromiseSlapOSModuleIdGenerator.py
+30
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSModuleIdGenerator.xml
...oud_promise/Alarm_checkPromiseSlapOSModuleIdGenerator.xml
+0
-34
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPAS.py
...skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPAS.py
+19
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPAS.xml
...kins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPAS.xml
+0
-23
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPASBase.py
...s/slapos_cloud_promise/Alarm_checkPromiseSlapOSPASBase.py
+47
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPASBase.xml
.../slapos_cloud_promise/Alarm_checkPromiseSlapOSPASBase.xml
+0
-51
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_fixWithActiveSense.py
...al_skins/slapos_cloud_promise/Alarm_fixWithActiveSense.py
+1
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_fixWithActiveSense.xml
...l_skins/slapos_cloud_promise/Alarm_fixWithActiveSense.xml
+0
-5
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Module_assertIdGenerator.py
...al_skins/slapos_cloud_promise/Module_assertIdGenerator.py
+7
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Module_assertIdGenerator.xml
...l_skins/slapos_cloud_promise/Module_assertIdGenerator.xml
+0
-11
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_approveRegistration.py
...nterface_workflow/scripts/Computer_approveRegistration.py
+8
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_approveRegistration.xml
...terface_workflow/scripts/Computer_approveRegistration.xml
+0
-12
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_generateCertificate.py
...nterface_workflow/scripts/Computer_generateCertificate.py
+14
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_generateCertificate.xml
...terface_workflow/scripts/Computer_generateCertificate.xml
+0
-18
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_reportBang.py
...er_slap_interface_workflow/scripts/Computer_reportBang.py
+13
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_reportBang.xml
...r_slap_interface_workflow/scripts/Computer_reportBang.xml
+0
-17
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.py
...workflow/scripts/Computer_requestSoftwareReleaseChange.py
+70
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.xml
...orkflow/scripts/Computer_requestSoftwareReleaseChange.xml
+0
-78
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_revokeCertificate.py
..._interface_workflow/scripts/Computer_revokeCertificate.py
+8
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_revokeCertificate.xml
...interface_workflow/scripts/Computer_revokeCertificate.xml
+0
-12
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/Instance_checkConsistency.py
...p_interface_workflow/scripts/Instance_checkConsistency.py
+2
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/Instance_checkConsistency.xml
..._interface_workflow/scripts/Instance_checkConsistency.xml
+0
-6
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_allocatePartition.py
...e_workflow/scripts/RequestedInstance_allocatePartition.py
+18
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_allocatePartition.xml
..._workflow/scripts/RequestedInstance_allocatePartition.xml
+0
-22
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.py
...scripts/RequestedInstance_bangIfStateChangeToDestroyed.py
+3
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.xml
...cripts/RequestedInstance_bangIfStateChangeToDestroyed.xml
+0
-7
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.py
...w/scripts/RequestedInstance_bangIfStateChangeToStarted.py
+3
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.xml
.../scripts/RequestedInstance_bangIfStateChangeToStarted.xml
+0
-7
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.py
...w/scripts/RequestedInstance_bangIfStateChangeToStopped.py
+3
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.xml
.../scripts/RequestedInstance_bangIfStateChangeToStopped.xml
+0
-7
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.py
...ce_workflow/scripts/RequestedInstance_bangInstanceTree.py
+17
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml
...e_workflow/scripts/RequestedInstance_bangInstanceTree.xml
+0
-21
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangResquesterInstance.py
...kflow/scripts/RequestedInstance_bangResquesterInstance.py
+9
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangResquesterInstance.xml
...flow/scripts/RequestedInstance_bangResquesterInstance.xml
+0
-13
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_rename.py
...ap_interface_workflow/scripts/RequestedInstance_rename.py
+32
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_rename.xml
...p_interface_workflow/scripts/RequestedInstance_rename.xml
+0
-40
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_unallocatePartition.py
...workflow/scripts/RequestedInstance_unallocatePartition.py
+5
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_unallocatePartition.xml
...orkflow/scripts/RequestedInstance_unallocatePartition.xml
+0
-9
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateConnectionInformation.py
.../scripts/RequestedInstance_updateConnectionInformation.py
+19
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateConnectionInformation.xml
...scripts/RequestedInstance_updateConnectionInformation.xml
+0
-23
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateParameterInformation.py
...w/scripts/RequestedInstance_updateParameterInformation.py
+44
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateParameterInformation.xml
.../scripts/RequestedInstance_updateParameterInformation.xml
+0
-48
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.py
...p_interface_workflow/scripts/RequesterInstance_request.py
+158
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml
..._interface_workflow/scripts/RequesterInstance_request.xml
+0
-166
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_checkConsistency.py
...lap_interface_workflow/scripts/Person_checkConsistency.py
+2
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_checkConsistency.xml
...ap_interface_workflow/scripts/Person_checkConsistency.xml
+0
-6
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestComputer.py
...slap_interface_workflow/scripts/Person_requestComputer.py
+50
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestComputer.xml
...lap_interface_workflow/scripts/Person_requestComputer.xml
+0
-58
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.py
...erface_workflow/scripts/Person_requestSoftwareInstance.py
+120
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml
...rface_workflow/scripts/Person_requestSoftwareInstance.xml
+0
-128
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Alarm_safeTrigger.py
...s_cloud_interaction_workflow/scripts/Alarm_safeTrigger.py
+2
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Alarm_safeTrigger.xml
..._cloud_interaction_workflow/scripts/Alarm_safeTrigger.xml
+0
-6
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Computer_updateDestinationSection.py
...ion_workflow/scripts/Computer_updateDestinationSection.py
+11
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Computer_updateDestinationSection.xml
...on_workflow/scripts/Computer_updateDestinationSection.xml
+0
-15
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_changePromiseParameter.py
...ction_workflow/scripts/Instance_changePromiseParameter.py
+2
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_changePromiseParameter.xml
...tion_workflow/scripts/Instance_changePromiseParameter.xml
+0
-6
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_invalidate.py
...cloud_interaction_workflow/scripts/Instance_invalidate.py
+5
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_invalidate.xml
...loud_interaction_workflow/scripts/Instance_invalidate.xml
+0
-9
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_triggerAllocationAlarm.py
...ction_workflow/scripts/Instance_triggerAllocationAlarm.py
+6
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_triggerAllocationAlarm.xml
...tion_workflow/scripts/Instance_triggerAllocationAlarm.xml
+0
-10
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstallation_reindexComputer.py
..._workflow/scripts/SoftwareInstallation_reindexComputer.py
+5
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstallation_reindexComputer.xml
...workflow/scripts/SoftwareInstallation_reindexComputer.xml
+0
-9
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexComputerPartition.py
...flow/scripts/SoftwareInstance_reindexComputerPartition.py
+5
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexComputerPartition.xml
...low/scripts/SoftwareInstance_reindexComputerPartition.xml
+0
-9
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexRecursivelyPredecessorSoftwareInstanceList.py
...ance_reindexRecursivelyPredecessorSoftwareInstanceList.py
+8
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexRecursivelyPredecessorSoftwareInstanceList.xml
...nce_reindexRecursivelyPredecessorSoftwareInstanceList.xml
+0
-12
No files found.
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_computer_partition.sql
0 → 100644
View file @
f449cb6c
DROP
TABLE
IF
EXISTS
computer_partition
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_computer_partition.xml
View file @
f449cb6c
...
@@ -56,11 +56,6 @@
...
@@ -56,11 +56,6 @@
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
DROP TABLE IF EXISTS computer_partition\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_software_instance_tree.sql
0 → 100644
View file @
f449cb6c
DROP
TABLE
IF
EXISTS
software_instance_tree
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_drop_software_instance_tree.xml
View file @
f449cb6c
...
@@ -50,11 +50,6 @@
...
@@ -50,11 +50,6 @@
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
DROP TABLE IF EXISTS software_instance_tree\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_computer_partition.sql
0 → 100644
View file @
f449cb6c
DELETE
FROM
computer_partition
WHERE
<
dtml
-
sqltest
uid
op
=
eq
type
=
int
>
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_computer_partition.xml
View file @
f449cb6c
...
@@ -50,15 +50,6 @@
...
@@ -50,15 +50,6 @@
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM computer_partition WHERE <dtml-sqltest uid op=eq type=int>
\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_email.sql
0 → 100644
View file @
f449cb6c
DELETE
FROM
email
WHERE
<
dtml
-
sqltest
uid
op
=
eq
type
=
int
>
\ No newline at end of file
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_email.xml
View file @
f449cb6c
...
@@ -18,14 +18,6 @@
...
@@ -18,14 +18,6 @@
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
z0_uncatalog_email
</string>
</value>
<value>
<string>
z0_uncatalog_email
</string>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM email WHERE <dtml-sqltest uid op=eq type=int>
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_software_instance.sql
0 → 100644
View file @
f449cb6c
DELETE
FROM
software_instance_tree
WHERE
<
dtml
-
sqltest
uid
op
=
eq
type
=
int
>
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z0_uncatalog_software_instance.xml
View file @
f449cb6c
...
@@ -50,15 +50,6 @@
...
@@ -50,15 +50,6 @@
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM software_instance_tree WHERE <dtml-sqltest uid op=eq type=int>
\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_computer_partition_list.sql
0 → 100644
View file @
f449cb6c
DELETE
FROM
computer_partition
WHERE
<
dtml
-
in
uid
>
uid
=<
dtml
-
sqlvar
sequence
-
item
type
=
"int"
><
dtml
-
if
sequence
-
end
><
dtml
-
else
>
OR
</
dtml
-
if
>
</
dtml
-
in
>
;
<
dtml
-
var
"'
\0
'"
>
<
dtml
-
let
row_list
=
"[]"
>
<
dtml
-
in
prefix
=
"loop"
expr
=
"_.range(_.len(uid))"
>
<
dtml
-
let
free_for_request
=
"ComputerPartition_isFreeForRequest[loop_item]"
>
<
dtml
-
let
software_type
=
"ComputerPartition_getSoftwareType[loop_item]"
>
<
dtml
-
in
prefix
=
"url"
expr
=
"ComputerPartition_getAvailableSoftwareReleaseUrlStringList[loop_item]"
no_push_item
>
<
dtml
-
call
expr
=
"row_list.append([
uid[loop_item],
url_item,
free_for_request,
software_type])"
>
</
dtml
-
in
>
</
dtml
-
let
>
</
dtml
-
let
>
</
dtml
-
in
>
<
dtml
-
if
"row_list"
>
INSERT
INTO
computer_partition
VALUES
<
dtml
-
in
prefix
=
"row"
expr
=
"row_list"
>
(
<
dtml
-
sqlvar
expr
=
"row_item[0]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"row_item[1]"
type
=
"string"
>
,
<
dtml
-
sqlvar
expr
=
"row_item[2]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"row_item[3]"
type
=
"string"
>
)
<
dtml
-
if
sequence
-
end
><
dtml
-
else
>
,
</
dtml
-
if
>
</
dtml
-
in
>
</
dtml
-
if
>
</
dtml
-
let
>
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_computer_partition_list.xml
View file @
f449cb6c
...
@@ -53,54 +53,6 @@ ComputerPartition_getSoftwareType</string> </value>
...
@@ -53,54 +53,6 @@ ComputerPartition_getSoftwareType</string> </value>
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM\n
computer_partition\n
WHERE\n
<dtml-in uid>
\n
uid=
<dtml-sqlvar
sequence-item
type=
"int"
><dtml-if
sequence-end
><dtml-else>
OR
</dtml-if>
\n
</dtml-in>
\n
;\n
\n
<dtml-var
"\'\\0\'"
>
\n
\n
<dtml-let
row_list=
"[]"
>
\n
<dtml-in
prefix=
"loop"
expr=
"_.range(_.len(uid))"
>
\n
<dtml-let
free_for_request=
"ComputerPartition_isFreeForRequest[loop_item]"
>
\n
<dtml-let
software_type=
"ComputerPartition_getSoftwareType[loop_item]"
>
\n
<dtml-in
prefix=
"url"
expr=
"ComputerPartition_getAvailableSoftwareReleaseUrlStringList[loop_item]"
no_push_item
>
\n
<dtml-call
expr=
"row_list.append([\n
uid[loop_item],\n
url_item,\n
free_for_request,\n
software_type])"
>
\n
</dtml-in>
\n
</dtml-let>
\n
</dtml-let>
\n
</dtml-in>
\n
\n
<dtml-if
"row_list"
>
\n
INSERT INTO\n
computer_partition\n
VALUES\n
<dtml-in
prefix=
"row"
expr=
"row_list"
>
\n
(\n
<dtml-sqlvar
expr=
"row_item[0]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"row_item[1]"
type=
"string"
>
,\n
<dtml-sqlvar
expr=
"row_item[2]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"row_item[3]"
type=
"string"
>
\n
)\n
<dtml-if
sequence-end
><dtml-else>
,
</dtml-if>
\n
</dtml-in>
\n
</dtml-if>
\n
</dtml-let>
\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_email_list.sql
0 → 100644
View file @
f449cb6c
<
dtml
-
let
email_list
=
"[]"
>
<
dtml
-
in
prefix
=
"loop"
expr
=
"_.range(_.len(uid))"
>
<
dtml
-
if
expr
=
"getPortalType[loop_item] in ['Email', 'Software Release', 'Software Installation', 'Software Instance', 'Hosting Subscription']"
>
<
dtml
-
call
expr
=
"email_list.append(loop_item)"
>
</
dtml
-
if
>
</
dtml
-
in
>
<
dtml
-
if
expr
=
"_.len(email_list) > 0"
>
REPLACE
INTO
email
VALUES
<
dtml
-
in
prefix
=
"loop"
expr
=
"email_list"
>
(
<
dtml
-
sqlvar
expr
=
"uid[loop_item]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"getUrlString[loop_item]"
type
=
"string"
optional
>
)
<
dtml
-
if
sequence
-
end
><
dtml
-
else
>
,
</
dtml
-
if
>
</
dtml
-
in
>
</
dtml
-
if
>
</
dtml
-
let
>
\ No newline at end of file
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_email_list.xml
View file @
f449cb6c
...
@@ -20,32 +20,6 @@ getPortalType</string> </value>
...
@@ -20,32 +20,6 @@ getPortalType</string> </value>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
z_catalog_email_list
</string>
</value>
<value>
<string>
z_catalog_email_list
</string>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<dtml-let email_list="[]">
\n
<dtml-in
prefix=
"loop"
expr=
"_.range(_.len(uid))"
>
\n
<dtml-if
expr=
"getPortalType[loop_item] in [\'Email\', \'Software Release\', \'Software Installation\', \'Software Instance\', \'Hosting Subscription\']"
>
\n
<dtml-call
expr=
"email_list.append(loop_item)"
>
\n
</dtml-if>
\n
</dtml-in>
\n
<dtml-if
expr=
"_.len(email_list) > 0"
>
\n
REPLACE INTO\n
email\n
VALUES\n
<dtml-in
prefix=
"loop"
expr=
"email_list"
>
\n
(\n
<dtml-sqlvar
expr=
"uid[loop_item]"
type=
"int"
>
, \n
<dtml-sqlvar
expr=
"getUrlString[loop_item]"
type=
"string"
optional
>
\n
)\n
<dtml-if
sequence-end
><dtml-else>
,
</dtml-if>
\n
</dtml-in>
\n
</dtml-if>
\n
</dtml-let>
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.sql
0 → 100644
View file @
f449cb6c
REPLACE
INTO
catalog
(
`uid`
,
`security_uid`
,
`owner`
,
`viewable_owner`
,
`path`
,
`relative_url`
,
`parent_uid`
,
`id`
,
`description`
,
`title`
,
`meta_type`
,
`portal_type`
,
`opportunity_state`
,
`corporate_registration_code`
,
`ean13_code`
,
`validation_state`
,
`simulation_state`
,
`causality_state`
,
`invoice_state`
,
`payment_state`
,
`event_state`
,
`immobilisation_state`
,
`reference`
,
`grouping_reference`
,
`source_reference`
,
`destination_reference`
,
`string_index`
,
`int_index`
,
`float_index`
,
`has_cell_content`
,
`modification_date`
)
VALUES
<
dtml
-
in
prefix
=
"loop"
expr
=
"_.range(_.len(uid))"
>
(
<
dtml
-
sqlvar
expr
=
"uid[loop_item]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"security_uid[loop_item]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"getOwnerInfo[loop_item]['id']"
type
=
"string"
>
,
<
dtml
-
sqlvar
expr
=
"(getViewPermissionOwner[loop_item] is not None) and getViewPermissionOwner[loop_item] or ''"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getPath[loop_item]"
type
=
"string"
>
,
<
dtml
-
sqlvar
expr
=
"getRelativeUrl[loop_item]"
type
=
"string"
>
,
<
dtml
-
sqlvar
expr
=
"getParentUid[loop_item]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"id[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getDescription[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getTitle[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"meta_type[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getPortalType[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getOpportunityState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getCorporateRegistrationCode[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getEan13Code[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getValidationState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getSimulationState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getCausalityState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getInvoiceState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getPaymentState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getEventState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getImmobilisationState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getGroupingReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getSourceReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getDestinationReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getStringIndex[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getIntIndex[loop_item]"
type
=
"int"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getFloatIndex[loop_item]"
type
=
"float"
optional
>
,
<
dtml
-
sqlvar
expr
=
"hasCellContent[loop_item]"
type
=
"int"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getModificationDate[loop_item]"
type
=
"datetime"
optional
>
)
<
dtml
-
if
sequence
-
end
><
dtml
-
else
>
,
</
dtml
-
if
>
</
dtml
-
in
>
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.xml
View file @
f449cb6c
...
@@ -80,57 +80,6 @@ getModificationDate</string> </value>
...
@@ -80,57 +80,6 @@ getModificationDate</string> </value>
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
REPLACE INTO\n
catalog\n
(`uid`, `security_uid`, `owner`, `viewable_owner`, `path`, `relative_url`, `parent_uid`, `id`, `description`, `title`, `meta_type`,\n
`portal_type`, `opportunity_state`, `corporate_registration_code`, `ean13_code`, `validation_state`, `simulation_state`,\n
`causality_state`, `invoice_state`, `payment_state`, `event_state`, `immobilisation_state`, `reference`, `grouping_reference`,\n
`source_reference`, `destination_reference`, `string_index`, `int_index`, `float_index`, `has_cell_content`, `modification_date`)\n
VALUES\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
\n
(\n
<dtml-sqlvar
expr=
"uid[loop_item]"
type=
"int"
>
, \n
<dtml-sqlvar
expr=
"security_uid[loop_item]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"getOwnerInfo[loop_item][\'id\']"
type=
"string"
>
,\n
<dtml-sqlvar
expr=
"(getViewPermissionOwner[loop_item] is not None) and getViewPermissionOwner[loop_item] or \'\'"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getPath[loop_item]"
type=
"string"
>
,\n
<dtml-sqlvar
expr=
"getRelativeUrl[loop_item]"
type=
"string"
>
,\n
<dtml-sqlvar
expr=
"getParentUid[loop_item]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"id[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getDescription[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getTitle[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"meta_type[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getPortalType[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getOpportunityState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getCorporateRegistrationCode[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getEan13Code[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getValidationState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getSimulationState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getCausalityState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getInvoiceState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getPaymentState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getEventState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getImmobilisationState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getGroupingReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getSourceReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getDestinationReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getStringIndex[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getIntIndex[loop_item]"
type=
"int"
optional
>
,\n
<dtml-sqlvar
expr=
"getFloatIndex[loop_item]"
type=
"float"
optional
>
,\n
<dtml-sqlvar
expr=
"hasCellContent[loop_item]"
type=
"int"
optional
>
,\n
<dtml-sqlvar
expr=
"getModificationDate[loop_item]"
type=
"datetime"
optional
>
\n
)\n
<dtml-if
sequence-end
><dtml-else>
,
</dtml-if>
\n
</dtml-in>
\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.sql
0 → 100644
View file @
f449cb6c
REPLACE
INTO
catalog
(
`uid`
,
`security_uid`
,
`owner`
,
`viewable_owner`
,
`path`
,
`relative_url`
,
`parent_uid`
,
`id`
,
`description`
,
`title`
,
`meta_type`
,
`portal_type`
,
`opportunity_state`
,
`corporate_registration_code`
,
`ean13_code`
,
`validation_state`
,
`simulation_state`
,
`causality_state`
,
`invoice_state`
,
`payment_state`
,
`event_state`
,
`immobilisation_state`
,
`reference`
,
`grouping_reference`
,
`grouping_date`
,
`source_reference`
,
`destination_reference`
,
`string_index`
,
`int_index`
,
`float_index`
,
`has_cell_content`
,
`creation_date`
,
`modification_date`
)
VALUES
<
dtml
-
in
prefix
=
"loop"
expr
=
"_.range(_.len(uid))"
>
(
<
dtml
-
sqlvar
expr
=
"uid[loop_item]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"security_uid[loop_item]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"getOwnerInfo[loop_item]['id']"
type
=
"string"
>
,
<
dtml
-
sqlvar
expr
=
"(getViewPermissionOwner[loop_item] is not None) and getViewPermissionOwner[loop_item] or ''"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getPath[loop_item]"
type
=
"string"
>
,
<
dtml
-
sqlvar
expr
=
"getRelativeUrl[loop_item]"
type
=
"string"
>
,
<
dtml
-
sqlvar
expr
=
"getParentUid[loop_item]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"id[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getDescription[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getTitle[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"meta_type[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getPortalType[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getOpportunityState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getCorporateRegistrationCode[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getEan13Code[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getValidationState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getSimulationState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getCausalityState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getInvoiceState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getPaymentState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getEventState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getImmobilisationState[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getGroupingReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getGroupingDate[loop_item]"
type
=
"datetime"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getSourceReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getDestinationReference[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getStringIndex[loop_item]"
type
=
"string"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getIntIndex[loop_item]"
type
=
"int"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getFloatIndex[loop_item]"
type
=
"float"
optional
>
,
<
dtml
-
sqlvar
expr
=
"hasCellContent[loop_item]"
type
=
"int"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getCreationDate[loop_item]"
type
=
"datetime"
optional
>
,
<
dtml
-
sqlvar
expr
=
"getModificationDate[loop_item]"
type
=
"datetime"
optional
>
)
<
dtml
-
if
sequence
-
end
><
dtml
-
else
>
,
</
dtml
-
if
>
</
dtml
-
in
>
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.xml
View file @
f449cb6c
...
@@ -82,60 +82,6 @@ getModificationDate</string> </value>
...
@@ -82,60 +82,6 @@ getModificationDate</string> </value>
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
REPLACE INTO\n
catalog\n
(`uid`, `security_uid`, `owner`, `viewable_owner`, `path`, `relative_url`, `parent_uid`, `id`, `description`, `title`, `meta_type`,\n
`portal_type`, `opportunity_state`, `corporate_registration_code`, `ean13_code`, `validation_state`, `simulation_state`,\n
`causality_state`, `invoice_state`, `payment_state`, `event_state`, `immobilisation_state`, `reference`, `grouping_reference`, `grouping_date`,\n
`source_reference`, `destination_reference`, `string_index`, `int_index`, `float_index`, `has_cell_content`, `creation_date`,\n
`modification_date`)\n
VALUES\n
<dtml-in prefix="loop" expr="_.range(_.len(uid))">
\n
(\n
<dtml-sqlvar
expr=
"uid[loop_item]"
type=
"int"
>
, \n
<dtml-sqlvar
expr=
"security_uid[loop_item]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"getOwnerInfo[loop_item][\'id\']"
type=
"string"
>
,\n
<dtml-sqlvar
expr=
"(getViewPermissionOwner[loop_item] is not None) and getViewPermissionOwner[loop_item] or \'\'"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getPath[loop_item]"
type=
"string"
>
,\n
<dtml-sqlvar
expr=
"getRelativeUrl[loop_item]"
type=
"string"
>
,\n
<dtml-sqlvar
expr=
"getParentUid[loop_item]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"id[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getDescription[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getTitle[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"meta_type[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getPortalType[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getOpportunityState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getCorporateRegistrationCode[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getEan13Code[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getValidationState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getSimulationState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getCausalityState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getInvoiceState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getPaymentState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getEventState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getImmobilisationState[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getGroupingReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getGroupingDate[loop_item]"
type=
"datetime"
optional
>
,\n
<dtml-sqlvar
expr=
"getSourceReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getDestinationReference[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getStringIndex[loop_item]"
type=
"string"
optional
>
,\n
<dtml-sqlvar
expr=
"getIntIndex[loop_item]"
type=
"int"
optional
>
,\n
<dtml-sqlvar
expr=
"getFloatIndex[loop_item]"
type=
"float"
optional
>
,\n
<dtml-sqlvar
expr=
"hasCellContent[loop_item]"
type=
"int"
optional
>
,\n
<dtml-sqlvar
expr=
"getCreationDate[loop_item]"
type=
"datetime"
optional
>
,\n
<dtml-sqlvar
expr=
"getModificationDate[loop_item]"
type=
"datetime"
optional
>
\n
)\n
<dtml-if
sequence-end
><dtml-else>
,
</dtml-if>
\n
</dtml-in>
\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_software_instance_list.sql
0 → 100644
View file @
f449cb6c
DELETE
FROM
software_instance_tree
WHERE
<
dtml
-
in
uid
>
uid
=<
dtml
-
sqlvar
sequence
-
item
type
=
"int"
><
dtml
-
if
sequence
-
end
><
dtml
-
else
>
OR
</
dtml
-
if
>
</
dtml
-
in
>
;
<
dtml
-
var
"'
\0
'"
>
<
dtml
-
let
row_list
=
"[]"
>
<
dtml
-
in
prefix
=
"loop"
expr
=
"_.range(_.len(uid))"
>
<
dtml
-
if
expr
=
"getSpecialiseUid[loop_item]"
>
<
dtml
-
call
expr
=
"row_list.append([
uid[loop_item],
getSpecialiseUid[loop_item]])"
>
</
dtml
-
if
>
</
dtml
-
in
>
<
dtml
-
if
"row_list"
>
INSERT
INTO
software_instance_tree
VALUES
<
dtml
-
in
prefix
=
"row"
expr
=
"row_list"
>
(
<
dtml
-
sqlvar
expr
=
"row_item[0]"
type
=
"int"
>
,
<
dtml
-
sqlvar
expr
=
"row_item[1]"
type
=
"int"
>
)
<
dtml
-
if
sequence
-
end
><
dtml
-
else
>
,
</
dtml
-
if
>
</
dtml
-
in
>
</
dtml
-
if
>
</
dtml
-
let
>
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_software_instance_list.xml
View file @
f449cb6c
...
@@ -51,46 +51,6 @@ getSpecialiseUid</string> </value>
...
@@ -51,46 +51,6 @@ getSpecialiseUid</string> </value>
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
DELETE FROM\n
software_instance_tree\n
WHERE\n
<dtml-in uid>
\n
uid=
<dtml-sqlvar
sequence-item
type=
"int"
><dtml-if
sequence-end
><dtml-else>
OR
</dtml-if>
\n
</dtml-in>
\n
;\n
\n
<dtml-var
"\'\\0\'"
>
\n
\n
<dtml-let
row_list=
"[]"
>
\n
<dtml-in
prefix=
"loop"
expr=
"_.range(_.len(uid))"
>
\n
<dtml-if
expr=
"getSpecialiseUid[loop_item]"
>
\n
<dtml-call
expr=
"row_list.append([\n
uid[loop_item],\n
getSpecialiseUid[loop_item]])"
>
\n
</dtml-if>
\n
</dtml-in>
\n
\n
<dtml-if
"row_list"
>
\n
INSERT INTO\n
software_instance_tree\n
VALUES\n
<dtml-in
prefix=
"row"
expr=
"row_list"
>
\n
(\n
<dtml-sqlvar
expr=
"row_item[0]"
type=
"int"
>
,\n
<dtml-sqlvar
expr=
"row_item[1]"
type=
"int"
>
\n
)\n
<dtml-if
sequence-end
><dtml-else>
,
</dtml-if>
\n
</dtml-in>
\n
</dtml-if>
\n
</dtml-let>
\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_computer_partition.sql
0 → 100644
View file @
f449cb6c
#
Host
:
#
Database
:
test
#
Table
:
'computer_partition'
#
CREATE
TABLE
`computer_partition`
(
`uid`
BIGINT
UNSIGNED
NOT
NULL
,
`software_release_url`
varchar
(
255
),
`free_for_request`
INT
(
1
),
`software_type`
VARCHAR
(
255
),
PRIMARY
KEY
(
`uid`
,
`software_release_url`
)
)
ENGINE
=
InnoDB
;
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_computer_partition.xml
View file @
f449cb6c
...
@@ -56,21 +56,6 @@
...
@@ -56,21 +56,6 @@
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
# Host:\n
# Database: test\n
# Table: \'computer_partition\'\n
#\n
CREATE TABLE `computer_partition` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`software_release_url` varchar(255),\n
`free_for_request` INT(1),\n
`software_type` VARCHAR(255),\n
PRIMARY KEY (`uid`, `software_release_url`)\n
) ENGINE=InnoDB;\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_software_instance_tree.sql
0 → 100644
View file @
f449cb6c
#
Host
:
#
Database
:
test
#
Table
:
'software_instance_tree'
#
CREATE
TABLE
`software_instance_tree`
(
`uid`
BIGINT
UNSIGNED
NOT
NULL
,
`root_uid`
BIGINT
UNSIGNED
NOT
NULL
,
PRIMARY
KEY
(
`uid`
,
`root_uid`
)
)
ENGINE
=
InnoDB
;
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_software_instance_tree.xml
View file @
f449cb6c
...
@@ -56,19 +56,6 @@
...
@@ -56,19 +56,6 @@
<key>
<string>
max_rows_
</string>
</key>
<key>
<string>
max_rows_
</string>
</key>
<value>
<int>
1000
</int>
</value>
<value>
<int>
1000
</int>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
# Host:\n
# Database: test\n
# Table: \'software_instance_tree\'\n
#\n
CREATE TABLE `software_instance_tree` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`root_uid` BIGINT UNSIGNED NOT NULL,\n
PRIMARY KEY (`uid`, `root_uid`)\n
) ENGINE=InnoDB;\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_versioning.sql
0 → 100644
View file @
f449cb6c
CREATE
TABLE
`versioning`
(
`uid`
BIGINT
UNSIGNED
NOT
NULL
,
`version`
varchar
(
255
)
default
''
,
`language`
varchar
(
5
)
default
''
,
`revision`
varchar
(
10
)
default
''
,
`subject_set_uid`
INT
UNSIGNED
,
`effective_date`
datetime
default
NULL
,
`expiration_date`
datetime
default
NULL
,
`creation_date_index`
INT
,
`frequency_index`
INT
,
PRIMARY
KEY
(
`uid`
),
KEY
`version`
(
`version`
),
KEY
`language`
(
`language`
),
KEY
`subject_set_uid`
(
`subject_set_uid`
),
KEY
`effective_date`
(
`effective_date`
),
KEY
`expiration_date`
(
`expiration_date`
),
KEY
`frequency_index`
(
`creation_date_index`
,
`frequency_index`
)
)
ENGINE
=
InnoDB
;
master/bt5/slapos_cloud/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_create_versioning.xml
View file @
f449cb6c
...
@@ -24,28 +24,6 @@
...
@@ -24,28 +24,6 @@
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
z_create_versioning
</string>
</value>
<value>
<string>
z_create_versioning
</string>
</value>
</item>
</item>
<item>
<key>
<string>
src
</string>
</key>
<value>
<string>
CREATE TABLE `versioning` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`version` varchar(255) default \'\',\n
`language` varchar(5) default \'\',\n
`revision` varchar(10) default \'\',\n
`subject_set_uid` INT UNSIGNED,\n
`effective_date` datetime default NULL,\n
`expiration_date` datetime default NULL,\n
`creation_date_index` INT,\n
`frequency_index` INT,\n
PRIMARY KEY (`uid`),\n
KEY `version` (`version`),\n
KEY `language` (`language`),\n
KEY `subject_set_uid` (`subject_set_uid`),\n
KEY `effective_date` (`effective_date`),\n
KEY `expiration_date` (`expiration_date`),\n
KEY `frequency_index` (`creation_date_index`, `frequency_index`)\n
) ENGINE=InnoDB;\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_allocateInstance.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
select_dict
=
{
'default_aggregate_uid'
:
None
}
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
(
'Slave Instance'
,
'Software Instance'
),
validation_state
=
'validated'
,
default_aggregate_uid
=
None
,
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
method_id
=
'SoftwareInstance_tryToAllocatePartition'
,
packet_size
=
1
,
# Separate calls to many transactions
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_allocateInstance.xml
View file @
f449cb6c
...
@@ -48,25 +48,6 @@
...
@@ -48,25 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
select_dict= {\'default_aggregate_uid\': None}\n
portal.portal_catalog.searchAndActivate(\n
portal_type=(\'Slave Instance\', \'Software Instance\'),\n
validation_state=\'validated\',\n
default_aggregate_uid=None,\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
\n
method_id=\'SoftwareInstance_tryToAllocatePartition\',\n
packet_size=1, # Separate calls to many transactions\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_assertHostingSubscriptionHasPredecessor.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
NegatedQuery
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Hosting Subscription'
,
validation_state
=
'validated'
,
where_expression
=
"related_predecessor_title_1_catalog.title <> catalog.title"
,
predecessor_title
=
NegatedQuery
(
SimpleQuery
(
predecessor_title
=
None
,
comparison_operator
=
'is'
)),
method_id
=
'HostingSubscription_assertPredecessor'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_assertHostingSubscriptionHasPredecessor.xml
View file @
f449cb6c
...
@@ -48,27 +48,6 @@
...
@@ -48,27 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
portal = context.getPortalObject()\n
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, NegatedQuery\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Hosting Subscription\',\n
validation_state=\'validated\',\n
where_expression="related_predecessor_title_1_catalog.title <>
catalog.title",\n
predecessor_title=NegatedQuery(SimpleQuery(predecessor_title=None, comparison_operator=\'is\')),\n
method_id=\'HostingSubscription_assertPredecessor\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectDestroyedRootTree.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
[
"Slave Instance"
,
"Software Instance"
],
validation_state
=
"validated"
,
specialise_validation_state
=
"archived"
,
method_id
=
'Instance_tryToGarbageCollect'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectDestroyedRootTree.xml
View file @
f449cb6c
...
@@ -48,21 +48,6 @@
...
@@ -48,21 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type=["Slave Instance", "Software Instance"],\n
validation_state="validated",\n
specialise_validation_state="archived",\n
method_id=\'Instance_tryToGarbageCollect\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectNonAllocatedRootTree.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
select_dict
=
{
'default_aggregate_uid'
:
None
}
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
(
'Slave Instance'
,
'Software Instance'
),
validation_state
=
'validated'
,
default_aggregate_uid
=
None
,
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
method_id
=
'Instance_tryToGarbageCollectNonAllocatedRootTree'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_garbageCollectNonAllocatedRootTree.xml
View file @
f449cb6c
...
@@ -48,24 +48,6 @@
...
@@ -48,24 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
select_dict= {\'default_aggregate_uid\': None}\n
portal.portal_catalog.searchAndActivate(\n
portal_type=(\'Slave Instance\', \'Software Instance\'),\n
validation_state=\'validated\',\n
default_aggregate_uid=None,\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
\n
method_id=\'Instance_tryToGarbageCollectNonAllocatedRootTree\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_invalidateDestroyedInstance.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
select_dict
=
{
'default_aggregate_uid'
:
None
}
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
(
'Slave Instance'
,
'Software Instance'
),
validation_state
=
'validated'
,
default_aggregate_uid
=
None
,
select_dict
=
select_dict
,
left_join_list
=
select_dict
.
keys
(),
method_id
=
'SoftwareInstance_tryToInvalidateIfDestroyed'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_invalidateDestroyedInstance.xml
View file @
f449cb6c
...
@@ -48,24 +48,6 @@
...
@@ -48,24 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
select_dict= {\'default_aggregate_uid\': None}\n
portal.portal_catalog.searchAndActivate(\n
portal_type=(\'Slave Instance\', \'Software Instance\'),\n
validation_state=\'validated\',\n
default_aggregate_uid=None,\n
select_dict=select_dict,\n
left_join_list=select_dict.keys(),\n
\n
method_id=\'SoftwareInstance_tryToInvalidateIfDestroyed\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_managePublicComputerCapacityScope.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
category
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/public"
,
None
)
if
category
is
not
None
:
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Computer'
,
default_allocation_scope_uid
=
category
.
getUid
(),
validation_state
=
"validated"
,
method_id
=
'Computer_checkAndUpdateCapacityScope'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_managePublicComputerCapacityScope.xml
View file @
f449cb6c
...
@@ -48,22 +48,6 @@
...
@@ -48,22 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
category = portal.restrictedTraverse("portal_categories/allocation_scope/open/public", None)\n
if category is not None:\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Computer\',\n
default_allocation_scope_uid=category.getUid(),\n
validation_state="validated",\n
method_id=\'Computer_checkAndUpdateCapacityScope\',\n
activate_kw={\'tag\': tag}\n
)\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_searchComputerPartitionAndMarkFree.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
default_aggregate_relative_url
=
"computer_module/%/%"
,
validation_state
=
"invalidated"
,
method_id
=
'Instance_tryToUnallocatePartition'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_searchComputerPartitionAndMarkFree.xml
View file @
f449cb6c
...
@@ -48,21 +48,6 @@
...
@@ -48,21 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type=["Software Instance", "Slave Instance"],\n
default_aggregate_relative_url="computer_module/%/%",\n
validation_state="invalidated",\n
method_id=\'Instance_tryToUnallocatePartition\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_stopCollectInstance.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
[
"Slave Instance"
,
"Software Instance"
],
validation_state
=
"validated"
,
specialise_validation_state
=
"validated"
,
method_id
=
'Instance_tryToStopCollect'
,
activate_kw
=
{
'tag'
:
tag
}
)
context
.
activate
(
after_tag
=
tag
).
getId
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Alarm_stopCollectInstance.xml
View file @
f449cb6c
...
@@ -48,21 +48,6 @@
...
@@ -48,21 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
\n
portal.portal_catalog.searchAndActivate(\n
portal_type=["Slave Instance", "Software Instance"],\n
validation_state="validated",\n
specialise_validation_state="validated",\n
method_id=\'Instance_tryToStopCollect\',\n
activate_kw={\'tag\': tag}\n
)\n
\n
context.activate(after_tag=tag).getId()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit, params
</string>
</value>
<value>
<string>
tag, fixit, params
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseStateOnComputer.py
0 → 100644
View file @
f449cb6c
computer
=
context
.
REQUEST
.
get
(
'here'
)
software_release
=
context
return
computer
.
Computer_getSoftwareReleaseState
(
software_release
.
getUid
())
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseStateOnComputer.xml
View file @
f449cb6c
...
@@ -48,14 +48,6 @@
...
@@ -48,14 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = context.REQUEST.get(\'here\')\n
software_release = context\n
\n
return computer.Computer_getSoftwareReleaseState(software_release.getUid())\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kwargs
</string>
</value>
<value>
<string>
*args, **kwargs
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseUsageOnComputer.py
0 → 100644
View file @
f449cb6c
current
=
context
.
REQUEST
.
get
(
'here'
)
if
current
.
getPortalType
()
==
'Software Release'
:
software_release
=
current
computer
=
context
else
:
computer
=
current
software_release
=
context
return
computer
.
Computer_getSoftwareReleaseUsage
(
software_release
.
getUid
())
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSoftwareReleaseUsageOnComputer.xml
View file @
f449cb6c
...
@@ -48,19 +48,6 @@
...
@@ -48,19 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
current = context.REQUEST.get(\'here\')\n
if current.getPortalType() == \'Software Release\': \n
software_release = current\n
computer = context\n
else:\n
computer = current\n
software_release = context\n
\n
return computer.Computer_getSoftwareReleaseUsage(software_release.getUid())\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kwargs
</string>
</value>
<value>
<string>
*args, **kwargs
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getReleatedSoftwareRelease.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
network
=
context
computter_list_uid
=
[
x
.
getUid
()
for
x
in
network
.
getSubordinationRelatedValueList
()]
kw
[
'portal_type'
]
=
'Software Installation'
kw
[
'validation_state'
]
=
'validated'
kw
[
'default_aggregate_uid'
]
=
computter_list_uid
return
portal
.
portal_catalog
(
**
kw
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getReleatedSoftwareRelease.xml
View file @
f449cb6c
...
@@ -48,19 +48,6 @@
...
@@ -48,19 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
network = context\n
\n
computter_list_uid = [x.getUid() for x in network.getSubordinationRelatedValueList()]\n
kw[\'portal_type\']=\'Software Installation\'\n
kw[\'validation_state\']=\'validated\'\n
kw[\'default_aggregate_uid\']=computter_list_uid\n
\n
return portal.portal_catalog(**kw)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareInstanceAmount.py
0 → 100644
View file @
f449cb6c
network
=
context
portal
=
context
.
getPortalObject
()
software_release
=
context
.
REQUEST
.
get
(
'here'
)
computer_uid_list
=
[
x
.
getUid
()
for
x
in
context
.
getSubordinationRelatedValueList
()]
return
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Computer Partition'
,
parent_uid
=
computer_uid_list
,
free_for_request
=
0
,
software_release_url
=
software_release
.
getUrlString
()
)[
0
][
0
]
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareInstanceAmount.xml
View file @
f449cb6c
...
@@ -48,22 +48,6 @@
...
@@ -48,22 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
network = context\n
portal = context.getPortalObject()\n
software_release = context.REQUEST.get(\'here\')\n
\n
computer_uid_list = [x.getUid() for x in context.getSubordinationRelatedValueList()]\n
\n
return portal.portal_catalog.countResults(\n
portal_type=\'Computer Partition\',\n
parent_uid=computer_uid_list,\n
free_for_request=0,\n
software_release_url=software_release.getUrlString()\n
)[0][0]\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
*args, **kwargs
</string>
</value>
<value>
<string>
*args, **kwargs
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseAllocableState.py
0 → 100644
View file @
f449cb6c
network
=
context
# XXX - The use of current authenticated person will return always 'Close' if
# the person is administrator (such as 'zope' user) but not the owner of computer
#
# person = context.ERP5Site_getAuthenticatedMemberPersonValue()
allocation_state
=
'Close'
software_type
=
''
filter_kw
=
{}
for
computer
in
network
.
getSubordinationRelatedValueList
():
person
=
computer
.
getSourceAdministrationValue
()
filter_kw
[
'computer_guid'
]
=
computer
.
getReference
()
try
:
isAllowed
=
person
.
Person_restrictMethodAsShadowUser
(
shadow_document
=
person
,
callable_object
=
person
.
Person_findPartition
,
argument_list
=
[
software_release_url
,
software_type
,
'Software Instance'
,
filter_kw
],
argument_dict
=
{
'test_mode'
:
True
}
)
if
isAllowed
:
allocation_state
=
'Open'
break
except
:
continue
return
allocation_state
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseAllocableState.xml
View file @
f449cb6c
...
@@ -48,37 +48,6 @@
...
@@ -48,37 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
network = context\n
\n
# XXX - The use of current authenticated person will return always \'Close\' if \n
# the person is administrator (such as \'zope\' user) but not the owner of computer\n
# \n
# person = context.ERP5Site_getAuthenticatedMemberPersonValue()\n
allocation_state = \'Close\'\n
software_type = \'\'\n
filter_kw = {}\n
\n
for computer in network.getSubordinationRelatedValueList():\n
person = computer.getSourceAdministrationValue()\n
filter_kw[\'computer_guid\']=computer.getReference()\n
try:\n
isAllowed = person.Person_restrictMethodAsShadowUser(shadow_document=person,\n
callable_object=person.Person_findPartition,\n
argument_list=[software_release_url, software_type, \'Software Instance\',\n
filter_kw], \n
argument_dict={\'test_mode\': True}\n
)\n
if isAllowed:\n
allocation_state = \'Open\'\n
break\n
except:\n
continue\n
\n
return allocation_state\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_url
</string>
</value>
<value>
<string>
software_release_url
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseUrl.py
0 → 100644
View file @
f449cb6c
software_installation
=
context
portal
=
context
.
getPortalObject
()
url_string
=
""
software_release
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Release'
,
url_string
=
software_installation
.
getUrlString
()
)
if
software_release
:
url_string
=
"%s?editable_mode:int=1"
%
software_release
.
getAbsoluteUrl
()
return
url_string
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerNetwork_getSoftwareReleaseUrl.xml
View file @
f449cb6c
...
@@ -48,22 +48,6 @@
...
@@ -48,22 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
software_installation = context\n
portal = context.getPortalObject()\n
\n
url_string = ""\n
software_release = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
url_string=software_installation.getUrlString()\n
)\n
if software_release:\n
url_string = "%s?editable_mode:int=1" % software_release.getAbsoluteUrl()\n
\n
return url_string\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.py
0 → 100644
View file @
f449cb6c
slap_state
=
context
.
getSlapState
()
portal
=
context
.
getPortalObject
()
portal_preferences
=
portal
.
portal_preferences
if
slap_state
==
'free'
:
computer
=
context
.
getParentValue
()
return
computer
.
Computer_getSoftwareReleaseUrlStringList
()
elif
slap_state
==
'busy'
:
instance
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Software Instance"
,
validation_state
=
"validated"
,
default_aggregate_uid
=
context
.
getUid
(),
)
if
(
instance
is
None
)
or
(
instance
.
getSlapState
()
!=
"start_requested"
):
return
[]
else
:
return
[
instance
.
getUrlString
()]
else
:
return
[]
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.xml
View file @
f449cb6c
...
@@ -48,32 +48,6 @@
...
@@ -48,32 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
slap_state = context.getSlapState()\n
portal = context.getPortalObject()\n
portal_preferences = portal.portal_preferences\n
\n
if slap_state == \'free\':\n
computer = context.getParentValue()\n
return computer.Computer_getSoftwareReleaseUrlStringList()\n
\n
elif slap_state == \'busy\':\n
\n
instance = portal.portal_catalog.getResultValue(\n
portal_type="Software Instance",\n
validation_state="validated",\n
default_aggregate_uid=context.getUid(),\n
)\n
if (instance is None) or (instance.getSlapState() != "start_requested"):\n
return []\n
else:\n
return [instance.getUrlString()]\n
\n
else:\n
return []\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getCustomAllocationParameterDict.py
0 → 100644
View file @
f449cb6c
query_kw
=
dict
()
return
query_kw
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getCustomAllocationParameterDict.xml
View file @
f449cb6c
...
@@ -48,13 +48,6 @@
...
@@ -48,13 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
query_kw = dict()\n
\n
return query_kw\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, test_mode=False
</string>
</value>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, test_mode=False
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getInstanceUrlString.py
0 → 100644
View file @
f449cb6c
partition
=
context
software_instance_list
=
partition
.
getAggregateRelatedValueList
(
portal_type
=
[
"Software Instance"
])
for
si
in
software_instance_list
:
obj
=
si
.
getObject
()
return
"%s?editable_mode:int=1"
%
obj
.
getRelativeUrl
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getInstanceUrlString.xml
View file @
f449cb6c
...
@@ -48,16 +48,6 @@
...
@@ -48,16 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
partition = context\n
\n
software_instance_list = partition.getAggregateRelatedValueList(portal_type=["Software Instance"])\n
for si in software_instance_list:\n
obj = si.getObject()\n
return "%s?editable_mode:int=1" % obj.getRelativeUrl()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getLastestContactedDate.py
0 → 100644
View file @
f449cb6c
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
import
json
partition
=
context
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
result
=
""
date
=
None
for
si
in
partition
.
getAggregateRelatedValueList
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
]):
obj
=
si
.
getObject
()
if
obj
.
getValidationState
()
!=
"validated"
:
continue
if
obj
.
getSlapState
()
==
"destroy_requested"
:
continue
try
:
d
=
memcached_dict
[
obj
.
getReference
()]
except
KeyError
:
result
=
"#missing no data found for %s"
%
obj
.
getReference
()
else
:
d
=
json
.
loads
(
d
)
date
=
DateTime
(
d
[
'created_at'
])
result
=
date
.
strftime
(
'%Y/%m/%d %H:%M'
)
return
result
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getLastestContactedDate.xml
View file @
f449cb6c
...
@@ -48,40 +48,6 @@
...
@@ -48,40 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
portal = context.getPortalObject()\n
import json\n
\n
partition = context\n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
key_prefix=\'slap_tool\',\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
\n
result = ""\n
date = None\n
\n
for si in partition.getAggregateRelatedValueList(portal_type=["Software Instance", "Slave Instance"]):\n
obj = si.getObject() \n
\n
if obj.getValidationState() != "validated":\n
continue\n
if obj.getSlapState() == "destroy_requested":\n
continue\n
\n
try:\n
d = memcached_dict[obj.getReference()]\n
except KeyError:\n
result = "#missing no data found for %s" % obj.getReference()\n
else:\n
d = json.loads(d)\n
date = DateTime(d[\'created_at\'])\n
result = date.strftime(\'%Y/%m/%d %H:%M\')\n
\n
return result\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getOwnerAsHtml.py
0 → 100644
View file @
f449cb6c
partition
=
context
si
=
partition
.
getAggregateRelatedValue
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
])
if
si
:
person
=
si
.
getSpecialiseValue
().
getDestinationSectionValue
()
return
'<a href="%s?editable_mode:int=1">%s</a>'
%
(
person
.
getRelativeUrl
(),
person
.
getTitle
())
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getOwnerAsHtml.xml
View file @
f449cb6c
...
@@ -48,20 +48,6 @@
...
@@ -48,20 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
partition = context\n
\n
si = partition.getAggregateRelatedValue(portal_type=["Software Instance", "Slave Instance"])\n
if si:\n
person = si.getSpecialiseValue().getDestinationSectionValue()\n
return \'<a href="%s?editable_mode:int=1">
%s
</a>
\' % (person.getRelativeUrl(), person.getTitle())\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedImageAbsoluteUrl.py
0 → 100644
View file @
f449cb6c
partition
=
context
portal
=
context
.
getPortalObject
()
image_url
=
""
software_instance
=
partition
.
getAggregateRelatedValue
(
portal_type
=
"Software Instance"
)
release
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Software Release"
,
url_string
=
software_instance
.
getUrlString
(),
)
if
release
is
not
None
:
software_product
=
release
.
getAggregateValue
()
image_url
=
'%s/index_html'
%
software_product
.
getDefaultImageAbsoluteUrl
()
return
image_url
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedImageAbsoluteUrl.xml
View file @
f449cb6c
...
@@ -48,25 +48,6 @@
...
@@ -48,25 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
partition = context\n
portal = context.getPortalObject()\n
image_url = ""\n
\n
software_instance = partition.getAggregateRelatedValue(portal_type="Software Instance")\n
\n
release = portal.portal_catalog.getResultValue(\n
portal_type="Software Release",\n
url_string=software_instance.getUrlString(),\n
)\n
if release is not None:\n
software_product = release.getAggregateValue()\n
image_url = \'%s/index_html\' % software_product.getDefaultImageAbsoluteUrl()\n
\n
return image_url\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedInstanceCreationDate.py
0 → 100644
View file @
f449cb6c
from
DateTime
import
DateTime
partition
=
context
software_instance
=
partition
.
getAggregateRelatedValueList
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
])[
0
].
getObject
()
date
=
DateTime
(
software_instance
.
getCreationDate
())
return
date
.
strftime
(
'%Y/%m/%d %H:%M'
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getRelatedInstanceCreationDate.xml
View file @
f449cb6c
...
@@ -48,17 +48,6 @@
...
@@ -48,17 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
\n
partition = context\n
\n
software_instance = partition.getAggregateRelatedValueList(portal_type=["Software Instance", "Slave Instance"])[0].getObject()\n
date = DateTime(software_instance.getCreationDate())\n
return date.strftime(\'%Y/%m/%d %H:%M\')\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareInstanceStatus.py
0 → 100644
View file @
f449cb6c
software_instance
=
context
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
status
=
""
state
=
'green'
if
software_instance
is
not
None
:
status
=
software_instance
.
SoftwareInstance_getCurrentStatus
()
if
status
.
startswith
(
'#error '
):
state
=
"red"
return
'<a href="%s" style="background-color: %s; display: block; height: 2em; width: 2em; float: left; margin: 5px;"></a> '
\
'<p style="float: left; line-height: 10px; margin-left: 10px;">%s</p>'
%
(
software_instance
.
getUrl
(),
state
,
status
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareInstanceStatus.xml
View file @
f449cb6c
...
@@ -48,27 +48,6 @@
...
@@ -48,27 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
software_instance = context.getAggregateRelatedValue(portal_type=\'Software Instance\')\n
\n
status = ""\n
state = \'green\'\n
if software_instance is not None:\n
status = software_instance.SoftwareInstance_getCurrentStatus()\n
\n
if status.startswith(\'#error \'):\n
state = "red"\n
\n
return \'<a href="%s" style="background-color: %s; display: block; height: 2em; width: 2em; float: left; margin: 5px;">
</a>
\' \\\n
\'
<p
style=
"float: left; line-height: 10px; margin-left: 10px;"
>
%s
</p>
\' % (\n
software_instance.getUrl(), state, status)\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareType.py
0 → 100644
View file @
f449cb6c
instance
=
context
.
getPortalObject
().
portal_catalog
.
getResultValue
(
portal_type
=
"Software Instance"
,
validation_state
=
"validated"
,
default_aggregate_uid
=
context
.
getUid
(),
)
if
(
instance
is
None
)
or
(
instance
.
getSlapState
()
!=
"start_requested"
):
return
""
else
:
return
instance
.
getSourceReference
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getSoftwareType.xml
View file @
f449cb6c
...
@@ -48,19 +48,6 @@
...
@@ -48,19 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = context.getPortalObject().portal_catalog.getResultValue(\n
portal_type="Software Instance",\n
validation_state="validated",\n
default_aggregate_uid=context.getUid(),\n
)\n
if (instance is None) or (instance.getSlapState() != "start_requested"):\n
return ""\n
else:\n
return instance.getSourceReference()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getUsageReportUrl.py
0 → 100644
View file @
f449cb6c
return
context
.
absolute_url
()
+
'/Item_viewTrackingList?current:int=0'
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_getUsageReportUrl.xml
View file @
f449cb6c
...
@@ -48,11 +48,6 @@
...
@@ -48,11 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return context.absolute_url() + \'/Item_viewTrackingList?current:int=0\'\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_isFreeForRequest.py
0 → 100644
View file @
f449cb6c
if
context
.
getPortalObject
().
portal_workflow
.
isTransitionPossible
(
context
,
'mark_busy'
)
and
context
.
getParentValue
().
isMemberOf
(
'allocation_scope/open'
):
return
1
return
0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/ComputerPartition_isFreeForRequest.xml
View file @
f449cb6c
...
@@ -48,13 +48,6 @@
...
@@ -48,13 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getPortalObject().portal_workflow.isTransitionPossible(context, \'mark_busy\') and context.getParentValue().isMemberOf(\'allocation_scope/open\'):\n
return 1\n
return 0\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_applyComputerModel.py
0 → 100644
View file @
f449cb6c
computer
=
context
Base_translateString
=
context
.
Base_translateString
computer_model_portal_type
=
'Computer Model'
computer_model
=
computer
.
getSpecialiseValue
(
portal_type
=
computer_model_portal_type
)
if
computer_model
is
None
:
message
=
Base_translateString
(
'No Computer Model.'
)
result
=
False
else
:
category_list
=
[
'cpu_core'
,
'cpu_frequency'
,
'cpu_type'
,
'function'
,
'group'
,
'local_area_network_type'
,
'memory_size'
,
'memory_type'
,
'role'
,
'region'
,
'storage_capacity'
,
'storage_interface'
,
'storage_redundancy'
,
'wide_area_network_type'
,
]
property_list
=
[
'capacity_quantity'
]
new_category_dict
=
{}
for
category
in
category_list
:
if
force
or
not
computer
.
getPropertyList
(
category
):
v
=
computer_model
.
getPropertyList
(
category
)
if
v
:
new_category_dict
[
category
]
=
v
for
property
in
property_list
:
if
force
or
not
computer
.
getProperty
(
property
):
v
=
computer_model
.
getProperty
(
property
)
if
v
:
new_category_dict
[
property
]
=
v
if
new_category_dict
:
computer
.
edit
(
**
new_category_dict
)
message
=
Base_translateString
(
'Computer Model applied.'
)
result
=
True
else
:
message
=
Base_translateString
(
'No changes applied.'
)
result
=
False
if
not
batch_mode
:
return
context
.
Base_redirect
(
form_id
,
keep_items
=
dict
(
portal_status_message
=
message
))
else
:
return
result
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_applyComputerModel.xml
View file @
f449cb6c
...
@@ -48,68 +48,6 @@
...
@@ -48,68 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = context\n
Base_translateString = context.Base_translateString\n
computer_model_portal_type = \'Computer Model\'\n
\n
computer_model = computer.getSpecialiseValue(\n
portal_type=computer_model_portal_type)\n
\n
if computer_model is None:\n
message = Base_translateString(\'No Computer Model.\')\n
result = False\n
else :\n
category_list = [\n
\'cpu_core\',\n
\'cpu_frequency\',\n
\'cpu_type\',\n
\'function\',\n
\'group\',\n
\'local_area_network_type\',\n
\'memory_size\',\n
\'memory_type\',\n
\'role\',\n
\'region\',\n
\'storage_capacity\',\n
\'storage_interface\',\n
\'storage_redundancy\',\n
\'wide_area_network_type\',\n
]\n
\n
property_list = [\n
\'capacity_quantity\'\n
]\n
\n
new_category_dict = {}\n
for category in category_list:\n
if force or not computer.getPropertyList(category):\n
v = computer_model.getPropertyList(category)\n
if v:\n
new_category_dict[category] = v\n
\n
for property in property_list:\n
if force or not computer.getProperty(property):\n
v = computer_model.getProperty(property)\n
if v:\n
new_category_dict[property] = v\n
\n
if new_category_dict:\n
computer.edit(**new_category_dict)\n
message = Base_translateString(\'Computer Model applied.\')\n
result = True\n
else:\n
message = Base_translateString(\'No changes applied.\')\n
result = False\n
\n
if not batch_mode:\n
return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=message))\n
else:\n
return result\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id=\'view\', batch_mode=0, force=0
</string>
</value>
<value>
<string>
form_id=\'view\', batch_mode=0, force=0
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkAndUpdateCapacityScope.py
0 → 100644
View file @
f449cb6c
import
json
computer
=
context
portal
=
context
.
getPortalObject
()
if
computer
.
getAllocationScope
()
!=
'open/public'
:
# Don't update non public computer
return
can_allocate
=
True
comment
=
''
# First and simple way to see if computer is dead
# modification_date = portal.portal_workflow.getInfoFor(computer, 'time', wf_id='edit_workflow')
# if (DateTime() - modification_date) > 1:
# # Computer didn't talk to vifib for 1 days, do not consider it as a trustable public server for now
# # slapformat is supposed to run at least once per day
# can_allocate = False
# comment = "Computer didn't contact the server for more than one day"
if
can_allocate
:
# Check if computer has error reported
memcached_dict
=
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
try
:
d
=
memcached_dict
[
computer
.
getReference
()]
except
KeyError
:
can_allocate
=
False
comment
=
"Computer didn't contact the server"
else
:
log_dict
=
json
.
loads
(
d
)
if
'#error'
in
log_dict
.
get
(
'text'
,
'#error'
):
can_allocate
=
False
comment
=
'Computer reported an error'
# XXX TODO: compare creation date of #ok message
elif
int
(
DateTime
())
-
int
(
DateTime
(
log_dict
.
get
(
'created_at'
)))
>
600
:
can_allocate
=
False
comment
=
"Computer didn't contact for more than 10 minutes"
if
can_allocate
:
# Check the computer capacity.
# there is a arbitrary hardcoded default value: not more than 1000000 (!) instances on
# a computer.
default_maximum_value
=
1000000
computer_capacity_quantity
=
computer
.
getCapacityQuantity
(
default_maximum_value
)
if
computer_capacity_quantity
==
default_maximum_value
:
# Verify if Computer Model defines it:
computer_model
=
computer
.
getSpecialiseValue
(
portal_type
=
'Computer Model'
)
if
computer_model
is
not
None
:
computer_capacity_quantity
=
computer_model
.
getCapacityQuantity
(
default_maximum_value
)
# The update the computer with the initial value.
if
computer_capacity_quantity
!=
default_maximum_value
:
computer
.
edit
(
capacity_quantity
=
computer_capacity_quantity
)
software_release_capacity_dict
=
{}
consumed_capacity
=
0
for
instance
in
portal
.
portal_catalog
.
portal_catalog
(
default_aggregate_relative_url
=
'%s/%%'
%
computer
.
getRelativeUrl
(),
portal_type
=
[
'Software Instance'
,
'Slave Instance'
],
validation_state
=
'validated'
):
instance
=
instance
.
getObject
()
software_release_url
=
instance
.
getUrlString
()
if
software_release_url
in
software_release_capacity_dict
:
software_release_capacity
=
software_release_capacity_dict
[
software_release_url
]
else
:
software_release
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Release'
,
url_string
=
{
'query'
:
software_release_url
,
'key'
:
'ExactMatch'
})
if
software_release
is
not
None
:
software_release_capacity
=
software_release
.
getCapacityQuantity
(
1
)
else
:
software_release_capacity
=
1
software_release_capacity_dict
[
software_release_url
]
=
software_release_capacity
consumed_capacity
+=
software_release_capacity
if
consumed_capacity
>=
computer_capacity_quantity
:
can_allocate
=
False
comment
=
'Computer capacity limit exceeded'
break
# if can_allocate:
# result_list = portal.portal_catalog.portal_catalog(
# parent_uid=computer.getUid(),
# portal_type='Computer Partition',
# free_for_request=1,
# limit=1)
# if len(result_list) == 0:
# can_allocate = False
# comment = 'No free partition left'
new_value
=
None
if
can_allocate
:
if
computer
.
getCapacityScope
()
==
'close'
:
new_value
=
'open'
else
:
if
computer
.
getCapacityScope
()
==
'open'
:
new_value
=
'close'
if
new_value
is
not
None
:
computer
.
edit
(
capacity_scope
=
new_value
)
if
comment
:
portal
.
portal_workflow
.
doActionFor
(
computer
,
'edit_action'
,
comment
=
comment
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkAndUpdateCapacityScope.xml
View file @
f449cb6c
...
@@ -48,119 +48,6 @@
...
@@ -48,119 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
import json\n
computer = context\n
portal = context.getPortalObject()\n
\n
if computer.getAllocationScope() != \'open/public\':\n
# Don\'t update non public computer\n
return\n
\n
can_allocate = True\n
comment = \'\'\n
\n
# First and simple way to see if computer is dead\n
# modification_date = portal.portal_workflow.getInfoFor(computer, \'time\', wf_id=\'edit_workflow\')\n
# if (DateTime() - modification_date) >
1:\n
# # Computer didn\'t talk to vifib for 1 days, do not consider it as a trustable public server for now\n
# # slapformat is supposed to run at least once per day\n
# can_allocate = False\n
# comment = "Computer didn\'t contact the server for more than one day"\n
\n
if can_allocate:\n
# Check if computer has error reported\n
memcached_dict = portal.portal_memcached.getMemcachedDict(\n
key_prefix=\'slap_tool\',\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
try:\n
d = memcached_dict[computer.getReference()]\n
except KeyError:\n
can_allocate = False\n
comment = "Computer didn\'t contact the server"\n
else:\n
log_dict = json.loads(d)\n
if \'#error\' in log_dict.get(\'text\', \'#error\'):\n
can_allocate = False\n
comment = \'Computer reported an error\'\n
# XXX TODO: compare creation date of #ok message\n
elif int(DateTime()) - int(DateTime(log_dict.get(\'created_at\'))) > 600:\n
can_allocate = False\n
comment = "Computer didn\'t contact for more than 10 minutes"\n
\n
if can_allocate:\n
# Check the computer capacity.\n
# there is a arbitrary hardcoded default value: not more than 1000000 (!) instances on\n
# a computer.\n
default_maximum_value = 1000000\n
computer_capacity_quantity = computer.getCapacityQuantity(default_maximum_value)\n
if computer_capacity_quantity == default_maximum_value:\n
# Verify if Computer Model defines it:\n
computer_model = computer.getSpecialiseValue(portal_type=\'Computer Model\')\n
if computer_model is not None:\n
computer_capacity_quantity = computer_model.getCapacityQuantity(default_maximum_value)\n
\n
# The update the computer with the initial value.\n
if computer_capacity_quantity != default_maximum_value:\n
computer.edit(capacity_quantity=computer_capacity_quantity)\n
\n
software_release_capacity_dict = {}\n
consumed_capacity = 0\n
\n
for instance in portal.portal_catalog.portal_catalog(\n
default_aggregate_relative_url=\'%s/%%\' % computer.getRelativeUrl(),\n
portal_type=[\'Software Instance\', \'Slave Instance\'],\n
validation_state=\'validated\'):\n
\n
instance = instance.getObject()\n
\n
software_release_url = instance.getUrlString()\n
if software_release_url in software_release_capacity_dict:\n
software_release_capacity = software_release_capacity_dict[software_release_url]\n
else:\n
software_release = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
url_string={\'query\': software_release_url, \'key\': \'ExactMatch\'})\n
if software_release is not None:\n
software_release_capacity = software_release.getCapacityQuantity(1)\n
else:\n
software_release_capacity = 1\n
software_release_capacity_dict[software_release_url] = software_release_capacity\n
consumed_capacity += software_release_capacity\n
if consumed_capacity >= computer_capacity_quantity:\n
can_allocate = False\n
comment = \'Computer capacity limit exceeded\'\n
break\n
\n
# if can_allocate:\n
# result_list = portal.portal_catalog.portal_catalog(\n
# parent_uid=computer.getUid(),\n
# portal_type=\'Computer Partition\',\n
# free_for_request=1,\n
# limit=1)\n
# if len(result_list) == 0:\n
# can_allocate = False\n
# comment = \'No free partition left\'\n
\n
new_value = None\n
if can_allocate:\n
if computer.getCapacityScope() == \'close\':\n
new_value = \'open\'\n
else:\n
if computer.getCapacityScope() == \'open\':\n
new_value = \'close\'\n
\n
if new_value is not None:\n
computer.edit(capacity_scope=new_value)\n
if comment:\n
portal.portal_workflow.doActionFor(computer, \'edit_action\', comment=comment)\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getBusyComputerPartitionList.py
0 → 100644
View file @
f449cb6c
return
[
x
for
x
in
context
.
contentValues
(
**
kw
)
if
x
.
getSlapState
()
==
'busy'
]
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getBusyComputerPartitionList.xml
View file @
f449cb6c
...
@@ -48,11 +48,6 @@
...
@@ -48,11 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return [x for x in context.contentValues(**kw) if x.getSlapState() == \'busy\']\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseList.py
0 → 100644
View file @
f449cb6c
"""Fetch computer to find witch software is installed"""
portal
=
context
.
getPortalObject
()
portal_type
=
"Software Release"
url_string_list
=
context
.
Computer_getSoftwareReleaseUrlStringList
()
if
url_string_list
:
return
context
.
portal_catalog
(
portal_type
=
portal_type
,
url_string
=
url_string_list
)
else
:
return
[]
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseList.xml
View file @
f449cb6c
...
@@ -48,21 +48,6 @@
...
@@ -48,21 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""Fetch computer to find witch software is installed"""\n
portal = context.getPortalObject()\n
portal_type = "Software Release"\n
\n
url_string_list = context.Computer_getSoftwareReleaseUrlStringList()\n
if url_string_list:\n
return context.portal_catalog(\n
portal_type=portal_type,\n
url_string=url_string_list)\n
else:\n
return []\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseState.py
0 → 100644
View file @
f449cb6c
computer
=
context
portal
=
context
.
getPortalObject
()
software_installation_list
=
portal
.
portal_catalog
(
portal_type
=
'Software Installation'
,
default_aggregate_uid
=
context
.
getUid
(),
validation_state
=
'validated'
,
limit
=
1
,
url_string
=
{
'query'
:
portal
.
portal_catalog
.
getResultValue
(
uid
=
software_release_uid
).
getUrlString
(),
'key'
:
'ExactMatch'
},
sort_on
=
((
'creation_date'
,
'DESC'
),)
)
if
len
(
software_installation_list
)
==
0
:
return
'Destroyed'
software_installation
=
software_installation_list
[
0
].
getObject
()
s
=
software_installation
.
getSlapState
()
if
s
==
'start_requested'
:
return
'Installation requested'
else
:
return
'Destruction requested'
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseState.xml
View file @
f449cb6c
...
@@ -48,32 +48,6 @@
...
@@ -48,32 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = context\n
portal = context.getPortalObject()\n
\n
software_installation_list = portal.portal_catalog(\n
portal_type=\'Software Installation\',\n
default_aggregate_uid=context.getUid(),\n
validation_state=\'validated\',\n
limit=1,\n
url_string={\'query\': portal.portal_catalog.getResultValue(uid=software_release_uid).getUrlString(), \'key\': \'ExactMatch\'},\n
sort_on=((\'creation_date\', \'DESC\'),)\n
)\n
\n
if len(software_installation_list) == 0:\n
return \'Destroyed\' \n
\n
software_installation = software_installation_list[0].getObject()\n
\n
s = software_installation.getSlapState()\n
if s == \'start_requested\':\n
return \'Installation requested\'\n
else:\n
return \'Destruction requested\'\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_uid
</string>
</value>
<value>
<string>
software_release_uid
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUrlStringList.py
0 → 100644
View file @
f449cb6c
url_string_list
=
[]
for
software_installation
in
context
.
getPortalObject
().
portal_catalog
(
portal_type
=
'Software Installation'
,
validation_state
=
'validated'
,
default_aggregate_uid
=
context
.
getUid
()
):
if
software_installation
.
getSlapState
()
==
'start_requested'
:
url_string
=
software_installation
.
getUrlString
()
if
url_string
:
url_string_list
.
append
(
url_string
)
return
url_string_list
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUrlStringList.xml
View file @
f449cb6c
...
@@ -48,21 +48,6 @@
...
@@ -48,21 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
url_string_list = []\n
for software_installation in context.getPortalObject().portal_catalog(\n
portal_type=\'Software Installation\',\n
validation_state=\'validated\',\n
default_aggregate_uid=context.getUid()\n
):\n
if software_installation.getSlapState() == \'start_requested\':\n
url_string = software_installation.getUrlString()\n
if url_string:\n
url_string_list.append(url_string)\n
return url_string_list\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUsage.py
0 → 100644
View file @
f449cb6c
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
ComplexQuery
portal
=
context
.
getPortalObject
()
computer
=
context
return
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Computer Partition'
,
parent_uid
=
computer
.
getUid
(),
free_for_request
=
0
,
software_release_url
=
portal
.
portal_catalog
.
getResultValue
(
uid
=
software_release_uid
).
getUrlString
()
)[
0
][
0
]
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getSoftwareReleaseUsage.xml
View file @
f449cb6c
...
@@ -48,21 +48,6 @@
...
@@ -48,21 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
portal = context.getPortalObject()\n
\n
computer = context\n
\n
return portal.portal_catalog.countResults(\n
portal_type=\'Computer Partition\',\n
parent_uid=computer.getUid(),\n
free_for_request=0,\n
software_release_url=portal.portal_catalog.getResultValue(uid=software_release_uid).getUrlString()\n
)[0][0]\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_uid
</string>
</value>
<value>
<string>
software_release_uid
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getUsageReportUrl.py
0 → 100644
View file @
f449cb6c
return
context
.
absolute_url
()
+
'/Computer_viewCurrentUsage'
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_getUsageReportUrl.xml
View file @
f449cb6c
...
@@ -48,11 +48,6 @@
...
@@ -48,11 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return context.absolute_url() + \'/Computer_viewCurrentUsage\'\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/HostingSubscription_assertPredecessor.py
0 → 100644
View file @
f449cb6c
if
context
.
getPortalType
()
!=
'Hosting Subscription'
\
or
context
.
getValidationState
()
!=
'validated'
\
or
context
.
getSlapState
()
not
in
[
'start_requested'
,
'stop_requested'
]
\
or
context
.
getTitle
()
in
context
.
getPredecessorTitleList
():
# nothing to do
return
context
.
requestInstance
(
software_release
=
context
.
getUrlString
(),
software_title
=
context
.
getTitle
(),
software_type
=
context
.
getSourceReference
(),
instance_xml
=
context
.
getTextContent
(),
sla_xml
=
context
.
getSlaXml
(),
shared
=
context
.
isRootSlave
(),
state
=
{
'start_requested'
:
'started'
,
'stop_requested'
:
'stopped'
}[
context
.
getSlapState
()],
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/HostingSubscription_assertPredecessor.xml
View file @
f449cb6c
...
@@ -48,26 +48,6 @@
...
@@ -48,26 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if context.getPortalType() != \'Hosting Subscription\' \\\n
or context.getValidationState() != \'validated\' \\\n
or context.getSlapState() not in [\'start_requested\', \'stop_requested\'] \\\n
or context.getTitle() in context.getPredecessorTitleList():\n
# nothing to do\n
return\n
\n
context.requestInstance(\n
software_release=context.getUrlString(),\n
software_title=context.getTitle(),\n
software_type=context.getSourceReference(),\n
instance_xml=context.getTextContent(),\n
sla_xml=context.getSlaXml(),\n
shared=context.isRootSlave(),\n
state={\'start_requested\': \'started\', \'stop_requested\': \'stopped\'}[context.getSlapState()],\n
)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollect.py
0 → 100644
View file @
f449cb6c
instance
=
context
if
(
instance
.
getSlapState
()
!=
"destroy_requested"
):
hosting_subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
if
(
hosting_subscription
.
getValidationState
()
==
"archived"
):
# Buildout didn't propagate the destruction request
requester
=
instance
.
getPredecessorRelatedValue
()
if
(
instance
.
getRelativeUrl
()
in
requester
.
getPredecessorList
())
and
\
(
requester
.
getSlapState
()
==
"destroy_requested"
):
# For security, only destroyed if parent is also destroyed
if
instance
.
getPortalType
()
==
'Software Instance'
:
is_slave
=
False
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
is_slave
=
True
else
:
raise
NotImplementedError
,
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
requester
.
requestInstance
(
software_release
=
instance
.
getUrlString
(),
software_title
=
instance
.
getTitle
(),
software_type
=
instance
.
getSourceReference
(),
instance_xml
=
instance
.
getTextContent
(),
sla_xml
=
instance
.
getSlaXml
(),
shared
=
is_slave
,
state
=
"destroyed"
,
comment
=
"Garbage collect %s"
%
instance
.
getRelativeUrl
()
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollect.xml
View file @
f449cb6c
...
@@ -48,39 +48,6 @@
...
@@ -48,39 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = context\n
\n
if (instance.getSlapState() != "destroy_requested"):\n
hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
if (hosting_subscription.getValidationState() == "archived"):\n
# Buildout didn\'t propagate the destruction request\n
requester = instance.getPredecessorRelatedValue()\n
if (instance.getRelativeUrl() in requester.getPredecessorList()) and \\\n
(requester.getSlapState() == "destroy_requested"):\n
# For security, only destroyed if parent is also destroyed\n
\n
if instance.getPortalType() == \'Software Instance\':\n
is_slave = False\n
elif instance.getPortalType() == \'Slave Instance\':\n
is_slave = True\n
else:\n
raise NotImplementedError, "Unknown portal type %s of %s" % \\\n
(instance.getPortalType(), instance.getRelativeUrl())\n
\n
requester.requestInstance(\n
software_release=instance.getUrlString(),\n
software_title=instance.getTitle(),\n
software_type=instance.getSourceReference(),\n
instance_xml=instance.getTextContent(),\n
sla_xml=instance.getSlaXml(),\n
shared=is_slave,\n
state="destroyed",\n
comment="Garbage collect %s" % instance.getRelativeUrl()\n
)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollectNonAllocatedRootTree.py
0 → 100644
View file @
f449cb6c
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
instance
=
context
portal
=
context
.
getPortalObject
()
if
instance
.
getValidationState
()
!=
'validated'
\
or
instance
.
getSlapState
()
not
in
(
'start_requested'
,
'stop_requested'
)
\
or
instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
)
is
not
None
:
return
latest_comment
=
portal
.
portal_workflow
.
getInfoFor
(
instance
,
'comment'
,
wf_id
=
'edit_workflow'
)
if
latest_comment
!=
'Allocation failed: no free Computer Partition'
:
# No nothing if allocation alarm didn't run on it
return
latest_edit_time
=
portal
.
portal_workflow
.
getInfoFor
(
instance
,
'time'
,
wf_id
=
'edit_workflow'
)
if
(
int
(
DateTime
())
-
int
(
latest_edit_time
))
<
259200
:
# Allow 3 days gap betweeb latest allocation try and deletion
return
# Only destroy if the instance is the only one in the tree
hosting_subscription
=
instance
.
getSpecialiseValue
(
"Hosting Subscription"
)
if
(
hosting_subscription
.
getPredecessor
()
!=
instance
.
getRelativeUrl
()):
return
if
(
len
(
hosting_subscription
.
getPredecessorList
())
!=
1
):
return
instance_list
=
portal
.
portal_catalog
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
default_specialise_uid
=
hosting_subscription
.
getUid
(),
limit
=
2
)
if
len
(
instance_list
)
!=
1
:
return
# OK, destroy hosting subscription
hosting_subscription
.
requestDestroy
(
software_release
=
hosting_subscription
.
getUrlString
(),
software_title
=
hosting_subscription
.
getTitle
(),
software_type
=
hosting_subscription
.
getSourceReference
(),
instance_xml
=
hosting_subscription
.
getTextContent
(),
sla_xml
=
hosting_subscription
.
getSlaXml
(),
shared
=
hosting_subscription
.
isRootSlave
(),
state
=
'destroyed'
,
comment
=
"Garbage collect %s not allocated for more than 3 days"
%
instance
.
getRelativeUrl
(),
)
hosting_subscription
.
archive
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToGarbageCollectNonAllocatedRootTree.xml
View file @
f449cb6c
...
@@ -48,61 +48,6 @@
...
@@ -48,61 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
instance = context\n
portal = context.getPortalObject()\n
\n
if instance.getValidationState() != \'validated\' \\\n
or instance.getSlapState() not in (\'start_requested\', \'stop_requested\') \\\n
or instance.getAggregateValue(portal_type=\'Computer Partition\') is not None:\n
return\n
\n
latest_comment = portal.portal_workflow.getInfoFor(instance, \'comment\', wf_id=\'edit_workflow\')\n
if latest_comment != \'Allocation failed: no free Computer Partition\':\n
# No nothing if allocation alarm didn\'t run on it\n
return\n
\n
latest_edit_time = portal.portal_workflow.getInfoFor(instance, \'time\', wf_id=\'edit_workflow\')\n
if (int(DateTime()) - int(latest_edit_time)) < 259200:\n
# Allow 3 days gap betweeb latest allocation try and deletion\n
return\n
\n
# Only destroy if the instance is the only one in the tree\n
hosting_subscription = instance.getSpecialiseValue("Hosting Subscription")\n
if (hosting_subscription.getPredecessor() != instance.getRelativeUrl()):\n
return\n
if (len(hosting_subscription.getPredecessorList()) != 1):\n
return\n
instance_list = portal.portal_catalog(\n
portal_type=["Software Instance", "Slave Instance"],\n
default_specialise_uid=hosting_subscription.getUid(),\n
limit=2)\n
if len(instance_list) != 1:\n
return\n
\n
# OK, destroy hosting subscription\n
hosting_subscription.requestDestroy(\n
software_release=hosting_subscription.getUrlString(),\n
software_title=hosting_subscription.getTitle(),\n
software_type=hosting_subscription.getSourceReference(),\n
instance_xml=hosting_subscription.getTextContent(),\n
sla_xml=hosting_subscription.getSlaXml(),\n
shared=hosting_subscription.isRootSlave(),\n
state=\'destroyed\',\n
comment="Garbage collect %s not allocated for more than 3 days" % instance.getRelativeUrl(),\n
)\n
hosting_subscription.archive()\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToStopCollect.py
0 → 100644
View file @
f449cb6c
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
instance
=
context
if
(
instance
.
getSlapState
()
==
"start_requested"
):
hosting_subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
if
(
hosting_subscription
.
getSlapState
()
==
"stop_requested"
):
# Buildout may not propagate the stop request
requester
=
instance
.
getPredecessorRelatedValue
()
if
(
instance
.
getRelativeUrl
()
in
requester
.
getPredecessorList
())
and
\
(
requester
.
getSlapState
()
==
"stop_requested"
):
# For security, only stop if parent is also stopped
if
instance
.
getPortalType
()
==
'Software Instance'
:
is_slave
=
False
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
is_slave
=
True
else
:
raise
NotImplementedError
,
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
requester
.
requestInstance
(
software_release
=
instance
.
getUrlString
(),
software_title
=
instance
.
getTitle
(),
software_type
=
instance
.
getSourceReference
(),
instance_xml
=
instance
.
getTextContent
(),
sla_xml
=
instance
.
getSlaXml
(),
shared
=
is_slave
,
state
=
"stopped"
,
comment
=
"Stop collect %s"
%
instance
.
getRelativeUrl
()
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToStopCollect.xml
View file @
f449cb6c
...
@@ -48,43 +48,6 @@
...
@@ -48,43 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
instance = context\n
\n
if (instance.getSlapState() == "start_requested"):\n
hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
if (hosting_subscription.getSlapState() == "stop_requested"):\n
# Buildout may not propagate the stop request\n
requester = instance.getPredecessorRelatedValue()\n
if (instance.getRelativeUrl() in requester.getPredecessorList()) and \\\n
(requester.getSlapState() == "stop_requested"):\n
# For security, only stop if parent is also stopped\n
\n
if instance.getPortalType() == \'Software Instance\':\n
is_slave = False\n
elif instance.getPortalType() == \'Slave Instance\':\n
is_slave = True\n
else:\n
raise NotImplementedError, "Unknown portal type %s of %s" % \\\n
(instance.getPortalType(), instance.getRelativeUrl())\n
\n
requester.requestInstance(\n
software_release=instance.getUrlString(),\n
software_title=instance.getTitle(),\n
software_type=instance.getSourceReference(),\n
instance_xml=instance.getTextContent(),\n
sla_xml=instance.getSlaXml(),\n
shared=is_slave,\n
state="stopped",\n
comment="Stop collect %s" % instance.getRelativeUrl()\n
)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToUnallocatePartition.py
0 → 100644
View file @
f449cb6c
instance
=
context
if
instance
.
getSlapState
()
!=
'destroy_requested'
:
return
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
portal
=
instance
.
getPortalObject
()
if
partition
is
not
None
:
# Partition may be managed by another instance at the same time
# Prevent creating two instances with the same title
tag
=
"allocate_%s"
%
partition
.
getRelativeUrl
()
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
==
0
):
# No concurrency issue
instance
.
unallocatePartition
()
instance_sql_list
=
portal
.
portal_catalog
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
default_aggregate_uid
=
partition
.
getUid
(),
)
count
=
len
(
instance_sql_list
)
if
count
==
0
:
# Current instance should at least be cataloggued
pass
else
:
can_be_free
=
True
for
instance_sql
in
instance_sql_list
:
new_instance
=
instance_sql
.
getObject
()
if
new_instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
is
not
None
:
can_be_free
=
False
break
if
can_be_free
:
partition
.
markFree
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Instance_tryToUnallocatePartition.xml
View file @
f449cb6c
...
@@ -48,40 +48,6 @@
...
@@ -48,40 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = context\n
if instance.getSlapState() != \'destroy_requested\':\n
return\n
\n
partition = instance.getAggregateValue(portal_type="Computer Partition")\n
portal = instance.getPortalObject()\n
if partition is not None:\n
# Partition may be managed by another instance at the same time\n
# Prevent creating two instances with the same title\n
tag = "allocate_%s" % partition.getRelativeUrl()\n
if (portal.portal_activities.countMessageWithTag(tag) == 0):\n
# No concurrency issue\n
instance.unallocatePartition()\n
instance_sql_list = portal.portal_catalog(\n
portal_type=["Software Instance", "Slave Instance"],\n
default_aggregate_uid=partition.getUid(),\n
)\n
count = len(instance_sql_list)\n
if count == 0:\n
# Current instance should at least be cataloggued\n
pass\n
else:\n
can_be_free = True\n
for instance_sql in instance_sql_list:\n
new_instance = instance_sql.getObject()\n
if new_instance.getAggregateValue(portal_type="Computer Partition") is not None:\n
can_be_free = False\n
break\n
if can_be_free:\n
partition.markFree()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
0 → 100644
View file @
f449cb6c
import
random
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
person
=
context
computer_partition
=
None
filter_kw_copy
=
filter_kw
.
copy
()
query_kw
=
{
'software_release_url'
:
software_release_url
,
'portal_type'
:
'Computer Partition'
,
}
if
software_instance_portal_type
==
"Slave Instance"
:
query_kw
[
'free_for_request'
]
=
0
query_kw
[
'software_type'
]
=
software_type
elif
software_instance_portal_type
==
"Software Instance"
:
query_kw
[
'free_for_request'
]
=
1
else
:
raise
NotImplementedError
(
"Unknown portal type %s"
%
software_instance_portal_type
)
# support SLA
# Explicit location
explicit_location
=
False
if
"computer_guid"
in
filter_kw
:
explicit_location
=
True
query_kw
[
"parent_reference"
]
=
SimpleQuery
(
parent_reference
=
filter_kw
.
pop
(
"computer_guid"
))
if
"instance_guid"
in
filter_kw
:
explicit_location
=
True
portal
=
context
.
getPortalObject
()
instance_guid
=
filter_kw
.
pop
(
"instance_guid"
)
query_kw
[
"aggregate_related_reference"
]
=
SimpleQuery
(
aggregate_related_reference
=
instance_guid
)
if
'network_guid'
in
filter_kw
:
network_guid
=
filter_kw
.
pop
(
'network_guid'
)
query_kw
[
"default_subordination_reference"
]
=
SimpleQuery
(
default_subordination_reference
=
network_guid
)
if
computer_network_query
:
if
query_kw
.
get
(
"default_subordination_reference"
):
query_kw
[
"default_subordination_reference"
]
=
ComplexQuery
(
query_kw
[
"default_subordination_reference"
],
computer_network_query
)
else
:
query_kw
[
"default_subordination_reference"
]
=
computer_network_query
if
"retention_delay"
in
filter_kw
:
filter_kw
.
pop
(
"retention_delay"
)
computer_base_category_list
=
[
'group'
,
'cpu_core'
,
'cpu_frequency'
,
'cpu_type'
,
'local_area_network_type'
,
'region'
,
'memory_size'
,
'memory_type'
,
'storage_capacity'
,
'storage_interface'
,
'storage_redundancy'
,
]
for
base_category
in
computer_base_category_list
:
if
base_category
in
filter_kw
:
category_relative_url
=
"%s"
%
filter_kw
.
pop
(
base_category
)
# XXX Small protection to prevent entering strange strings
category
=
context
.
getPortalObject
().
portal_categories
[
base_category
].
restrictedTraverse
(
str
(
category_relative_url
),
None
)
if
category
is
None
:
query_kw
[
"uid"
]
=
"-1"
else
:
query_kw
[
"%s_uid"
%
base_category
]
=
category
.
getUid
()
query_kw
[
"capacity_scope_uid"
]
=
context
.
getPortalObject
().
portal_categories
.
capacity_scope
.
open
.
getUid
()
# if not explicit_location:
# # Only allocation on public computer
# query_kw["allocation_scope_uid"] = context.getPortalObject().portal_categories.allocation_scope.open.public.getUid()
extra_query_kw
=
context
.
ComputerPartition_getCustomAllocationParameterDict
(
software_release_url
,
software_type
,
software_instance_portal_type
,
filter_kw_copy
,
computer_network_query
,
test_mode
)
if
extra_query_kw
:
query_kw
.
update
(
extra_query_kw
)
if
filter_kw
.
keys
():
# XXX Drop all unexpected keys
query_kw
[
"uid"
]
=
"-1"
if
test_mode
:
return
bool
(
len
(
context
.
portal_catalog
(
limit
=
1
,
**
query_kw
)))
SQL_WINDOW_SIZE
=
50
# fetch at mot 50 random Computer Partitions, and check if they are ok
isTransitionPossible
=
person
.
getPortalObject
().
portal_workflow
.
isTransitionPossible
result_count
=
person
.
portal_catalog
.
countResults
(
**
query_kw
)[
0
][
0
]
offset
=
max
(
0
,
result_count
-
1
)
if
offset
>=
SQL_WINDOW_SIZE
:
limit
=
(
random
.
randint
(
0
,
offset
),
SQL_WINDOW_SIZE
)
else
:
limit
=
(
0
,
SQL_WINDOW_SIZE
)
for
computer_partition_candidate
in
context
.
portal_catalog
(
limit
=
limit
,
**
query_kw
):
computer_partition_candidate
=
computer_partition_candidate
.
getObject
()
if
software_instance_portal_type
==
"Software Instance"
:
# Check if the computer partition can be marked as busy
if
isTransitionPossible
(
computer_partition_candidate
,
'mark_busy'
):
computer_partition
=
computer_partition_candidate
computer_partition
.
markBusy
()
break
elif
computer_partition_candidate
.
getSlapState
()
==
"busy"
:
# Only assign slave instance on busy partition
computer_partition
=
computer_partition_candidate
break
if
computer_partition
is
None
:
raise
ValueError
(
'It was not possible to find free Computer Partition'
)
# lock computer partition
computer_partition
.
serialize
()
return
computer_partition
.
getRelativeUrl
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.xml
View file @
f449cb6c
...
@@ -48,136 +48,6 @@
...
@@ -48,136 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
import random\n
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery\n
person = context\n
\n
computer_partition = None\n
filter_kw_copy = filter_kw.copy()\n
query_kw = {\n
\'software_release_url\': software_release_url,\n
\'portal_type\': \'Computer Partition\',\n
}\n
if software_instance_portal_type == "Slave Instance":\n
query_kw[\'free_for_request\'] = 0\n
query_kw[\'software_type\'] = software_type\n
elif software_instance_portal_type == "Software Instance":\n
query_kw[\'free_for_request\'] = 1\n
else:\n
raise NotImplementedError("Unknown portal type %s"%\n
software_instance_portal_type)\n
\n
# support SLA\n
\n
# Explicit location\n
explicit_location = False\n
if "computer_guid" in filter_kw:\n
explicit_location = True\n
query_kw["parent_reference"] = SimpleQuery(parent_reference=filter_kw.pop("computer_guid"))\n
\n
if "instance_guid" in filter_kw:\n
explicit_location = True\n
portal = context.getPortalObject()\n
instance_guid = filter_kw.pop("instance_guid")\n
query_kw["aggregate_related_reference"] = SimpleQuery(aggregate_related_reference=instance_guid)\n
\n
if \'network_guid\' in filter_kw:\n
network_guid = filter_kw.pop(\'network_guid\')\n
query_kw["default_subordination_reference"] = SimpleQuery(default_subordination_reference=network_guid)\n
\n
if computer_network_query:\n
if query_kw.get("default_subordination_reference"):\n
query_kw["default_subordination_reference"] = ComplexQuery(\n
query_kw["default_subordination_reference"],\n
computer_network_query\n
)\n
else:\n
query_kw["default_subordination_reference"] = computer_network_query\n
\n
if "retention_delay" in filter_kw:\n
filter_kw.pop("retention_delay")\n
\n
computer_base_category_list = [\n
\'group\',\n
\'cpu_core\',\n
\'cpu_frequency\',\n
\'cpu_type\',\n
\'local_area_network_type\',\n
\'region\',\n
\'memory_size\',\n
\'memory_type\',\n
\'storage_capacity\',\n
\'storage_interface\',\n
\'storage_redundancy\',\n
]\n
for base_category in computer_base_category_list:\n
if base_category in filter_kw:\n
category_relative_url = "%s" % filter_kw.pop(base_category)\n
# XXX Small protection to prevent entering strange strings\n
category = context.getPortalObject().portal_categories[base_category].restrictedTraverse(str(category_relative_url), None)\n
if category is None:\n
query_kw["uid"] = "-1"\n
else:\n
query_kw["%s_uid" % base_category] = category.getUid()\n
\n
query_kw["capacity_scope_uid"] = context.getPortalObject().portal_categories.capacity_scope.open.getUid()\n
# if not explicit_location:\n
# # Only allocation on public computer\n
# query_kw["allocation_scope_uid"] = context.getPortalObject().portal_categories.allocation_scope.open.public.getUid()\n
\n
extra_query_kw = context.ComputerPartition_getCustomAllocationParameterDict(\n
software_release_url, software_type, software_instance_portal_type,\n
filter_kw_copy, computer_network_query, test_mode)\n
if extra_query_kw:\n
query_kw.update(extra_query_kw)\n
\n
if filter_kw.keys():\n
# XXX Drop all unexpected keys\n
query_kw["uid"] = "-1"\n
\n
if test_mode:\n
return bool(len(context.portal_catalog(limit=1, **query_kw)))\n
\n
SQL_WINDOW_SIZE = 50\n
\n
# fetch at mot 50 random Computer Partitions, and check if they are ok\n
isTransitionPossible = person.getPortalObject().portal_workflow.isTransitionPossible\n
result_count = person.portal_catalog.countResults(**query_kw)[0][0]\n
offset = max(0, result_count-1)\n
if offset >
= SQL_WINDOW_SIZE:\n
limit = (random.randint(0, offset), SQL_WINDOW_SIZE)\n
else:\n
limit = (0, SQL_WINDOW_SIZE)\n
\n
for computer_partition_candidate in context.portal_catalog(\n
limit=limit, **query_kw):\n
computer_partition_candidate = computer_partition_candidate.getObject()\n
if software_instance_portal_type == "Software Instance":\n
# Check if the computer partition can be marked as busy\n
if isTransitionPossible(computer_partition_candidate, \'mark_busy\'):\n
computer_partition = computer_partition_candidate\n
computer_partition.markBusy()\n
break\n
elif computer_partition_candidate.getSlapState() == "busy":\n
# Only assign slave instance on busy partition\n
computer_partition = computer_partition_candidate\n
break\n
\n
if computer_partition is None:\n
raise ValueError(\'It was not possible to find free Computer Partition\')\n
\n
# lock computer partition\n
computer_partition.serialize()\n
\n
return computer_partition.getRelativeUrl()\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, test_mode=False
</string>
</value>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, test_mode=False
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_isAllowedToAllocate.py
0 → 100644
View file @
f449cb6c
return
True
# Disabled functionality
#section_uid = context.getSourceSectionUid()
#customer_uid = context.getDestinationSectionUid()
#simulation_state = context.getPortalCurrentInventoryStateList() + context.getPortalTransitInventoryStateList()
#balance = context.portal_simulation.getInventoryAssetPrice(
# node_category_strict_membership='account_type/asset/receivable',
# simulation_state=simulation_state,
# section_uid=section_uid,
# mirror_section_uid=customer_uid)
#return balance <= 0.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_isAllowedToAllocate.xml
View file @
f449cb6c
...
@@ -48,26 +48,6 @@
...
@@ -48,26 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
return True\n
\n
# Disabled functionality\n
#section_uid = context.getSourceSectionUid()\n
#customer_uid = context.getDestinationSectionUid()\n
#simulation_state = context.getPortalCurrentInventoryStateList() + context.getPortalTransitInventoryStateList()\n
#balance = context.portal_simulation.getInventoryAssetPrice(\n
# node_category_strict_membership=\'account_type/asset/receivable\',\n
# simulation_state=simulation_state,\n
# section_uid=section_uid,\n
# mirror_section_uid=customer_uid)\n
#return balance <= 0.\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getCurrentStatus.py
0 → 100644
View file @
f449cb6c
"""Dirty script to return Software Instance state"""
import
json
state
=
context
.
getSlapState
()
has_partition
=
context
.
getAggregate
(
portal_type
=
"Computer Partition"
)
result
=
'Unable to calculate the status...'
if
has_partition
:
try
:
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
try
:
d
=
memcached_dict
[
context
.
getReference
()]
except
KeyError
:
result
=
context
.
getSlapStateTitle
()
else
:
d
=
json
.
loads
(
d
)
result
=
d
[
'text'
]
if
result
.
startswith
(
'#access '
):
result
=
result
[
len
(
'#access '
):]
except
Exception
:
raise
result
=
'There is system issue, please try again later.'
else
:
if
state
in
[
"start_requested"
,
"stop_requested"
]:
result
=
'Looking for a free partition'
elif
state
in
[
"destroy_requested"
]:
result
=
'Destroyed'
return
result
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getCurrentStatus.xml
View file @
f449cb6c
...
@@ -48,41 +48,6 @@
...
@@ -48,41 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""Dirty script to return Software Instance state"""\n
import json\n
state = context.getSlapState()\n
has_partition = context.getAggregate(portal_type="Computer Partition")\n
result = \'Unable to calculate the status...\'\n
if has_partition:\n
try:\n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
key_prefix=\'slap_tool\',\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
try:\n
d = memcached_dict[context.getReference()]\n
except KeyError:\n
result = context.getSlapStateTitle()\n
else:\n
d = json.loads(d)\n
result = d[\'text\']\n
if result.startswith(\'#access \'):\n
result = result[len(\'#access \'):]\n
\n
except Exception:\n
raise\n
result = \'There is system issue, please try again later.\'\n
\n
else:\n
if state in ["start_requested", "stop_requested"]:\n
result = \'Looking for a free partition\'\n
elif state in ["destroy_requested"]:\n
result = \'Destroyed\'\n
\n
return result\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getDefaultImageAbsoluteUrl.py
0 → 100644
View file @
f449cb6c
return
context
.
HostingSubscription_getDefaultImageAbsoluteUrl
()
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_getDefaultImageAbsoluteUrl.xml
View file @
f449cb6c
...
@@ -48,11 +48,6 @@
...
@@ -48,11 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
return context.HostingSubscription_getDefaultImageAbsoluteUrl()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
0 → 100644
View file @
f449cb6c
from
Products.DCWorkflow.DCWorkflow
import
ValidationFailed
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
from
zExceptions
import
Unauthorized
if
context
.
getPortalType
()
not
in
(
'Software Instance'
,
'Slave Instance'
):
raise
TypeError
(
'%s is not supported'
%
context
.
getPortalType
())
def
markHistory
(
document
,
comment
):
portal_workflow
=
document
.
portal_workflow
last_workflow_item
=
portal_workflow
.
getInfoFor
(
ob
=
document
,
name
=
'comment'
,
wf_id
=
'edit_workflow'
)
if
last_workflow_item
!=
comment
:
portal_workflow
.
doActionFor
(
document
,
action
=
'edit_action'
,
comment
=
comment
)
def
assignComputerPartition
(
software_instance
,
hosting_subscription
):
computer_partition
=
software_instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
if
computer_partition
is
None
:
hosting_subscription
=
software_instance
.
getSpecialiseValue
(
portal_type
=
'Hosting Subscription'
)
person
=
hosting_subscription
.
getDestinationSectionValue
(
portal_type
=
'Person'
)
if
person
is
None
:
raise
ValueError
(
'%s does not have person related'
%
hosting_subscription
.
getRelativeUrl
())
if
not
person
.
Person_isAllowedToAllocate
():
raise
Unauthorized
(
'Allocation disallowed'
)
tag
=
None
try
:
sla_dict
=
software_instance
.
getSlaXmlAsDict
()
except
Exception
:
# Note: it is impossible to import module exceptions from python scripts
computer_partition_relative_url
=
None
else
:
# "Each instance should be allocated to a different network." (i.e at most one instance of the tree per network)
computer_network_query
=
None
if
sla_dict
.
get
(
'mode'
,
None
)
==
'unique_by_network'
:
# Prevent creating two instances in the same computer_network
hosting_subscription_uid
=
hosting_subscription
.
getUid
()
tag
=
"%s_inProgress"
%
hosting_subscription_uid
if
(
context
.
getPortalObject
().
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, just ignore
markHistory
(
software_instance
,
'Allocation failed: blocking activites in progress for %s'
%
hosting_subscription_uid
)
sla_dict
.
pop
(
'mode'
)
# XXX: does NOT scale if hosting subscription contains many SoftwareInstance
hosting_subscription
=
software_instance
.
getSpecialiseValue
()
software_instance_tree_list
=
[
sql_obj
.
getObject
()
\
for
sql_obj
in
context
.
getPortalObject
().
portal_catalog
(
portal_type
=
[
'Software Instance'
,
'Slave Instance'
],
default_specialise_uid
=
hosting_subscription
.
getUid
(),
)
]
computer_network_query_list
=
[]
# Don't deploy in computer with no network
computer_network_query_list
.
append
(
ComplexQuery
(
SimpleQuery
(
default_subordination_uid
=
''
),
logical_operator
=
'not'
,
))
for
other_software_instance
in
software_instance_tree_list
:
computer_partition
=
other_software_instance
.
getAggregateValue
()
if
not
computer_partition
:
continue
computer_network
=
computer_partition
.
getParentValue
().
getSubordinationValue
()
if
computer_network
:
computer_network_query_list
.
append
(
ComplexQuery
(
SimpleQuery
(
default_subordination_uid
=
computer_network
.
getUid
()),
logical_operator
=
'not'
,
))
computer_network_query
=
ComplexQuery
(
*
computer_network_query_list
)
hosting_subscription
.
serialize
()
elif
sla_dict
.
get
(
'mode'
):
computer_network_query
=
'-1'
computer_partition_relative_url
=
person
.
Person_restrictMethodAsShadowUser
(
shadow_document
=
person
,
callable_object
=
person
.
Person_findPartition
,
argument_list
=
[
software_instance
.
getUrlString
(),
software_instance
.
getSourceReference
(),
software_instance
.
getPortalType
(),
sla_dict
,
computer_network_query
])
return
computer_partition_relative_url
,
tag
software_instance
=
context
if
software_instance
.
getValidationState
()
!=
'validated'
\
or
software_instance
.
getSlapState
()
not
in
(
'start_requested'
,
'stop_requested'
)
\
or
software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
)
is
not
None
:
return
hosting_subscription
=
software_instance
.
getSpecialiseValue
()
try
:
computer_partition_url
,
tag
=
assignComputerPartition
(
software_instance
,
hosting_subscription
)
# XXX: We create a dummy activity to prevent to allocations on the same network
if
tag
:
hosting_subscription
.
activate
(
activity
=
"SQLQueue"
,
tag
=
tag
,
after_tag
=
"allocate_%s"
%
computer_partition_url
).
getId
()
except
ValueError
:
# It was not possible to find free Computer Partition
markHistory
(
software_instance
,
'Allocation failed: no free Computer Partition'
)
except
Unauthorized
,
e
:
# user has bad balance
markHistory
(
software_instance
,
'Allocation failed: %s'
%
e
)
except
NotImplementedError
,
e
:
# user has bad balance
markHistory
(
software_instance
,
'Allocation failed: %s'
%
e
)
else
:
if
computer_partition_url
is
not
None
:
try
:
software_instance
.
Base_checkConsistency
()
except
ValidationFailed
:
# order not ready yet
markHistory
(
software_instance
,
'Allocation failed: consistency failed'
)
else
:
software_instance
.
allocatePartition
(
computer_partition_url
=
computer_partition_url
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.xml
View file @
f449cb6c
...
@@ -48,135 +48,6 @@
...
@@ -48,135 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery\n
from zExceptions import Unauthorized\n
\n
if context.getPortalType() not in (\'Software Instance\', \'Slave Instance\'):\n
raise TypeError(\'%s is not supported\' % context.getPortalType())\n
\n
def markHistory(document, comment):\n
portal_workflow = document.portal_workflow\n
last_workflow_item = portal_workflow.getInfoFor(ob=document,\n
name=\'comment\', wf_id=\'edit_workflow\')\n
if last_workflow_item != comment:\n
portal_workflow.doActionFor(document, action=\'edit_action\', comment=comment)\n
\n
def assignComputerPartition(software_instance, hosting_subscription):\n
computer_partition = software_instance.getAggregateValue(\n
portal_type="Computer Partition")\n
if computer_partition is None:\n
hosting_subscription = software_instance.getSpecialiseValue(\n
portal_type=\'Hosting Subscription\')\n
person = hosting_subscription.getDestinationSectionValue(portal_type=\'Person\')\n
if person is None:\n
raise ValueError(\'%s does not have person related\' % hosting_subscription.getRelativeUrl())\n
if not person.Person_isAllowedToAllocate():\n
raise Unauthorized(\'Allocation disallowed\')\n
\n
tag = None\n
try:\n
sla_dict = software_instance.getSlaXmlAsDict()\n
except Exception:\n
# Note: it is impossible to import module exceptions from python scripts\n
computer_partition_relative_url = None\n
else:\n
\n
# "Each instance should be allocated to a different network." (i.e at most one instance of the tree per network)\n
computer_network_query = None\n
if sla_dict.get(\'mode\', None) == \'unique_by_network\':\n
# Prevent creating two instances in the same computer_network\n
hosting_subscription_uid = hosting_subscription.getUid()\n
tag = "%s_inProgress" % hosting_subscription_uid\n
if (context.getPortalObject().portal_activities.countMessageWithTag(tag) >
0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, just ignore\n
markHistory(software_instance,\n
\'Allocation failed: blocking activites in progress for %s\' % hosting_subscription_uid)\n
\n
sla_dict.pop(\'mode\')\n
# XXX: does NOT scale if hosting subscription contains many SoftwareInstance\n
hosting_subscription = software_instance.getSpecialiseValue()\n
software_instance_tree_list = [sql_obj.getObject() \\\n
for sql_obj in context.getPortalObject().portal_catalog(\n
portal_type=[\'Software Instance\', \'Slave Instance\'],\n
default_specialise_uid=hosting_subscription.getUid(),\n
)\n
]\n
computer_network_query_list = []\n
# Don\'t deploy in computer with no network\n
computer_network_query_list.append(ComplexQuery(\n
SimpleQuery(\n
default_subordination_uid=\'\'),\n
logical_operator=\'not\',\n
))\n
for other_software_instance in software_instance_tree_list:\n
computer_partition = other_software_instance.getAggregateValue()\n
if not computer_partition:\n
continue\n
computer_network = computer_partition.getParentValue().getSubordinationValue()\n
if computer_network:\n
computer_network_query_list.append(ComplexQuery(\n
SimpleQuery(\n
default_subordination_uid=computer_network.getUid()),\n
logical_operator=\'not\',\n
))\n
\n
computer_network_query = ComplexQuery(*computer_network_query_list)\n
hosting_subscription.serialize()\n
\n
elif sla_dict.get(\'mode\'):\n
computer_network_query = \'-1\'\n
\n
computer_partition_relative_url = person.Person_restrictMethodAsShadowUser(\n
shadow_document=person,\n
callable_object=person.Person_findPartition,\n
argument_list=[software_instance.getUrlString(), software_instance.getSourceReference(),\n
software_instance.getPortalType(), sla_dict, computer_network_query])\n
return computer_partition_relative_url, tag\n
\n
software_instance = context\n
if software_instance.getValidationState() != \'validated\' \\\n
or software_instance.getSlapState() not in (\'start_requested\', \'stop_requested\') \\\n
or software_instance.getAggregateValue(portal_type=\'Computer Partition\') is not None:\n
return\n
\n
hosting_subscription = software_instance.getSpecialiseValue()\n
try:\n
computer_partition_url, tag = assignComputerPartition(software_instance,\n
hosting_subscription)\n
\n
# XXX: We create a dummy activity to prevent to allocations on the same network\n
if tag:\n
hosting_subscription.activate(activity="SQLQueue", tag=tag,\n
after_tag="allocate_%s" % computer_partition_url).getId()\n
\n
except ValueError:\n
# It was not possible to find free Computer Partition\n
markHistory(software_instance, \'Allocation failed: no free Computer Partition\')\n
except Unauthorized, e:\n
# user has bad balance\n
markHistory(software_instance, \'Allocation failed: %s\' % e)\n
except NotImplementedError, e:\n
# user has bad balance\n
markHistory(software_instance, \'Allocation failed: %s\' % e)\n
else:\n
if computer_partition_url is not None:\n
try:\n
software_instance.Base_checkConsistency()\n
except ValidationFailed:\n
# order not ready yet\n
markHistory(software_instance, \'Allocation failed: consistency failed\')\n
else:\n
software_instance.allocatePartition(computer_partition_url=computer_partition_url)\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToInvalidateIfDestroyed.py
0 → 100644
View file @
f449cb6c
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
if
context
.
getPortalType
()
not
in
(
'Software Instance'
,
'Slave Instance'
):
raise
TypeError
(
'%s is not supported'
%
context
.
getPortalType
())
software_instance
=
context
if
software_instance
.
getValidationState
()
==
'validated'
\
and
software_instance
.
getSlapState
()
==
'destroy_requested'
\
and
software_instance
.
getAggregateValue
(
portal_type
=
'Computer Partition'
)
is
None
:
software_instance
.
invalidate
(
comment
=
'Invalidated as unallocated and destroyed'
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToInvalidateIfDestroyed.xml
View file @
f449cb6c
...
@@ -48,22 +48,6 @@
...
@@ -48,22 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</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.getPortalType() not in (\'Software Instance\', \'Slave Instance\'):\n
raise TypeError(\'%s is not supported\' % context.getPortalType())\n
\n
software_instance = context\n
if software_instance.getValidationState() == \'validated\' \\\n
and software_instance.getSlapState() == \'destroy_requested\' \\\n
and software_instance.getAggregateValue(portal_type=\'Computer Partition\') is None:\n
software_instance.invalidate(comment=\'Invalidated as unallocated and destroyed\')\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
<value>
<string>
REQUEST=None
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.py
0 → 100644
View file @
f449cb6c
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
import
json
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
error_style
=
'background-color: red; display: block; height: 2em; width: 2em; float: left; margin: 5px;'
access_style
=
'background-color: green; display: block; height: 2em; width: 2em; float: left; margin: 5px;'
software_installation
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Software Installation'
,
validation_state
=
'validated'
,
url_string
=
context
.
getUrlString
(),
default_aggregate_uid
=
computer_uid
)
if
not
software_installation
or
software_installation
.
getSlapState
()
==
"destroy_requested"
:
return
'<span" style="%s" title="Information not available"></a>'
%
error_style
try
:
d
=
memcached_dict
[
software_installation
.
getReference
()]
except
KeyError
:
return
"<a href='%s' style='%s'></a>"
%
(
software_installation
.
getRelativeUrl
(),
error_style
)
else
:
d
=
json
.
loads
(
d
)
result
=
d
[
'text'
]
date
=
DateTime
(
d
[
'created_at'
])
limit_date
=
DateTime
()
-
0.084
if
result
.
startswith
(
'#error '
)
or
(
date
-
limit_date
)
<
0
:
access_style
=
error_style
return
"<a href='%s' style='%s' title='%s at %s'></a>"
%
(
software_installation
.
getRelativeUrl
(),
access_style
,
result
,
d
[
'created_at'
])
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.xml
View file @
f449cb6c
...
@@ -48,50 +48,6 @@
...
@@ -48,50 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
from DateTime import DateTime\n
portal = context.getPortalObject()\n
import json\n
\n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
key_prefix=\'slap_tool\',\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
\n
error_style = \'background-color: red; display: block; height: 2em; width: 2em; float: left; margin: 5px;\'\n
access_style = \'background-color: green; display: block; height: 2em; width: 2em; float: left; margin: 5px;\'\n
\n
software_installation = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Installation\',\n
validation_state=\'validated\',\n
url_string=context.getUrlString(),\n
default_aggregate_uid=computer_uid\n
)\n
if not software_installation or software_installation.getSlapState() == "destroy_requested":\n
return \'<span" style="%s" title="Information not available">
</a>
\' % error_style\n
\n
try:\n
d = memcached_dict[software_installation.getReference()]\n
except KeyError:\n
return "
<a
href=
\'%s\'
style=
\'%s\'
></a>
" % (software_installation.getRelativeUrl(),\n
error_style)\n
else:\n
d = json.loads(d)\n
result = d[\'text\']\n
date = DateTime(d[\'created_at\'])\n
limit_date = DateTime() - 0.084\n
if result.startswith(\'#error \') or (date - limit_date)
< 0:
\n
access_style =
error_style\n
\n
return
"<a
href=
\'%s\'
style=
\'%s\'
title=
\'%s
at
%s\'
></a>
" % (\n
software_installation.getRelativeUrl(),\n
access_style, result, d[\'created_at\'])\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
computer_uid
</string>
</value>
<value>
<string>
computer_uid
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getRelatedNetworkList.py
0 → 100644
View file @
f449cb6c
network_list
=
[]
for
computer
in
context
.
SoftwareRelease_getUsableComputerList
():
network
=
computer
.
getSubordinationValue
()
if
network
and
not
network
in
network_list
:
network_list
.
append
(
network
)
return
network_list
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getRelatedNetworkList.xml
View file @
f449cb6c
...
@@ -48,17 +48,6 @@
...
@@ -48,17 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
network_list = []\n
for computer in context.SoftwareRelease_getUsableComputerList():\n
network = computer.getSubordinationValue()\n
if network and not network in network_list:\n
network_list.append(network)\n
\n
return network_list\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerList.py
0 → 100644
View file @
f449cb6c
kw
[
'portal_type'
]
=
'Software Installation'
kw
[
'validation_state'
]
=
'validated'
kw
[
'url_string'
]
=
context
.
getUrlString
()
software_installation_list
=
context
.
portal_catalog
(
**
kw
)
computer_list
=
[]
allocation_scope_list
=
[
'open/personal'
,
'open/public'
,
'open/friend'
]
for
software_installation
in
software_installation_list
:
computer
=
software_installation
.
getAggregateValue
()
if
software_installation
.
getSlapState
()
==
'start_requested'
and
\
computer
.
getAllocationScope
()
in
allocation_scope_list
:
computer_list
.
append
(
computer
)
return
computer_list
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerList.xml
View file @
f449cb6c
...
@@ -48,24 +48,6 @@
...
@@ -48,24 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
kw[\'portal_type\'] = \'Software Installation\'\n
kw[\'validation_state\'] = \'validated\'\n
kw[\'url_string\'] = context.getUrlString()\n
\n
software_installation_list = context.portal_catalog(**kw)\n
computer_list = []\n
allocation_scope_list = [\'open/personal\', \'open/public\', \'open/friend\']\n
for software_installation in software_installation_list:\n
computer = software_installation.getAggregateValue()\n
if software_installation.getSlapState() == \'start_requested\' and \\\n
computer.getAllocationScope() in allocation_scope_list:\n
computer_list.append(computer)\n
\n
return computer_list\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerWithoutSInstanceList.py
0 → 100644
View file @
f449cb6c
list
=
[]
for
si
in
context
.
portal_catalog
(
url_string
=
context
.
getUrlString
(),
portal_type
=
'Software Installation'
,
validation_state
=
'validated'
):
computer
=
si
.
getAggregateValue
()
if
si
.
getSlapState
()
==
'start_requested'
and
\
not
computer
.
Computer_getSoftwareReleaseUsage
(
context
.
getUid
())
\
and
computer
.
getValidationState
()
==
'validated'
:
list
.
append
(
computer
)
return
list
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getUsableComputerWithoutSInstanceList.xml
View file @
f449cb6c
...
@@ -48,19 +48,6 @@
...
@@ -48,19 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
list = []\n
for si in context.portal_catalog(url_string=context.getUrlString(), portal_type=\'Software Installation\', validation_state=\'validated\'):\n
computer = si.getAggregateValue()\n
if si.getSlapState() == \'start_requested\' and \\\n
not computer.Computer_getSoftwareReleaseUsage(context.getUid()) \\\n
and computer.getValidationState() == \'validated\':\n
list.append(computer)\n
\n
return list\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
**kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_requestDestroyOnComputerList.py
0 → 100644
View file @
f449cb6c
portal
=
context
.
getPortalObject
()
message
=
"Please select at least one computer."
dialog
=
dialog_id
item_count
=
0
keep_items
=
{}
software_release
=
portal
.
portal_catalog
.
getResultValue
(
url_string
=
url_string
,
portal_type
=
'Software Release'
)
if
len
(
uids
)
and
software_release
:
dialog
=
"SoftwareRelease_viewUsableComputerList"
for
computer
in
portal
.
portal_catalog
(
uid
=
uids
,
portal_type
=
"Computer"
):
# XXX - We won't destroy Software release if it used on this computer
if
not
computer
.
Computer_getSoftwareReleaseUsage
(
software_release
.
getUid
()):
computer
.
requestSoftwareRelease
(
software_release_url
=
url_string
,
state
=
'destroyed'
)
item_count
+=
1
message
=
"Destruction request submited on %d computer(s)."
%
item_count
keep_items
=
{
'portal_status_message'
:
context
.
Base_translateString
(
message
)}
if
cancel_url
:
keep_items
[
'cancel_url'
]
=
cancel_url
return
context
.
Base_redirect
(
dialog
,
keep_items
=
keep_items
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_requestDestroyOnComputerList.xml
View file @
f449cb6c
...
@@ -48,34 +48,6 @@
...
@@ -48,34 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
message = "Please select at least one computer."\n
dialog = dialog_id\n
item_count = 0\n
keep_items = {}\n
software_release = portal.portal_catalog.getResultValue(url_string=url_string,\n
portal_type=\'Software Release\')\n
\n
if len(uids) and software_release: \n
dialog = "SoftwareRelease_viewUsableComputerList"\n
for computer in portal.portal_catalog(uid=uids, portal_type="Computer"): \n
# XXX - We won\'t destroy Software release if it used on this computer\n
if not computer.Computer_getSoftwareReleaseUsage(software_release.getUid()): \n
computer.requestSoftwareRelease(software_release_url=url_string,\n
state=\'destroyed\')\n
item_count += 1\n
\n
message = "Destruction request submited on %d computer(s)." % item_count\n
\n
keep_items={\'portal_status_message\':context.Base_translateString(message)}\n
if cancel_url:\n
keep_items[\'cancel_url\'] = cancel_url\n
\n
return context.Base_redirect(dialog, keep_items=keep_items)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
dialog_id, url_string, form_id, uids=[], cancel_url=None, **kw
</string>
</value>
<value>
<string>
dialog_id, url_string, form_id, uids=[], cancel_url=None, **kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSModuleIdGenerator.py
0 → 100644
View file @
f449cb6c
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
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSModuleIdGenerator.xml
View file @
f449cb6c
...
@@ -48,40 +48,6 @@
...
@@ -48,40 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
portal = context.getPortalObject()\n
wrong_module_list = []\n
active_process = context.newActiveProcess()\n
for module_id in portal.objectIds(spec=(\'ERP5 Folder\',)) + ["portal_simulation", "portal_activities"]:\n
module = portal.restrictedTraverse(module_id)\n
if not module.Module_assertIdGenerator(\'_generatePerDayId\', fixit, active_process):\n
wrong_module_list.append(module.getRelativeUrl())\n
\n
if len(wrong_module_list) != 0:\n
summary = "Some modules have incorrect ID generator"\n
if fixit:\n
summary += ", fixed."\n
severity = 0\n
else:\n
severity = 1\n
detail = "List: %s" % (\', \'.join(wrong_module_list), )\n
else:\n
severity = 0\n
summary = "Nothing to do."\n
detail = ""\n
\n
active_result = ActiveResult()\n
active_result.edit(\n
summary=summary, \n
severity=severity,\n
detail=detail)\n
\n
active_process.postResult(active_result)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit=False, **kw
</string>
</value>
<value>
<string>
tag, fixit=False, **kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPAS.py
0 → 100644
View file @
f449cb6c
promise_dict
=
{
'IExtractionPlugin'
:
[
'SlapOS Machine Authentication Plugin'
,
'ERP5 Access Token Extraction Plugin'
,
],
'IAuthenticationPlugin'
:
[
'SlapOS Machine Authentication Plugin'
,
'SlapOS Shadow Authentication Plugin'
,
],
'IGroupsPlugin'
:
[
'SlapOS Machine Authentication Plugin'
,
'SlapOS Shadow Authentication Plugin'
,
],
'IUserEnumerationPlugin'
:
[
'SlapOS Machine Authentication Plugin'
,
'SlapOS Shadow Authentication Plugin'
,
]
}
context
.
Alarm_checkPromiseSlapOSPASBase
(
promise_dict
,
tag
,
fixit
=
fixit
,
**
kw
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPAS.xml
View file @
f449cb6c
...
@@ -48,29 +48,6 @@
...
@@ -48,29 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
promise_dict = {\n
\'IExtractionPlugin\': [\n
\'SlapOS Machine Authentication Plugin\',\n
\'ERP5 Access Token Extraction Plugin\',\n
],\n
\'IAuthenticationPlugin\': [\n
\'SlapOS Machine Authentication Plugin\',\n
\'SlapOS Shadow Authentication Plugin\',\n
],\n
\'IGroupsPlugin\': [\n
\'SlapOS Machine Authentication Plugin\',\n
\'SlapOS Shadow Authentication Plugin\',\n
],\n
\'IUserEnumerationPlugin\': [\n
\'SlapOS Machine Authentication Plugin\',\n
\'SlapOS Shadow Authentication Plugin\',\n
]\n
}\n
context.Alarm_checkPromiseSlapOSPASBase(promise_dict, tag, fixit=fixit, **kw)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
tag, fixit=False, **kw
</string>
</value>
<value>
<string>
tag, fixit=False, **kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPASBase.py
0 → 100644
View file @
f449cb6c
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
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_checkPromiseSlapOSPASBase.xml
View file @
f449cb6c
...
@@ -48,57 +48,6 @@
...
@@ -48,57 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
portal = context.getPortalObject()\n
def mergePASDictDifference(portal, d, fixit):\n
plugins = portal.acl_users.plugins\n
error_list = []\n
plugin_type_info = plugins.listPluginTypeInfo()\n
for plugin, active_list in d.iteritems():\n
plugin_info = [q for q in plugin_type_info if q[\'id\'] == plugin][0]\n
found_list = plugins.listPlugins(plugin_info[\'interface\'])\n
meta_type_list = [q[1].meta_type for q in found_list]\n
for expected in active_list:\n
if expected not in meta_type_list:\n
error = \'Plugin %s missing %s.\' % (plugin, expected)\n
if fixit:\n
existing = [q for q in portal.acl_users.objectValues() if q.meta_type == expected]\n
if len(existing) == 0:\n
error_list.append(\'%s not found\' % expected)\n
else:\n
plugins.activatePlugin(plugin_info[\'interface\'], existing[0].getId())\n
error += \' Fixed.\'\n
error_list.append(error)\n
\n
return error_list\n
\n
pas_difference = mergePASDictDifference(portal, promise_dict, fixit)\n
if len(pas_difference) != 0:\n
if fixit:\n
severity = 0\n
else:\n
severity = 1\n
summary = "PAS not configured as expected"\n
if fixit:\n
summary += \' (fixed)\'\n
detail = "Difference:\\n%s" % (\'\\n\'.join(pas_difference), )\n
else:\n
severity = 0\n
summary = "Nothing to do."\n
detail = ""\n
\n
active_result = ActiveResult()\n
active_result.edit(\n
summary=summary, \n
severity=severity,\n
detail=detail)\n
\n
context.newActiveProcess().postResult(active_result)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
promise_dict, tag, fixit=False, **kw
</string>
</value>
<value>
<string>
promise_dict, tag, fixit=False, **kw
</string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_fixWithActiveSense.py
0 → 100644
View file @
f449cb6c
context
.
activeSense
(
fixit
=
1
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Alarm_fixWithActiveSense.xml
View file @
f449cb6c
...
@@ -48,11 +48,6 @@
...
@@ -48,11 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
context.activeSense(fixit=1)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Module_assertIdGenerator.py
0 → 100644
View file @
f449cb6c
current_id_generator
=
context
.
getIdGenerator
()
if
current_id_generator
!=
id_generator
:
if
fixit
:
context
.
setIdGenerator
(
id_generator
)
return
False
return
True
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud_promise/Module_assertIdGenerator.xml
View file @
f449cb6c
...
@@ -48,17 +48,6 @@
...
@@ -48,17 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
current_id_generator = context.getIdGenerator()\n
\n
if current_id_generator != id_generator:\n
if fixit:\n
context.setIdGenerator(id_generator)\n
return False\n
return True\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
id_generator, fixit, active_process=None
</string>
</value>
<value>
<string>
id_generator, fixit, active_process=None
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_approveRegistration.py
0 → 100644
View file @
f449cb6c
computer
=
state_change
[
'object'
]
portal
=
computer
.
getPortalObject
()
person
=
portal
.
ERP5Site_getAuthenticatedMemberPersonValue
()
computer
.
edit
(
allocation_scope
=
'open/personal'
,
source_administration_value
=
person
,
)
portal
.
portal_workflow
.
doActionFor
(
computer
,
'validate_action'
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_approveRegistration.xml
View file @
f449cb6c
...
@@ -48,18 +48,6 @@
...
@@ -48,18 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = state_change[\'object\']\n
portal = computer.getPortalObject()\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
computer.edit(\n
allocation_scope=\'open/personal\',\n
source_administration_value=person,\n
)\n
portal.portal_workflow.doActionFor(computer, \'validate_action\')\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_generateCertificate.py
0 → 100644
View file @
f449cb6c
computer
=
state_change
[
'object'
]
if
computer
.
getDestinationReference
()
is
not
None
:
context
.
REQUEST
.
set
(
"computer_certificate"
,
None
)
context
.
REQUEST
.
set
(
"computer_key"
,
None
)
raise
ValueError
(
'Certificate still active.'
)
ca
=
context
.
getPortalObject
().
portal_certificate_authority
certificate_dict
=
ca
.
getNewCertificate
(
computer
.
getReference
())
computer
.
setDestinationReference
(
certificate_dict
[
"id"
])
context
.
REQUEST
.
set
(
"computer_certificate"
,
certificate_dict
[
"certificate"
])
context
.
REQUEST
.
set
(
"computer_key"
,
certificate_dict
[
"key"
])
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_generateCertificate.xml
View file @
f449cb6c
...
@@ -48,24 +48,6 @@
...
@@ -48,24 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = state_change[\'object\']\n
\n
if computer.getDestinationReference() is not None:\n
context.REQUEST.set("computer_certificate", None)\n
context.REQUEST.set("computer_key", None)\n
raise ValueError(\'Certificate still active.\')\n
\n
ca = context.getPortalObject().portal_certificate_authority\n
certificate_dict = ca.getNewCertificate(computer.getReference())\n
\n
computer.setDestinationReference(certificate_dict["id"])\n
\n
context.REQUEST.set("computer_certificate", certificate_dict["certificate"])\n
context.REQUEST.set("computer_key", certificate_dict["key"])\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_reportBang.py
0 → 100644
View file @
f449cb6c
computer
=
state_change
[
'object'
]
portal
=
computer
.
getPortalObject
()
for
computer_partition
in
[
x
for
x
in
computer
.
contentValues
(
portal_type
=
'Computer Partition'
)
if
x
.
getSlapState
()
==
'busy'
]:
for
instance_sql
in
portal
.
portal_catalog
(
default_aggregate_uid
=
computer_partition
.
getUid
(),
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
):
instance
=
instance_sql
.
getObject
()
if
instance
.
getSlapState
()
in
[
"start_requested"
,
"stop_requested"
]:
instance
.
activate
().
SoftwareInstance_bangAsSelf
(
relative_url
=
instance
.
getRelativeUrl
(),
reference
=
instance
.
getReference
(),
comment
=
state_change
.
kwargs
.
get
(
'comment'
,
''
))
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_reportBang.xml
View file @
f449cb6c
...
@@ -48,23 +48,6 @@
...
@@ -48,23 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = state_change[\'object\']\n
portal = computer.getPortalObject()\n
for computer_partition in [x for x in computer.contentValues(portal_type=\'Computer Partition\') if x.getSlapState() == \'busy\']:\n
for instance_sql in portal.portal_catalog(\n
default_aggregate_uid=computer_partition.getUid(),\n
portal_type=["Software Instance", "Slave Instance"],\n
):\n
instance = instance_sql.getObject()\n
if instance.getSlapState() in ["start_requested", "stop_requested"]:\n
instance.activate().SoftwareInstance_bangAsSelf(\n
relative_url=instance.getRelativeUrl(),\n
reference=instance.getReference(), \n
comment=state_change.kwargs.get(\'comment\', \'\'))\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.py
0 → 100644
View file @
f449cb6c
computer
=
state_change
[
'object'
]
portal
=
computer
.
getPortalObject
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
software_release_url
=
kwargs
[
'software_release_url'
]
state
=
kwargs
[
"state"
]
except
KeyError
:
raise
TypeError
(
"Computer_requestSoftwareReleaseChange takes exactly 2 arguments"
)
tag
=
"%s_%s_inProgress"
%
(
computer
.
getUid
(),
software_release_url
)
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
software_installation_portal_type
=
'Software Installation'
# Check if it already exists
software_installation_list
=
portal
.
portal_catalog
(
portal_type
=
software_installation_portal_type
,
url_string
=
{
'query'
:
software_release_url
,
'key'
:
'ExactMatch'
},
validation_state
=
"validated"
,
default_aggregate_uid
=
computer
.
getUid
(),
limit
=
2
,
)
if
len
(
software_installation_list
)
>
1
:
raise
NotImplementedError
(
"Too many Software Installation %s found %s"
%
(
software_release_url
,
[
x
.
path
for
x
in
software_installation_list
]))
elif
len
(
software_installation_list
)
==
1
:
software_installation
=
software_installation_list
[
0
].
getObject
()
if
(
software_installation
.
getUrlString
()
!=
software_release_url
)
or
\
(
software_installation
.
getValidationState
()
!=
"validated"
)
or
\
(
software_installation
.
getAggregate
()
!=
computer
.
getRelativeUrl
()):
raise
NotImplementedError
(
"The system was not able to get the expected Software Installation"
)
else
:
if
(
state
==
"destroyed"
):
# No need to create destroyed subscription.
return
software_installation_reference
=
"SOFTINSTALL-%s"
%
context
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_software_installation_reference'
,
id_generator
=
'uid'
)
software_installation
=
portal
.
getDefaultModule
(
portal_type
=
software_installation_portal_type
).
newContent
(
portal_type
=
software_installation_portal_type
,
reference
=
software_installation_reference
,
url_string
=
software_release_url
,
aggregate
=
computer
.
getRelativeUrl
(),
activate_kw
=
{
'tag'
:
tag
},
destination_section
=
computer
.
getSourceAdministration
()
)
# Change desired state
if
(
state
==
"available"
):
software_installation
.
requestStart
()
elif
(
state
==
"destroyed"
):
software_installation
.
requestDestroy
(
activate_kw
=
{
'tag'
:
tag
})
else
:
raise
ValueError
(
"state should be available or destroyed, but is %s"
%
state
)
# Change the state at the end to allow to execute updateLocalRoles only once in the transaction
validation_state
=
software_installation
.
getValidationState
()
slap_state
=
software_installation
.
getSlapState
()
if
validation_state
==
'draft'
:
portal
.
portal_workflow
.
doActionFor
(
software_installation
,
'validate_action'
)
context
.
REQUEST
.
set
(
'software_installation_url'
,
software_installation
.
getRelativeUrl
())
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.xml
View file @
f449cb6c
...
@@ -48,84 +48,6 @@
...
@@ -48,84 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
computer = state_change[\'object\']\n
portal = computer.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
software_release_url = kwargs[\'software_release_url\']\n
state = kwargs["state"]\n
except KeyError:\n
raise TypeError("Computer_requestSoftwareReleaseChange takes exactly 2 arguments")\n
\n
tag = "%s_%s_inProgress" % (computer.getUid(), \n
software_release_url)\n
\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
software_installation_portal_type = \'Software Installation\'\n
# Check if it already exists\n
software_installation_list = portal.portal_catalog(\n
portal_type=software_installation_portal_type,\n
url_string={\'query\': software_release_url, \'key\': \'ExactMatch\'},\n
validation_state="validated",\n
default_aggregate_uid=computer.getUid(),\n
limit=2,\n
)\n
\n
if len(software_installation_list) > 1:\n
raise NotImplementedError("Too many Software Installation %s found %s" % (software_release_url, [x.path for x in software_installation_list]))\n
elif len(software_installation_list) == 1:\n
software_installation = software_installation_list[0].getObject()\n
if (software_installation.getUrlString() != software_release_url) or \\\n
(software_installation.getValidationState() != "validated") or \\\n
(software_installation.getAggregate() != computer.getRelativeUrl()):\n
raise NotImplementedError("The system was not able to get the expected Software Installation")\n
else:\n
if (state == "destroyed"):\n
# No need to create destroyed subscription.\n
return\n
software_installation_reference = "SOFTINSTALL-%s" % context.getPortalObject().portal_ids\\\n
.generateNewId(id_group=\'slap_software_installation_reference\', id_generator=\'uid\')\n
software_installation = portal.getDefaultModule(portal_type=software_installation_portal_type).newContent(\n
portal_type=software_installation_portal_type,\n
reference=software_installation_reference,\n
url_string=software_release_url,\n
aggregate=computer.getRelativeUrl(),\n
activate_kw={\'tag\': tag},\n
destination_section=computer.getSourceAdministration()\n
)\n
\n
# Change desired state\n
if (state == "available"):\n
software_installation.requestStart()\n
elif (state == "destroyed"):\n
software_installation.requestDestroy(activate_kw={\'tag\': tag})\n
else:\n
raise ValueError("state should be available or destroyed, but is %s" % state)\n
\n
# Change the state at the end to allow to execute updateLocalRoles only once in the transaction\n
validation_state = software_installation.getValidationState()\n
slap_state = software_installation.getSlapState()\n
if validation_state == \'draft\':\n
portal.portal_workflow.doActionFor(software_installation,\n
\'validate_action\')\n
\n
context.REQUEST.set(\'software_installation_url\', software_installation.getRelativeUrl())\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_revokeCertificate.py
0 → 100644
View file @
f449cb6c
computer
=
state_change
[
'object'
]
context
.
REQUEST
.
set
(
'computer_certificate'
,
None
)
context
.
REQUEST
.
set
(
'computer_key'
,
None
)
destination_reference
=
computer
.
getDestinationReference
()
if
destination_reference
is
None
:
raise
ValueError
(
'No certificate'
)
context
.
getPortalObject
().
portal_certificate_authority
.
revokeCertificate
(
destination_reference
)
computer
.
setDestinationReference
(
None
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_revokeCertificate.xml
View file @
f449cb6c
...
@@ -48,18 +48,6 @@
...
@@ -48,18 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = state_change[\'object\']\n
context.REQUEST.set(\'computer_certificate\', None)\n
context.REQUEST.set(\'computer_key\', None)\n
destination_reference = computer.getDestinationReference()\n
if destination_reference is None:\n
raise ValueError(\'No certificate\')\n
context.getPortalObject().portal_certificate_authority.revokeCertificate(destination_reference)\n
computer.setDestinationReference(None)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/Instance_checkConsistency.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
instance
.
Base_checkConsistency
()
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/Instance_checkConsistency.xml
View file @
f449cb6c
...
@@ -48,12 +48,6 @@
...
@@ -48,12 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
instance.Base_checkConsistency()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_allocatePartition.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
assert
instance
.
getPortalType
()
in
[
"Software Instance"
,
"Slave Instance"
]
portal
=
instance
.
getPortalObject
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
computer_partition_url
=
kwargs
[
'computer_partition_url'
]
except
KeyError
:
raise
TypeError
,
"RequestedInstance_allocatePartition takes exactly 1 argument"
assert
instance
.
getAggregateValue
()
is
None
computer_partition
=
portal
.
restrictedTraverse
(
computer_partition_url
)
assert
computer_partition
.
getPortalType
()
==
"Computer Partition"
instance
.
edit
(
aggregate_value
=
computer_partition
,
activate_kw
=
{
'tag'
:
'allocate_%s'
%
computer_partition_url
})
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_allocatePartition.xml
View file @
f449cb6c
...
@@ -48,28 +48,6 @@
...
@@ -48,28 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
assert instance.getPortalType() in ["Software Instance", "Slave Instance"]\n
portal = instance.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
computer_partition_url = kwargs[\'computer_partition_url\']\n
except KeyError:\n
raise TypeError, "RequestedInstance_allocatePartition takes exactly 1 argument"\n
\n
assert instance.getAggregateValue() is None\n
computer_partition = portal.restrictedTraverse(computer_partition_url)\n
assert computer_partition.getPortalType() == "Computer Partition"\n
\n
instance.edit(aggregate_value=computer_partition, activate_kw={\'tag\': \'allocate_%s\' % computer_partition_url})\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
if
(
instance
.
getPortalType
()
in
[
"Software Instance"
,
"Slave Instance"
])
and
(
instance
.
getSlapState
()
!=
'destroy_requested'
):
instance
.
bang
(
bang_tree
=
False
,
comment
=
"State changed from %s to destroy_requested"
%
instance
.
getSlapState
())
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.xml
View file @
f449cb6c
...
@@ -48,13 +48,6 @@
...
@@ -48,13 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
if (instance.getPortalType() in ["Software Instance", "Slave Instance"]) and (instance.getSlapState() != \'destroy_requested\'):\n
instance.bang(bang_tree=False, comment="State changed from %s to destroy_requested" % instance.getSlapState())\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
if
(
instance
.
getPortalType
()
in
[
"Software Instance"
,
"Slave Instance"
])
and
(
instance
.
getSlapState
()
!=
'start_requested'
):
instance
.
bang
(
bang_tree
=
False
,
comment
=
"State changed from %s to start_requested"
%
instance
.
getSlapState
())
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.xml
View file @
f449cb6c
...
@@ -48,13 +48,6 @@
...
@@ -48,13 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
if (instance.getPortalType() in ["Software Instance", "Slave Instance"]) and (instance.getSlapState() != \'start_requested\'):\n
instance.bang(bang_tree=False, comment="State changed from %s to start_requested" % instance.getSlapState())\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
if
(
instance
.
getPortalType
()
in
[
"Software Instance"
,
"Slave Instance"
])
and
(
instance
.
getSlapState
()
!=
'stop_requested'
):
instance
.
bang
(
bang_tree
=
False
,
comment
=
"State changed from %s to stop_requested"
%
instance
.
getSlapState
())
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.xml
View file @
f449cb6c
...
@@ -48,13 +48,6 @@
...
@@ -48,13 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
if (instance.getPortalType() in ["Software Instance", "Slave Instance"]) and (instance.getSlapState() != \'stop_requested\'):\n
instance.bang(bang_tree=False, comment="State changed from %s to stop_requested" % instance.getSlapState())\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.py
0 → 100644
View file @
f449cb6c
from
DateTime
import
DateTime
instance
=
state_change
[
'object'
]
assert
instance
.
getPortalType
()
in
[
"Slave Instance"
,
"Software Instance"
]
instance
.
edit
(
bang_timestamp
=
int
(
DateTime
()))
comment
=
state_change
.
kwargs
[
'comment'
]
# comment is required to pass the transition
if
state_change
.
kwargs
[
'bang_tree'
]:
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
portal
=
instance
.
getPortalObject
()
hosting_subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
portal
.
portal_catalog
.
searchAndActivate
(
default_specialise_uid
=
hosting_subscription
.
getUid
(),
path
=
NegatedQuery
(
Query
(
path
=
instance
.
getPath
())),
portal_type
=
[
"Slave Instance"
,
"Software Instance"
],
method_id
=
'bang'
,
method_kw
=
{
'bang_tree'
:
False
,
'comment'
:
comment
},
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml
View file @
f449cb6c
...
@@ -48,27 +48,6 @@
...
@@ -48,27 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
from DateTime import DateTime\n
instance = state_change[\'object\']\n
assert instance.getPortalType() in ["Slave Instance", "Software Instance"]\n
\n
instance.edit(bang_timestamp=int(DateTime()))\n
comment = state_change.kwargs[\'comment\'] # comment is required to pass the transition\n
if state_change.kwargs[\'bang_tree\']:\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
portal = instance.getPortalObject()\n
hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
portal.portal_catalog.searchAndActivate(\n
default_specialise_uid=hosting_subscription.getUid(),\n
path=NegatedQuery(Query(path=instance.getPath())),\n
portal_type=["Slave Instance", "Software Instance"],\n
method_id=\'bang\',\n
method_kw={\'bang_tree\': False, \'comment\': comment},\n
)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangResquesterInstance.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
portal
=
instance
.
getPortalObject
()
for
requester_instance
in
portal
.
portal_catalog
(
portal_type
=
"Software Instance"
,
default_predecessor_uid
=
instance
.
getUid
()):
requester_instance
.
getObject
().
bang
(
bang_tree
=
False
,
comment
=
"%s parameters changed"
%
instance
.
getRelativeUrl
())
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangResquesterInstance.xml
View file @
f449cb6c
...
@@ -48,19 +48,6 @@
...
@@ -48,19 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
portal = instance.getPortalObject()\n
\n
for requester_instance in portal.portal_catalog(\n
portal_type="Software Instance",\n
default_predecessor_uid=instance.getUid()):\n
requester_instance.getObject().bang(\n
bang_tree=False,\n
comment="%s parameters changed" % instance.getRelativeUrl())\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_rename.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
portal
=
instance
.
getPortalObject
()
software_title
=
state_change
.
kwargs
[
'new_name'
]
assert
instance
.
getPortalType
()
in
[
"Slave Instance"
,
"Software Instance"
]
hosting_subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
# Instance can be moved from one requester to another
# Prevent creating two instances with the same title
tag
=
"%s_%s_inProgress"
%
(
hosting_subscription
.
getUid
(),
software_title
)
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
# Check if it already exists
request_software_instance_list
=
portal
.
portal_catalog
(
# Fetch all portal type, as it is not allowed to change it
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
title
=
{
'query'
:
software_title
,
'key'
:
'ExactMatch'
},
specialise_uid
=
hosting_subscription
.
getUid
(),
# Do not fetch destroyed instances
# XXX slap_state=["start_requested", "stop_requested"],
validation_state
=
"validated"
,
limit
=
1
,
)
if
len
(
request_software_instance_list
)
==
1
:
raise
ValueError
,
"Too many instances '%s' found: %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_software_instance_list
])
# Change the title
instance
.
edit
(
title
=
software_title
,
activate_kw
=
{
'tag'
:
tag
})
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_rename.xml
View file @
f449cb6c
...
@@ -48,46 +48,6 @@
...
@@ -48,46 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
instance = state_change[\'object\']\n
portal = instance.getPortalObject()\n
software_title = state_change.kwargs[\'new_name\']\n
\n
assert instance.getPortalType() in ["Slave Instance", "Software Instance"]\n
\n
hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
\n
# Instance can be moved from one requester to another\n
# Prevent creating two instances with the same title\n
tag = "%s_%s_inProgress" % (hosting_subscription.getUid(), software_title)\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
# Check if it already exists\n
request_software_instance_list = portal.portal_catalog(\n
# Fetch all portal type, as it is not allowed to change it\n
portal_type=["Software Instance", "Slave Instance"],\n
title={\'query\': software_title, \'key\': \'ExactMatch\'},\n
specialise_uid=hosting_subscription.getUid(),\n
# Do not fetch destroyed instances\n
# XXX slap_state=["start_requested", "stop_requested"],\n
validation_state="validated",\n
limit=1,\n
)\n
if len(request_software_instance_list) == 1:\n
raise ValueError, "Too many instances \'%s\' found: %s" % (software_title, [x.path for x in request_software_instance_list])\n
\n
# Change the title\n
instance.edit(title=software_title, activate_kw={\'tag\': tag})\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_unallocatePartition.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
assert
instance
.
getPortalType
()
in
[
"Software Instance"
,
"Slave Instance"
]
assert
instance
.
getAggregate
(
""
)
!=
""
instance
.
edit
(
aggregate
=
""
,
activate_kw
=
{
'tag'
:
'allocate_%s'
%
instance
.
getAggregate
()})
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_unallocatePartition.xml
View file @
f449cb6c
...
@@ -48,15 +48,6 @@
...
@@ -48,15 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
assert instance.getPortalType() in ["Software Instance", "Slave Instance"]\n
assert instance.getAggregate("") != ""\n
\n
instance.edit(aggregate="", activate_kw={\'tag\': \'allocate_%s\' % instance.getAggregate()})\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateConnectionInformation.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
portal
=
instance
.
getPortalObject
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
connection_xml
=
state_change
.
kwargs
[
'connection_xml'
]
except
KeyError
:
raise
TypeError
,
"RequestedInstance_updateConnectionInformation takes exactly 1 arguments"
edit_kw
=
{
'connection_xml'
:
connection_xml
,
}
instance
.
edit
(
**
edit_kw
)
# Prevent storing broken XML in text content (which prevent to update parameters after)
context
.
Instance_checkConsistency
(
state_change
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateConnectionInformation.xml
View file @
f449cb6c
...
@@ -48,29 +48,6 @@
...
@@ -48,29 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
portal = instance.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
connection_xml = state_change.kwargs[\'connection_xml\']\n
except KeyError:\n
raise TypeError, "RequestedInstance_updateConnectionInformation takes exactly 1 arguments"\n
\n
edit_kw = {\n
\'connection_xml\': connection_xml,\n
}\n
\n
instance.edit(**edit_kw)\n
# Prevent storing broken XML in text content (which prevent to update parameters after)\n
context.Instance_checkConsistency(state_change)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateParameterInformation.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
portal
=
instance
.
getPortalObject
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
software_release_url_string
=
state_change
.
kwargs
[
'software_release'
]
software_type
=
kwargs
[
"software_type"
]
instance_xml
=
kwargs
[
"instance_xml"
]
sla_xml
=
kwargs
[
"sla_xml"
]
is_slave
=
kwargs
[
"shared"
]
except
KeyError
:
raise
TypeError
,
"RequestedInstance_updateParameterInformation takes exactly 5 arguments"
edit_kw
=
{
'url_string'
:
software_release_url_string
,
'text_content'
:
instance_xml
,
'source_reference'
:
software_type
,
'sla_xml'
:
sla_xml
,
}
# Check the slave management
if
is_slave
not
in
[
True
,
False
]:
raise
ValueError
,
"shared should be a boolean"
instance_portal_type
=
instance
.
getPortalType
()
if
instance_portal_type
==
"Hosting Subscription"
:
edit_kw
[
'root_slave'
]
=
is_slave
elif
instance_portal_type
==
"Software Instance"
:
if
is_slave
:
raise
NotImplementedError
,
"Please destroy before doing a slave instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
elif
instance_portal_type
==
"Slave Instance"
:
if
not
is_slave
:
raise
NotImplementedError
,
"Please destroy before doing a software instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
else
:
raise
NotImplementedError
,
"Not supported portal type %s (%s)"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
instance
.
edit
(
**
edit_kw
)
# Prevent storing broken XML in text content (which prevent to update parameters after)
context
.
Instance_checkConsistency
(
state_change
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_updateParameterInformation.xml
View file @
f449cb6c
...
@@ -48,54 +48,6 @@
...
@@ -48,54 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
portal = instance.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
software_release_url_string = state_change.kwargs[\'software_release\']\n
software_type = kwargs["software_type"]\n
instance_xml = kwargs["instance_xml"]\n
sla_xml = kwargs["sla_xml"]\n
is_slave = kwargs["shared"]\n
except KeyError:\n
raise TypeError, "RequestedInstance_updateParameterInformation takes exactly 5 arguments"\n
\n
edit_kw = {\n
\'url_string\': software_release_url_string,\n
\'text_content\': instance_xml,\n
\'source_reference\': software_type,\n
\'sla_xml\': sla_xml,\n
}\n
\n
# Check the slave management\n
if is_slave not in [True, False]:\n
raise ValueError, "shared should be a boolean"\n
instance_portal_type = instance.getPortalType()\n
if instance_portal_type == "Hosting Subscription":\n
edit_kw[\'root_slave\'] = is_slave\n
elif instance_portal_type == "Software Instance":\n
if is_slave:\n
raise NotImplementedError, "Please destroy before doing a slave instance (%s)" % \\\n
(instance.getRelativeUrl(), )\n
elif instance_portal_type == "Slave Instance":\n
if not is_slave:\n
raise NotImplementedError, "Please destroy before doing a software instance (%s)" % \\\n
(instance.getRelativeUrl(), )\n
else:\n
raise NotImplementedError, "Not supported portal type %s (%s)" % \\\n
(instance.getPortalType(), instance.getRelativeUrl())\n
\n
instance.edit(**edit_kw)\n
# Prevent storing broken XML in text content (which prevent to update parameters after)\n
context.Instance_checkConsistency(state_change)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.py
0 → 100644
View file @
f449cb6c
requester_instance
=
state_change
[
'object'
]
portal
=
requester_instance
.
getPortalObject
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
software_release_url_string
=
kwargs
[
'software_release'
]
software_title
=
kwargs
[
"software_title"
]
software_type
=
kwargs
[
"software_type"
]
instance_xml
=
kwargs
[
"instance_xml"
]
sla_xml
=
kwargs
[
"sla_xml"
]
is_slave
=
kwargs
[
"shared"
]
root_state
=
kwargs
[
"state"
]
except
KeyError
:
raise
raise
TypeError
,
"RequesterInstance_request takes exactly 7 arguments"
if
is_slave
not
in
[
True
,
False
]:
raise
ValueError
,
"shared should be a boolean"
# Hosting subscriptin is used as the root of the instance tree
if
requester_instance
.
getPortalType
()
==
"Hosting Subscription"
:
hosting_subscription
=
requester_instance
else
:
hosting_subscription
=
requester_instance
.
getSpecialiseValue
(
portal_type
=
"Hosting Subscription"
)
# Instance can be moved from one requester to another
# Prevent creating two instances with the same title
tag
=
"%s_%s_inProgress"
%
(
hosting_subscription
.
getUid
(),
software_title
)
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
# graph allows to "simulate" tree change after requested operation
graph
=
{}
predecessor_list
=
hosting_subscription
.
getPredecessorValueList
()
graph
[
hosting_subscription
.
getUid
()]
=
[
predecessor
.
getUid
()
for
predecessor
in
predecessor_list
]
while
True
:
try
:
current_software_instance
=
predecessor_list
.
pop
(
0
)
except
IndexError
:
break
current_software_instance_predecessor_list
=
current_software_instance
.
getPredecessorValueList
()
or
[]
graph
[
current_software_instance
.
getUid
()]
=
[
predecessor
.
getUid
()
for
predecessor
in
current_software_instance_predecessor_list
]
predecessor_list
.
extend
(
current_software_instance_predecessor_list
)
# Check if it already exists
request_software_instance_list
=
portal
.
portal_catalog
(
# Fetch all portal type, as it is not allowed to change it
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
title
=
{
'query'
:
software_title
,
'key'
:
'ExactMatch'
},
specialise_uid
=
hosting_subscription
.
getUid
(),
# Do not fetch destroyed instances
# XXX slap_state=["start_requested", "stop_requested"],
validation_state
=
"validated"
,
limit
=
2
,
)
instance_count
=
len
(
request_software_instance_list
)
if
instance_count
==
0
:
request_software_instance
=
None
elif
instance_count
==
1
:
request_software_instance
=
request_software_instance_list
[
0
].
getObject
()
else
:
raise
ValueError
,
"Too many instances '%s' found: %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_software_instance_list
])
if
(
request_software_instance
is
None
):
if
(
root_state
==
"destroyed"
):
instance_found
=
False
else
:
instance_found
=
True
# First time that the software instance is requested
# Create a new one
reference
=
"SOFTINST-%s"
%
portal
.
portal_ids
.
generateNewId
(
id_group
=
'slap_software_instance_reference'
,
id_generator
=
'uid'
)
new_content_kw
=
{}
if
is_slave
==
True
:
software_instance_portal_type
=
"Slave Instance"
else
:
software_instance_portal_type
=
"Software Instance"
certificate_dict
=
portal
.
portal_certificate_authority
.
getNewCertificate
(
reference
)
new_content_kw
[
'destination_reference'
]
=
certificate_dict
[
'id'
]
new_content_kw
[
'ssl_key'
]
=
certificate_dict
[
'key'
]
new_content_kw
[
'ssl_certificate'
]
=
certificate_dict
[
'certificate'
]
module
=
portal
.
getDefaultModule
(
portal_type
=
"Software Instance"
)
request_software_instance
=
module
.
newContent
(
portal_type
=
software_instance_portal_type
,
title
=
software_title
,
specialise_value
=
hosting_subscription
,
reference
=
reference
,
activate_kw
=
{
'tag'
:
tag
},
**
new_content_kw
)
# request_software_instance.portal_workflow.doActionFor(request_software_instance, 'validate_action')
request_software_instance
.
validate
()
graph
[
request_software_instance
.
getUid
()]
=
[]
else
:
instance_found
=
True
# Update the predecessor category of the previous requester
predecessor
=
request_software_instance
.
getPredecessorRelatedValue
(
portal_type
=
"Software Instance"
)
if
(
predecessor
is
None
):
if
(
requester_instance
.
getPortalType
()
!=
"Hosting Subscription"
):
raise
ValueError
(
'It is disallowed to request root software instance %s'
%
request_software_instance
.
getRelativeUrl
())
else
:
predecessor
=
requester_instance
predecessor_uid_list
=
predecessor
.
getPredecessorUidList
()
predecessor_uid_list
.
remove
(
request_software_instance
.
getUid
())
predecessor
.
edit
(
predecessor_uid_list
=
predecessor_uid_list
)
graph
[
predecessor
.
getUid
()]
=
predecessor_uid_list
if
instance_found
:
# Change desired state
promise_kw
=
{
'instance_xml'
:
instance_xml
,
'software_type'
:
software_type
,
'sla_xml'
:
sla_xml
,
'software_release'
:
software_release_url_string
,
'shared'
:
is_slave
,
}
request_software_instance_url
=
request_software_instance
.
getRelativeUrl
()
context
.
REQUEST
.
set
(
'request_instance'
,
request_software_instance
)
if
(
root_state
==
"started"
):
request_software_instance
.
requestStart
(
**
promise_kw
)
elif
(
root_state
==
"stopped"
):
request_software_instance
.
requestStop
(
**
promise_kw
)
elif
(
root_state
==
"destroyed"
):
request_software_instance
.
requestDestroy
(
**
promise_kw
)
context
.
REQUEST
.
set
(
'request_instance'
,
None
)
else
:
raise
ValueError
,
"state should be started, stopped or destroyed"
predecessor_list
=
requester_instance
.
getPredecessorList
()
+
[
request_software_instance_url
]
uniq_predecessor_list
=
list
(
set
(
predecessor_list
))
predecessor_list
.
sort
()
uniq_predecessor_list
.
sort
()
assert
predecessor_list
==
uniq_predecessor_list
,
"%s != %s"
%
(
predecessor_list
,
uniq_predecessor_list
)
# update graph to reflect requested operation
graph
[
requester_instance
.
getUid
()]
=
requester_instance
.
getPredecessorUidList
()
+
[
request_software_instance
.
getUid
()]
# check if all elements are still connected and if there is no cycle
request_software_instance
.
checkConnected
(
graph
,
hosting_subscription
.
getUid
())
request_software_instance
.
checkNotCyclic
(
graph
)
requester_instance
.
edit
(
predecessor_list
=
predecessor_list
)
else
:
context
.
REQUEST
.
set
(
'request_instance'
,
None
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml
View file @
f449cb6c
...
@@ -48,172 +48,6 @@
...
@@ -48,172 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
requester_instance = state_change[\'object\']\n
portal = requester_instance.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
software_release_url_string = kwargs[\'software_release\']\n
software_title = kwargs["software_title"]\n
software_type = kwargs["software_type"]\n
instance_xml = kwargs["instance_xml"]\n
sla_xml = kwargs["sla_xml"]\n
is_slave = kwargs["shared"]\n
root_state = kwargs["state"]\n
except KeyError:\n
raise\n
raise TypeError, "RequesterInstance_request takes exactly 7 arguments"\n
\n
if is_slave not in [True, False]:\n
raise ValueError, "shared should be a boolean"\n
\n
# Hosting subscriptin is used as the root of the instance tree\n
if requester_instance.getPortalType() == "Hosting Subscription":\n
hosting_subscription = requester_instance\n
else:\n
hosting_subscription = requester_instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
\n
# Instance can be moved from one requester to another\n
# Prevent creating two instances with the same title\n
tag = "%s_%s_inProgress" % (hosting_subscription.getUid(), software_title)\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
# graph allows to "simulate" tree change after requested operation\n
graph = {}\n
predecessor_list = hosting_subscription.getPredecessorValueList()\n
graph[hosting_subscription.getUid()] = [predecessor.getUid() for predecessor in predecessor_list]\n
while True:\n
try:\n
current_software_instance = predecessor_list.pop(0)\n
except IndexError:\n
break\n
current_software_instance_predecessor_list = current_software_instance.getPredecessorValueList() or []\n
graph[current_software_instance.getUid()] = [predecessor.getUid()\n
for predecessor in current_software_instance_predecessor_list]\n
predecessor_list.extend(current_software_instance_predecessor_list)\n
\n
# Check if it already exists\n
request_software_instance_list = portal.portal_catalog(\n
# Fetch all portal type, as it is not allowed to change it\n
portal_type=["Software Instance", "Slave Instance"],\n
title={\'query\': software_title, \'key\': \'ExactMatch\'},\n
specialise_uid=hosting_subscription.getUid(),\n
# Do not fetch destroyed instances\n
# XXX slap_state=["start_requested", "stop_requested"],\n
validation_state="validated",\n
limit=2,\n
)\n
instance_count = len(request_software_instance_list)\n
if instance_count == 0:\n
request_software_instance = None\n
elif instance_count == 1:\n
request_software_instance = request_software_instance_list[0].getObject()\n
else:\n
raise ValueError, "Too many instances \'%s\' found: %s" % (software_title, [x.path for x in request_software_instance_list])\n
\n
if (request_software_instance is None):\n
if (root_state == "destroyed"):\n
instance_found = False\n
else:\n
instance_found = True\n
# First time that the software instance is requested\n
\n
# Create a new one\n
reference = "SOFTINST-%s" % portal.portal_ids.generateNewId(\n
id_group=\'slap_software_instance_reference\',\n
id_generator=\'uid\')\n
\n
new_content_kw = {}\n
if is_slave == True:\n
software_instance_portal_type = "Slave Instance"\n
else:\n
software_instance_portal_type = "Software Instance"\n
certificate_dict = portal.portal_certificate_authority.getNewCertificate(reference)\n
new_content_kw[\'destination_reference\'] = certificate_dict[\'id\']\n
new_content_kw[\'ssl_key\'] = certificate_dict[\'key\']\n
new_content_kw[\'ssl_certificate\'] = certificate_dict[\'certificate\']\n
\n
module = portal.getDefaultModule(portal_type="Software Instance")\n
request_software_instance = module.newContent(\n
portal_type=software_instance_portal_type,\n
title=software_title,\n
specialise_value=hosting_subscription,\n
reference=reference,\n
activate_kw={\'tag\': tag},\n
**new_content_kw\n
)\n
# request_software_instance.portal_workflow.doActionFor(request_software_instance, \'validate_action\')\n
request_software_instance.validate()\n
graph[request_software_instance.getUid()] = []\n
\n
else:\n
instance_found = True\n
# Update the predecessor category of the previous requester\n
predecessor = request_software_instance.getPredecessorRelatedValue(portal_type="Software Instance")\n
if (predecessor is None):\n
if (requester_instance.getPortalType() != "Hosting Subscription"):\n
raise ValueError(\'It is disallowed to request root software instance %s\' % request_software_instance.getRelativeUrl())\n
else:\n
predecessor = requester_instance\n
predecessor_uid_list = predecessor.getPredecessorUidList()\n
predecessor_uid_list.remove(request_software_instance.getUid())\n
predecessor.edit(predecessor_uid_list=predecessor_uid_list)\n
graph[predecessor.getUid()] = predecessor_uid_list\n
\n
if instance_found:\n
\n
# Change desired state\n
promise_kw = {\n
\'instance_xml\': instance_xml,\n
\'software_type\': software_type,\n
\'sla_xml\': sla_xml,\n
\'software_release\': software_release_url_string,\n
\'shared\': is_slave,\n
}\n
request_software_instance_url = request_software_instance.getRelativeUrl()\n
context.REQUEST.set(\'request_instance\', request_software_instance)\n
if (root_state == "started"):\n
request_software_instance.requestStart(**promise_kw)\n
elif (root_state == "stopped"):\n
request_software_instance.requestStop(**promise_kw)\n
elif (root_state == "destroyed"):\n
request_software_instance.requestDestroy(**promise_kw)\n
context.REQUEST.set(\'request_instance\', None)\n
else:\n
raise ValueError, "state should be started, stopped or destroyed"\n
\n
predecessor_list = requester_instance.getPredecessorList() + [request_software_instance_url]\n
uniq_predecessor_list = list(set(predecessor_list))\n
predecessor_list.sort()\n
uniq_predecessor_list.sort()\n
\n
assert predecessor_list == uniq_predecessor_list, "%s != %s" % (predecessor_list, uniq_predecessor_list)\n
\n
# update graph to reflect requested operation\n
graph[requester_instance.getUid()] = requester_instance.getPredecessorUidList() + [request_software_instance.getUid()]\n
\n
# check if all elements are still connected and if there is no cycle\n
request_software_instance.checkConnected(graph, hosting_subscription.getUid())\n
request_software_instance.checkNotCyclic(graph)\n
\n
requester_instance.edit(predecessor_list=predecessor_list)\n
\n
else:\n
context.REQUEST.set(\'request_instance\', None)\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_checkConsistency.py
0 → 100644
View file @
f449cb6c
person
=
state_change
[
'object'
]
person
.
Base_checkConsistency
()
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_checkConsistency.xml
View file @
f449cb6c
...
@@ -48,12 +48,6 @@
...
@@ -48,12 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
person = state_change[\'object\']\n
person.Base_checkConsistency()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestComputer.py
0 → 100644
View file @
f449cb6c
person
=
state_change
[
'object'
]
portal
=
person
.
getPortalObject
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
computer_title
=
kwargs
[
'computer_title'
]
except
KeyError
:
raise
TypeError
,
"Person_requestComputer takes exactly 1 argument"
tag
=
"%s_%s_computerInProgress"
%
(
person
.
getUid
(),
computer_title
)
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
computer_portal_type
=
"Computer"
computer_list
=
portal
.
portal_catalog
.
portal_catalog
(
portal_type
=
computer_portal_type
,
title
=
computer_title
,
limit
=
2
)
if
len
(
computer_list
)
==
2
:
raise
NotImplementedError
elif
len
(
computer_list
)
==
1
:
computer
=
computer_list
[
0
]
else
:
computer
=
None
if
computer
is
None
:
reference
=
"COMP-%s"
%
portal
.
portal_ids
.
generateNewId
(
id_group
=
'slap_computer_reference'
,
id_generator
=
'uid'
)
module
=
portal
.
getDefaultModule
(
portal_type
=
computer_portal_type
)
computer
=
module
.
newContent
(
portal_type
=
computer_portal_type
,
title
=
computer_title
,
reference
=
reference
,
capacity_scope
=
'open'
,
activate_kw
=
{
'tag'
:
tag
}
)
computer
.
requestComputerRegistration
()
computer
.
approveComputerRegistration
()
computer
=
context
.
restrictedTraverse
(
computer
.
getRelativeUrl
())
context
.
REQUEST
.
set
(
"computer"
,
computer
.
getRelativeUrl
())
context
.
REQUEST
.
set
(
"computer_url"
,
computer
.
absolute_url
())
context
.
REQUEST
.
set
(
"computer_reference"
,
computer
.
getReference
())
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestComputer.xml
View file @
f449cb6c
...
@@ -48,64 +48,6 @@
...
@@ -48,64 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
person = state_change[\'object\']\n
portal = person.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
computer_title = kwargs[\'computer_title\']\n
except KeyError:\n
raise TypeError, "Person_requestComputer takes exactly 1 argument"\n
\n
tag = "%s_%s_computerInProgress" % (person.getUid(), \n
computer_title)\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
computer_portal_type = "Computer"\n
computer_list = portal.portal_catalog.portal_catalog(portal_type=computer_portal_type, title=computer_title, limit=2)\n
\n
if len(computer_list) == 2:\n
raise NotImplementedError\n
elif len(computer_list) == 1:\n
computer = computer_list[0]\n
else:\n
computer = None\n
\n
if computer is None:\n
reference = "COMP-%s" % portal.portal_ids.generateNewId(\n
id_group=\'slap_computer_reference\',\n
id_generator=\'uid\')\n
module = portal.getDefaultModule(portal_type=computer_portal_type)\n
computer = module.newContent(\n
portal_type=computer_portal_type,\n
title=computer_title,\n
reference=reference,\n
capacity_scope=\'open\',\n
activate_kw={\'tag\': tag}\n
)\n
computer.requestComputerRegistration()\n
computer.approveComputerRegistration()\n
\n
\n
computer = context.restrictedTraverse(computer.getRelativeUrl())\n
\n
context.REQUEST.set("computer", computer.getRelativeUrl())\n
context.REQUEST.set("computer_url", computer.absolute_url())\n
context.REQUEST.set("computer_reference", computer.getReference())\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.py
0 → 100644
View file @
f449cb6c
person
=
state_change
[
'object'
]
portal
=
person
.
getPortalObject
()
# Get required arguments
kwargs
=
state_change
.
kwargs
# Required args
# Raise TypeError if all parameters are not provided
try
:
software_release_url_string
=
kwargs
[
'software_release'
]
software_title
=
kwargs
[
"software_title"
]
software_type
=
kwargs
[
"software_type"
]
instance_xml
=
kwargs
[
"instance_xml"
]
sla_xml
=
kwargs
[
"sla_xml"
]
is_slave
=
kwargs
[
"shared"
]
root_state
=
kwargs
[
"state"
]
except
KeyError
:
raise
TypeError
,
"Person_requestSoftwareInstance takes exactly 7 arguments"
if
is_slave
not
in
[
True
,
False
]:
raise
ValueError
,
"shared should be a boolean"
empty_parameter
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
</instance>"""
empty_parameter2
=
"""<?xml version='1.0' encoding='utf-8'?>
<instance/>"""
# XXX Hardcode default parameter
if
(
instance_xml
==
empty_parameter
)
or
(
instance_xml
.
startswith
(
empty_parameter2
)):
if
software_release_url_string
==
"http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5-frontend:/software/erp5/software.cfg"
:
instance_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="frontend-instance-guid">SOFTINST-9238</parameter>
<parameter id="frontend-software-url">http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg</parameter>
</instance>
"""
hosting_subscription_portal_type
=
"Hosting Subscription"
tag
=
"%s_%s_inProgress"
%
(
person
.
getUid
(),
software_title
)
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
# Check if it already exists
request_hosting_subscription_list
=
portal
.
portal_catalog
(
portal_type
=
hosting_subscription_portal_type
,
title
=
{
'query'
:
software_title
,
'key'
:
'ExactMatch'
},
validation_state
=
"validated"
,
default_destination_section_uid
=
person
.
getUid
(),
limit
=
2
,
)
if
len
(
request_hosting_subscription_list
)
>
1
:
raise
NotImplementedError
,
"Too many hosting subscription %s found %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_hosting_subscription_list
])
elif
len
(
request_hosting_subscription_list
)
==
1
:
request_hosting_subscription
=
request_hosting_subscription_list
[
0
].
getObject
()
if
(
request_hosting_subscription
.
getSlapState
()
==
"destroy_requested"
)
or
\
(
request_hosting_subscription
.
getTitle
()
!=
software_title
)
or
\
(
request_hosting_subscription
.
getValidationState
()
!=
"validated"
)
or
\
(
request_hosting_subscription
.
getDestinationSection
()
!=
person
.
getRelativeUrl
()):
raise
NotImplementedError
,
"The system was not able to get the expected hosting subscription"
else
:
if
(
root_state
==
"destroyed"
):
# No need to create destroyed subscription.
context
.
REQUEST
.
set
(
'request_hosting_subscription'
,
None
)
return
hosting_subscription_reference
=
"HOSTSUBS-%s"
%
context
.
getPortalObject
().
portal_ids
\
.
generateNewId
(
id_group
=
'slap_hosting_subscription_reference'
,
id_generator
=
'uid'
)
request_hosting_subscription
=
portal
.
getDefaultModule
(
portal_type
=
hosting_subscription_portal_type
).
newContent
(
portal_type
=
hosting_subscription_portal_type
,
reference
=
hosting_subscription_reference
,
title
=
software_title
,
destination_section
=
person
.
getRelativeUrl
(),
activate_kw
=
{
'tag'
:
tag
},
)
promise_kw
=
{
'instance_xml'
:
instance_xml
,
'software_type'
:
software_type
,
'sla_xml'
:
sla_xml
,
'software_release'
:
software_release_url_string
,
'shared'
:
is_slave
,
}
context
.
REQUEST
.
set
(
'request_hosting_subscription'
,
request_hosting_subscription
)
# Change desired state
if
(
root_state
==
"started"
):
request_hosting_subscription
.
requestStart
(
**
promise_kw
)
elif
(
root_state
==
"stopped"
):
request_hosting_subscription
.
requestStop
(
**
promise_kw
)
elif
(
root_state
==
"destroyed"
):
request_hosting_subscription
.
requestDestroy
(
**
promise_kw
)
context
.
REQUEST
.
set
(
'request_hosting_subscription'
,
None
)
else
:
raise
ValueError
,
"state should be started, stopped or destroyed"
request_hosting_subscription
.
requestInstance
(
software_release
=
software_release_url_string
,
software_title
=
software_title
,
software_type
=
software_type
,
instance_xml
=
instance_xml
,
sla_xml
=
sla_xml
,
shared
=
is_slave
,
state
=
root_state
,
)
# Change the state at the end to allow to execute updateLocalRoles only once in the transaction
validation_state
=
request_hosting_subscription
.
getValidationState
()
slap_state
=
request_hosting_subscription
.
getSlapState
()
if
validation_state
==
'draft'
:
request_hosting_subscription
.
portal_workflow
.
doActionFor
(
request_hosting_subscription
,
'validate_action'
)
if
(
validation_state
!=
'archived'
)
and
\
(
slap_state
==
'destroy_requested'
):
# XXX TODO do not use validation workflow to filter destroyed subscription
request_hosting_subscription
.
archive
()
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml
View file @
f449cb6c
...
@@ -48,134 +48,6 @@
...
@@ -48,134 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
person = state_change[\'object\']\n
portal = person.getPortalObject()\n
# Get required arguments\n
kwargs = state_change.kwargs\n
\n
# Required args\n
# Raise TypeError if all parameters are not provided\n
try:\n
software_release_url_string = kwargs[\'software_release\']\n
software_title = kwargs["software_title"]\n
software_type = kwargs["software_type"]\n
instance_xml = kwargs["instance_xml"]\n
sla_xml = kwargs["sla_xml"]\n
is_slave = kwargs["shared"]\n
root_state = kwargs["state"]\n
except KeyError:\n
raise TypeError, "Person_requestSoftwareInstance takes exactly 7 arguments"\n
\n
if is_slave not in [True, False]:\n
raise ValueError, "shared should be a boolean"\n
\n
empty_parameter = """<?xml version="1.0" encoding="utf-8"?>
\n
<instance>
\n
</instance>
"""\n
empty_parameter2 = """
<?xml version=\'1.0\' encoding=\'utf-8\'?>
\n
<instance/>
"""\n
\n
\n
# XXX Hardcode default parameter\n
if (instance_xml == empty_parameter) or (instance_xml.startswith(empty_parameter2)):\n
if software_release_url_string == "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5-frontend:/software/erp5/software.cfg": \n
instance_xml = """
<?xml version="1.0" encoding="utf-8"?>
\n
<instance>
\n
<parameter
id=
"frontend-instance-guid"
>
SOFTINST-9238
</parameter>
\n
<parameter
id=
"frontend-software-url"
>
http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
</parameter>
\n
</instance>
\n
"""\n
\n
hosting_subscription_portal_type = "Hosting Subscription"\n
\n
tag = "%s_%s_inProgress" % (person.getUid(), \n
software_title)\n
\n
if (portal.portal_activities.countMessageWithTag(tag) > 0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
# Check if it already exists\n
request_hosting_subscription_list = portal.portal_catalog(\n
portal_type=hosting_subscription_portal_type,\n
title={\'query\': software_title, \'key\': \'ExactMatch\'},\n
validation_state="validated",\n
default_destination_section_uid=person.getUid(),\n
limit=2,\n
)\n
if len(request_hosting_subscription_list) > 1:\n
raise NotImplementedError, "Too many hosting subscription %s found %s" % (software_title, [x.path for x in request_hosting_subscription_list])\n
elif len(request_hosting_subscription_list) == 1:\n
request_hosting_subscription = request_hosting_subscription_list[0].getObject()\n
if (request_hosting_subscription.getSlapState() == "destroy_requested") or \\\n
(request_hosting_subscription.getTitle() != software_title) or \\\n
(request_hosting_subscription.getValidationState() != "validated") or \\\n
(request_hosting_subscription.getDestinationSection() != person.getRelativeUrl()):\n
raise NotImplementedError, "The system was not able to get the expected hosting subscription"\n
else:\n
if (root_state == "destroyed"):\n
# No need to create destroyed subscription.\n
context.REQUEST.set(\'request_hosting_subscription\', None)\n
return\n
hosting_subscription_reference = "HOSTSUBS-%s" % context.getPortalObject().portal_ids\\\n
.generateNewId(id_group=\'slap_hosting_subscription_reference\', id_generator=\'uid\')\n
request_hosting_subscription = portal.getDefaultModule(portal_type=hosting_subscription_portal_type).newContent(\n
portal_type=hosting_subscription_portal_type,\n
reference=hosting_subscription_reference,\n
title=software_title,\n
destination_section=person.getRelativeUrl(),\n
activate_kw={\'tag\': tag},\n
)\n
\n
promise_kw = {\n
\'instance_xml\': instance_xml,\n
\'software_type\': software_type,\n
\'sla_xml\': sla_xml,\n
\'software_release\': software_release_url_string,\n
\'shared\': is_slave,\n
}\n
\n
context.REQUEST.set(\'request_hosting_subscription\', request_hosting_subscription)\n
# Change desired state\n
if (root_state == "started"):\n
request_hosting_subscription.requestStart(**promise_kw)\n
elif (root_state == "stopped"):\n
request_hosting_subscription.requestStop(**promise_kw)\n
elif (root_state == "destroyed"):\n
request_hosting_subscription.requestDestroy(**promise_kw)\n
context.REQUEST.set(\'request_hosting_subscription\', None)\n
else:\n
raise ValueError, "state should be started, stopped or destroyed"\n
\n
request_hosting_subscription.requestInstance(\n
software_release=software_release_url_string,\n
software_title=software_title,\n
software_type=software_type,\n
instance_xml=instance_xml,\n
sla_xml=sla_xml,\n
shared=is_slave,\n
state=root_state,\n
)\n
\n
# Change the state at the end to allow to execute updateLocalRoles only once in the transaction\n
validation_state = request_hosting_subscription.getValidationState()\n
slap_state = request_hosting_subscription.getSlapState()\n
if validation_state == \'draft\':\n
request_hosting_subscription.portal_workflow.doActionFor(request_hosting_subscription,\n
\'validate_action\')\n
if (validation_state != \'archived\') and \\\n
(slap_state == \'destroy_requested\'):\n
# XXX TODO do not use validation workflow to filter destroyed subscription\n
request_hosting_subscription.archive()\n
]]>
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Alarm_safeTrigger.py
0 → 100644
View file @
f449cb6c
if
alarm
.
getParentValue
().
isSubscribed
()
and
not
alarm
.
isActive
()
and
alarm
.
isEnabled
():
alarm
.
activeSense
()
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Alarm_safeTrigger.xml
View file @
f449cb6c
...
@@ -48,12 +48,6 @@
...
@@ -48,12 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
if alarm.getParentValue().isSubscribed() and not alarm.isActive() and alarm.isEnabled():\n
alarm.activeSense()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
alarm
</string>
</value>
<value>
<string>
alarm
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Computer_updateDestinationSection.py
0 → 100644
View file @
f449cb6c
computer
=
state_change
[
'object'
]
portal
=
computer
.
getPortalObject
()
subject_list
=
computer
.
getSubjectList
()
person_list
=
[]
for
subject
in
subject_list
:
if
subject
:
person_list
.
extend
([
x
.
getObject
()
for
x
in
portal
.
portal_catalog
(
validation_state
=
"validated"
,
portal_type
=
"Person"
,
default_email_text
=
subject
)])
computer
.
edit
(
destination_section_value_list
=
person_list
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Computer_updateDestinationSection.xml
View file @
f449cb6c
...
@@ -48,21 +48,6 @@
...
@@ -48,21 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
computer = state_change[\'object\']\n
portal = computer.getPortalObject()\n
\n
subject_list = computer.getSubjectList()\n
person_list = []\n
\n
for subject in subject_list:\n
if subject:\n
person_list.extend([x.getObject() for x in portal.portal_catalog(validation_state="validated", portal_type="Person", default_email_text=subject)])\n
\n
computer.edit(destination_section_value_list=person_list)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_changePromiseParameter.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
instance
.
bang
(
bang_tree
=
False
,
comment
=
"Parameter changed"
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_changePromiseParameter.xml
View file @
f449cb6c
...
@@ -48,12 +48,6 @@
...
@@ -48,12 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
instance.bang(bang_tree=False, comment="Parameter changed")\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_invalidate.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
"object"
]
assert
instance
.
getPortalType
()
==
"Slave Instance"
instance
.
invalidate
()
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_invalidate.xml
View file @
f449cb6c
...
@@ -48,15 +48,6 @@
...
@@ -48,15 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change["object"]\n
\n
assert instance.getPortalType() == "Slave Instance"\n
\n
instance.invalidate()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_triggerAllocationAlarm.py
0 → 100644
View file @
f449cb6c
software_instance
=
state_change
[
'object'
]
portal
=
software_instance
.
getPortalObject
()
if
software_instance
.
getValidationState
()
==
'validated'
:
context
.
Alarm_safeTrigger
(
portal
.
portal_alarms
.
slapos_allocate_instance
)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/Instance_triggerAllocationAlarm.xml
View file @
f449cb6c
...
@@ -48,16 +48,6 @@
...
@@ -48,16 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
software_instance = state_change[\'object\']\n
\n
portal = software_instance.getPortalObject()\n
\n
if software_instance.getValidationState() == \'validated\':\n
context.Alarm_safeTrigger(portal.portal_alarms.slapos_allocate_instance)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstallation_reindexComputer.py
0 → 100644
View file @
f449cb6c
installation
=
state_change
[
'object'
]
computer
=
installation
.
getAggregateValue
(
portal_type
=
"Computer"
)
if
computer
is
not
None
:
computer
.
activate
(
after_path_and_method_id
=
(
installation
.
getPath
(),
(
'immediateReindexObject'
,
'recursiveImmediateReindexObject'
))).
reindexObject
()
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstallation_reindexComputer.xml
View file @
f449cb6c
...
@@ -48,15 +48,6 @@
...
@@ -48,15 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
installation = state_change[\'object\']\n
computer = installation.getAggregateValue(portal_type="Computer")\n
if computer is not None:\n
computer.activate(\n
after_path_and_method_id=(installation.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).reindexObject()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexComputerPartition.py
0 → 100644
View file @
f449cb6c
instance
=
state_change
[
'object'
]
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
if
partition
is
not
None
:
partition
.
activate
(
after_path_and_method_id
=
(
instance
.
getPath
(),
(
'immediateReindexObject'
,
'recursiveImmediateReindexObject'
))).
reindexObject
()
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexComputerPartition.xml
View file @
f449cb6c
...
@@ -48,15 +48,6 @@
...
@@ -48,15 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
partition = instance.getAggregateValue(portal_type="Computer Partition")\n
if partition is not None:\n
partition.activate(\n
after_path_and_method_id=(instance.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).reindexObject()\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexRecursivelyPredecessorSoftwareInstanceList.py
0 → 100644
View file @
f449cb6c
def
reindexRecursively
(
document
,
after_tag
=
None
):
tag
=
document
.
getPath
()
+
'_reindex'
document
.
activate
(
after_tag
=
after_tag
).
reindexObject
(
activate_kw
=
dict
(
tag
=
tag
))
for
subdocument
in
document
.
getPredecessorValueList
(
portal_type
=
'Software Instance'
):
if
subdocument
.
getValidationState
()
!=
'invalidated'
:
reindexRecursively
(
subdocument
,
tag
)
reindexRecursively
(
state_change
[
'object'
],)
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/slapos_cloud_interaction_workflow/scripts/SoftwareInstance_reindexRecursivelyPredecessorSoftwareInstanceList.xml
View file @
f449cb6c
...
@@ -48,18 +48,6 @@
...
@@ -48,18 +48,6 @@
</object>
</object>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
def reindexRecursively(document, after_tag=None):\n
tag = document.getPath() + \'_reindex\'\n
document.activate(after_tag=after_tag).reindexObject(activate_kw=dict(tag=tag))\n
for subdocument in document.getPredecessorValueList(portal_type=\'Software Instance\'):\n
if subdocument.getValidationState() != \'invalidated\':\n
reindexRecursively(subdocument, tag)\n
\n
reindexRecursively(state_change[\'object\'],)\n
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
<value>
<string>
state_change
</string>
</value>
...
...
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