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
Guillaume Hervier
slapos.core
Commits
aa5e1094
Commit
aa5e1094
authored
Aug 07, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into cache
parents
845652db
6872ca03
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
588 additions
and
52 deletions
+588
-52
CHANGES.txt
CHANGES.txt
+6
-1
master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstance/bang_timestamp_property.xml
...perty_sheets/SoftwareInstance/bang_timestamp_property.xml
+32
-0
master/bt5/vifib_base/bt/revision
master/bt5/vifib_base/bt/revision
+1
-1
master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_set_priority_one_message_table.xml
...em/portal_alarms/vifib_set_priority_one_message_table.xml
+1
-1
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml
...eItem/portal_skins/vifib_slap/Computer_updateFromDict.xml
+15
-2
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/change_instance_parameter.xml
...ction_workflow/interactions/change_instance_parameter.xml
+100
-0
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml
...tion_workflow/scripts/Instance_changePromiseParameter.xml
+68
-0
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
master/bt5/vifib_slap/bt/template_path_list
master/bt5/vifib_slap/bt/template_path_list
+0
-1
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml
...tion_workflow/scripts/Instance_changePromiseParameter.xml
+1
-0
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml
...eraction_workflow/scripts/Instance_changePromiseState.xml
+1
-0
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml
...ction_workflow/scripts/Instance_createSalePackingList.xml
+0
-1
master/bt5/vifib_slapos_accounting/bt/revision
master/bt5/vifib_slapos_accounting/bt/revision
+1
-1
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.xml
...cripts/RequestedInstance_bangIfStateChangeToDestroyed.xml
+69
-0
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.xml
.../scripts/RequestedInstance_bangIfStateChangeToStarted.xml
+69
-0
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.xml
.../scripts/RequestedInstance_bangIfStateChangeToStopped.xml
+69
-0
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml
...e_workflow/scripts/RequestedInstance_bangInstanceTree.xml
+4
-1
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/draft.xml
...orkflow/instance_slap_interface_workflow/states/draft.xml
+1
-0
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_destroy.xml
...e_slap_interface_workflow/transitions/request_destroy.xml
+1
-1
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_start.xml
...nce_slap_interface_workflow/transitions/request_start.xml
+1
-1
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_stop.xml
...ance_slap_interface_workflow/transitions/request_stop.xml
+1
-1
master/bt5/vifib_slapos_core/bt/revision
master/bt5/vifib_slapos_core/bt/revision
+1
-1
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+95
-22
master/product/Vifib/tests/testVifibDefaultUseCase.py
master/product/Vifib/tests/testVifibDefaultUseCase.py
+41
-8
slapos.cfg.example
slapos.cfg.example
+3
-3
slapos/slap/slap.py
slapos/slap/slap.py
+6
-5
No files found.
CHANGES.txt
View file @
aa5e1094
...
@@ -11,7 +11,12 @@ Changes
...
@@ -11,7 +11,12 @@ Changes
(folder_id)
(folder_id)
- only_cp filter which computer patition, will be runned. it can be a
- only_cp filter which computer patition, will be runned. it can be a
list, splited by comman (slappartX,slappartY ...) [Rafael Monnerat]
list, splited by comman (slappartX,slappartY ...) [Rafael Monnerat]
* Cleanup unused option (--usage-report-periodicity). [Cedric de Saint Martin]
* slapgrid: Cleanup unused option (--usage-report-periodicity). [Cedric de
Saint Martin]
* slapgrid: --develop will work also for Computer Partitions. [Cedric de Saint
Martin]
* slaplib: setConnectionDict won't call Master if parameters haven't changed.
[Cedric de Saint Martin]
0.26.2 (2012-07-09)
0.26.2 (2012-07-09)
-----------------
-----------------
...
...
master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstance/bang_timestamp_property.xml
0 → 100644
View file @
aa5e1094
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Standard Property"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
elementary_type/int
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Used to inform client to update the instance.
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
bang_timestamp_property
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Standard Property
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_base/bt/revision
View file @
aa5e1094
468
469
\ No newline at end of file
\ No newline at end of file
master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_set_priority_one_message_table.xml
View file @
aa5e1094
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml
View file @
aa5e1094
...
@@ -85,7 +85,7 @@
...
@@ -85,7 +85,7 @@
\n
\n
# Getting existing partitions\n
# Getting existing partitions\n
existing_partition_dict = {}\n
existing_partition_dict = {}\n
for c in context.contentValues():\n
for c in context.contentValues(
portal_type="Computer Partition"
):\n
existing_partition_dict[c.getReference()] = c\n
existing_partition_dict[c.getReference()] = c\n
\n
\n
# update computer data\n
# update computer data\n
...
@@ -94,18 +94,31 @@ context.edit(\n
...
@@ -94,18 +94,31 @@ context.edit(\n
)\n
)\n
\n
\n
compareAndUpdateAddressList(context, [{\'addr\': computer_dict[\'address\'], \'netmask\': computer_dict[\'netmask\']}])\n
compareAndUpdateAddressList(context, [{\'addr\': computer_dict[\'address\'], \'netmask\': computer_dict[\'netmask\']}])\n
expected_partition_dict = {}\n
for send_partition in computer_dict[\'partition_list\']:\n
for send_partition in computer_dict[\'partition_list\']:\n
partition = existing_partition_dict.get(send_partition[\'reference\'], None)\n
partition = existing_partition_dict.get(send_partition[\'reference\'], None)\n
expected_partition_dict[send_partition[\'reference\']] = True\n
if partition is None:\n
if partition is None:\n
partition = context.newContent(portal_type=\'Computer Partition\')\n
partition = context.newContent(portal_type=\'Computer Partition\')\n
partition.validate()\n
partition.validate()\n
partition.markFree()\n
partition.markFree()\n
elif partition.getSlapState() == \'inactive\':\n
elif partition.getSlapState() == \'inactive\':\n
# Reactivate partition\n
# Reactivate partition\n
partition.markFree()\n
partition.markFree(comment="Reactivated by slapformat")\n
\n
if partition.getValidationState() == "invalidated":\n
partition.validate(comment="Reactivated by slapformat")\n
partition.edit(reference=send_partition[\'reference\'])\n
partition.edit(reference=send_partition[\'reference\'])\n
network_interface = send_partition[\'tap\'][\'name\']\n
network_interface = send_partition[\'tap\'][\'name\']\n
compareAndUpdateAddressList(partition, send_partition[\'address_list\'], {\'network_interface\': network_interface})\n
compareAndUpdateAddressList(partition, send_partition[\'address_list\'], {\'network_interface\': network_interface})\n
\n
# Desactivate all other partitions\n
for key, value in existing_partition_dict.items():\n
if key not in expected_partition_dict:\n
if value.getSlapState() == "free":\n
value.markInactive(comment="Desactivated by slapformat")\n
if value.getValidationState() == "validated":\n
value.invalidate(comment="Desactivated by slapformat")\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
master/bt5/vifib_slap/
PathTemplateItem/portal_alarms/cleanup_archived_hs_instances
.xml
→
master/bt5/vifib_slap/
WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/change_instance_parameter
.xml
View file @
aa5e1094
...
@@ -2,98 +2,97 @@
...
@@ -2,98 +2,97 @@
<ZopeData>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<pickle>
<global
name=
"
Alarm"
module=
"erp5.portal_type
"
/>
<global
name=
"
InteractionDefinition"
module=
"Products.ERP5.Interaction
"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
act
ive_sense_method_id
</string>
</key>
<key>
<string>
act
box_category
</string>
</key>
<value>
<string>
Alarm_searchInstanceAndRequestDestruction
</string>
</value>
<value>
<string>
workflow
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string>
Finds all instances related to archived hosting subscriptions and request their destruction.
</string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
actbox_url
</string>
</key>
<value>
<
int>
1
</int
>
</value>
<value>
<
string></string
>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
activate_script_name
</string>
</key>
<value>
<string>
cleanup_archived_hs_instances
</string>
</value>
</item>
<item>
<key>
<string>
periodicity_hour
</string>
</key>
<value>
<value>
<tuple/>
<tuple/>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_hour_frequency
</string>
</key>
<key>
<string>
after_script_name
</string>
</key>
<value>
<int>
12
</int>
</value>
</item>
<item>
<key>
<string>
periodicity_minute
</string>
</key>
<value>
<value>
<tuple/>
<tuple/>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_minute_frequency
</string>
</key>
<key>
<string>
before_commit_script_name
</string>
</key>
<value>
<value>
<none/>
<list>
<string>
Instance_changePromiseParameter
</string>
</list>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_month
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<value>
<
tupl
e/>
<
non
e/>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_month_day
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
change_instance_parameter
</string>
</value>
</item>
<item>
<key>
<string>
method_id
</string>
</key>
<value>
<value>
<tuple/>
<list>
<string>
_setRootSoftwareReleaseUrl
</string>
<string>
_setTextContent
</string>
<string>
_setSourceReference
</string>
<string>
_setSlaXml
</string>
</list>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_start_date
</string>
</key>
<key>
<string>
once_per_transaction
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
portal_type_filter
</string>
</key>
<value>
<value>
<object>
<list>
<klass>
<string>
Slave Instance
</string>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
<string>
Software Instance
</string>
</klass>
</list>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1288051200.0
</float>
<string>
GMT
</string>
</tuple>
</state>
</object>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
periodicity_week
</string>
</key>
<key>
<string>
script_name
</string>
</key>
<value>
<value>
<tuple/>
<tuple/>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
portal_type
</string>
</key>
<key>
<string>
temporary_document_disallowed
</string>
</key>
<value>
<
string>
Alarm
</string
>
</value>
<value>
<
int>
1
</int
>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
sense_method_id
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<value>
<string></string>
</value>
<none/>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
t
itl
e
</string>
</key>
<key>
<string>
t
rigger_typ
e
</string>
</key>
<value>
<
string>
Cleanup archived Hosting Subscription Instances
</string
>
</value>
<value>
<
int>
2
</int
>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml
0 → 100644
View file @
aa5e1094
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
instance.bang(bang_tree=False, comment="Parameter changed")\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Instance_changePromiseParameter
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slap/bt/revision
View file @
aa5e1094
788
794
\ No newline at end of file
\ No newline at end of file
master/bt5/vifib_slap/bt/template_path_list
View file @
aa5e1094
portal_alarms/cleanup_archived_hs_instances
portal_alarms/confirm_ordered_sale_order
portal_alarms/confirm_ordered_sale_order
portal_alarms/confirm_planned_sale_invoice_transaction
portal_alarms/confirm_planned_sale_invoice_transaction
portal_alarms/deliver_subscription_sale_packing_list
portal_alarms/deliver_subscription_sale_packing_list
...
...
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml
View file @
aa5e1094
...
@@ -74,6 +74,7 @@ if (state in (started, stopped)):\n
...
@@ -74,6 +74,7 @@ if (state in (started, stopped)):\n
new_delivery.start()\n
new_delivery.start()\n
new_delivery.stop()\n
new_delivery.stop()\n
new_delivery.deliver()\n
new_delivery.deliver()\n
new_delivery.startBuilding()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml
View file @
aa5e1094
...
@@ -155,6 +155,7 @@ else:\n
...
@@ -155,6 +155,7 @@ else:\n
packing_list.confirm()\n
packing_list.confirm()\n
elif (state == destroyed):\n
elif (state == destroyed):\n
packing_list.confirm()\n
packing_list.confirm()\n
packing_list.startBuilding()\n
\n
\n
elif delivery.getPortalType() == "Sale Packing List":\n
elif delivery.getPortalType() == "Sale Packing List":\n
line_list = delivery.contentValues(portal_type="Sale Packing List Line")\n
line_list = delivery.contentValues(portal_type="Sale Packing List Line")\n
...
...
master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml
View file @
aa5e1094
...
@@ -81,7 +81,6 @@ packing_list_line = packing_list.newContent(\n
...
@@ -81,7 +81,6 @@ packing_list_line = packing_list.newContent(\n
)\n
)\n
\n
\n
\n
\n
packing_list.startBuilding()\n
return packing_list\n
return packing_list\n
</string>
</value>
</string>
</value>
</item>
</item>
...
...
master/bt5/vifib_slapos_accounting/bt/revision
View file @
aa5e1094
23
24
\ No newline at end of file
\ No newline at end of file
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.xml
0 → 100644
View file @
aa5e1094
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
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>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
RequestedInstance_bangIfStateChangeToDestroyed
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.xml
0 → 100644
View file @
aa5e1094
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
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>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
RequestedInstance_bangIfStateChangeToStarted
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.xml
0 → 100644
View file @
aa5e1094
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
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>
<key>
<string>
_params
</string>
</key>
<value>
<string>
state_change
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
RequestedInstance_bangIfStateChangeToStopped
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml
View file @
aa5e1094
...
@@ -50,9 +50,12 @@
...
@@ -50,9 +50,12 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
instance = state_change[\'object\']\n
<value>
<string>
from DateTime import DateTime\n
instance = state_change[\'object\']\n
assert instance.getPortalType() in ["Slave Instance", "Software Instance"]\n
assert instance.getPortalType() in ["Slave Instance", "Software Instance"]\n
\n
\n
instance.edit(bang_timestamp=int(DateTime()))\n
\n
if state_change.kwargs[\'bang_tree\']:\n
if state_change.kwargs[\'bang_tree\']:\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
portal = instance.getPortalObject()\n
portal = instance.getPortalObject()\n
...
...
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/draft.xml
View file @
aa5e1094
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<key>
<string>
transitions
</string>
</key>
<key>
<string>
transitions
</string>
</key>
<value>
<value>
<tuple>
<tuple>
<string>
bang
</string>
<string>
request_start
</string>
<string>
request_start
</string>
<string>
request_stop
</string>
<string>
request_stop
</string>
</tuple>
</tuple>
...
...
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_destroy.xml
View file @
aa5e1094
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
script_name
</string>
</key>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
RequestedInstance_bangIfStateChangeToDestroyed
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_start.xml
View file @
aa5e1094
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
script_name
</string>
</key>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
RequestedInstance_bangIfStateChangeToStarted
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_stop.xml
View file @
aa5e1094
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
script_name
</string>
</key>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
RequestedInstance_bangIfStateChangeToStopped
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
master/bt5/vifib_slapos_core/bt/revision
View file @
aa5e1094
41
42
\ No newline at end of file
\ No newline at end of file
master/product/Vifib/Tool/SlapTool.py
View file @
aa5e1094
...
@@ -143,15 +143,23 @@ class SlapTool(BaseTool):
...
@@ -143,15 +143,23 @@ class SlapTool(BaseTool):
"""
"""
def
_getComputerInformation
(
computer_id
,
user
):
def
_getComputerInformation
(
computer_id
,
user
):
user_document
=
self
.
getPortalObject
().
portal_catalog
.
getResultValue
(
reference
=
user
,
portal_type
=
[
'Person'
,
'Computer'
,
'Software Instance'
])
user_type
=
user_document
.
getPortalType
()
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml'
)
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml'
)
slap_computer
=
Computer
(
computer_id
)
slap_computer
=
Computer
(
computer_id
)
parent_uid
=
self
.
_getComputerUidByReference
(
computer_id
)
parent_uid
=
self
.
_getComputerUidByReference
(
computer_id
)
slap_computer
.
_computer_partition_list
=
[]
slap_computer
.
_computer_partition_list
=
[]
if
user_type
==
'Computer'
:
slap_computer
.
_software_release_list
=
\
slap_computer
.
_software_release_list
=
\
self
.
_getSoftwareReleaseValueListForComputer
(
computer_id
)
self
.
_getSoftwareReleaseValueListForComputer
(
computer_id
)
else
:
slap_computer
.
_software_release_list
=
[]
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
parent_uid
=
parent_uid
,
parent_uid
=
parent_uid
,
validation_state
=
"validated"
,
portal_type
=
"Computer Partition"
):
portal_type
=
"Computer Partition"
):
slap_computer
.
_computer_partition_list
.
append
(
slap_computer
.
_computer_partition_list
.
append
(
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
...
@@ -171,19 +179,31 @@ class SlapTool(BaseTool):
...
@@ -171,19 +179,31 @@ class SlapTool(BaseTool):
Reuses slap library for easy marshalling.
Reuses slap library for easy marshalling.
"""
"""
def
_getFullComputerInformation
(
computer_id
,
user
):
user_document
=
self
.
getPortalObject
().
portal_catalog
.
getResultValue
(
reference
=
user
,
portal_type
=
[
'Person'
,
'Computer'
,
'Software Instance'
])
user_type
=
user_document
.
getPortalType
()
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml'
)
self
.
REQUEST
.
response
.
setHeader
(
'Content-Type'
,
'text/xml'
)
slap_computer
=
Computer
(
computer_id
)
slap_computer
=
Computer
(
computer_id
)
parent_uid
=
self
.
_getComputerUidByReference
(
computer_id
)
parent_uid
=
self
.
_getComputerUidByReference
(
computer_id
)
slap_computer
.
_computer_partition_list
=
[]
slap_computer
.
_computer_partition_list
=
[]
if
user_type
==
'Computer'
:
slap_computer
.
_software_release_list
=
\
slap_computer
.
_software_release_list
=
\
self
.
_getSoftwareReleaseValueListForComputer
(
computer_id
,
full
=
True
)
self
.
_getSoftwareReleaseValueListForComputer
(
computer_id
,
full
=
True
)
else
:
slap_computer
.
_software_release_list
=
[]
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
for
computer_partition
in
self
.
getPortalObject
().
portal_catalog
(
parent_uid
=
parent_uid
,
parent_uid
=
parent_uid
,
validation_state
=
"validated"
,
portal_type
=
"Computer Partition"
):
portal_type
=
"Computer Partition"
):
slap_computer
.
_computer_partition_list
.
append
(
slap_computer
.
_computer_partition_list
.
append
(
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
self
.
_getSlapPartitionByPackingList
(
computer_partition
.
getObject
()))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
().
getUserName
()
return
CachingMethod
(
_getFullComputerInformation
,
id
=
'_getFullComputerInformation'
,
cache_factory
=
'slap_cache_factory'
)(
computer_id
,
user
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getComputerPartitionCertificate'
)
'getComputerPartitionCertificate'
)
...
@@ -428,11 +448,64 @@ class SlapTool(BaseTool):
...
@@ -428,11 +448,64 @@ class SlapTool(BaseTool):
"""
"""
# Try to get the computer partition to raise an exception if it doesn't
# Try to get the computer partition to raise an exception if it doesn't
# exist
# exist
self
.
_getComputerPartitionDocument
(
portal
=
self
.
getPortalObject
()
computer_partition_document
=
self
.
_getComputerPartitionDocument
(
computer_reference
,
computer_partition_reference
)
computer_reference
,
computer_partition_reference
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_partition
=
SlapComputerPartition
(
computer_reference
,
SlapComputerPartition
(
computer_reference
,
computer_partition_reference
)
computer_partition_reference
))
slap_partition
.
_software_release_document
=
None
slap_partition
.
_requested_state
=
'destroyed'
slap_partition
.
_need_modification
=
0
software_instance
=
None
if
computer_partition_document
.
getSlapState
()
==
'busy'
:
software_instance_list
=
portal
.
portal_catalog
(
portal_type
=
"Software Instance"
,
default_aggregate_uid
=
computer_partition_document
.
getUid
(),
validation_state
=
"validated"
,
limit
=
2
,
)
software_instance_count
=
len
(
software_instance_list
)
if
software_instance_count
==
1
:
software_instance
=
software_instance_list
[
0
].
getObject
()
elif
software_instance_count
>
1
:
# XXX do not prevent the system to work if one partition is broken
raise
NotImplementedError
,
"Too many instances %s linked to %s"
%
\
([
x
.
path
for
x
in
software_instance_list
],
computer_partition_document
.
getRelativeUrl
())
if
software_instance
is
not
None
:
# trick client side, that data has been synchronised already for given
# document
slap_partition
.
_synced
=
True
state
=
software_instance
.
getSlapState
()
if
state
==
"stop_requested"
:
slap_partition
.
_requested_state
=
'stopped'
if
state
==
"start_requested"
:
slap_partition
.
_requested_state
=
'started'
slap_partition
.
_software_release_document
=
SoftwareRelease
(
software_release
=
software_instance
.
getRootSoftwareReleaseUrl
(),
computer_guid
=
computer_reference
)
slap_partition
.
_need_modification
=
1
parameter_dict
=
self
.
_getSoftwareInstanceAsParameterDict
(
software_instance
)
# software instance has to define an xml parameter
slap_partition
.
_parameter_dict
=
self
.
_instanceXmlToDict
(
parameter_dict
.
pop
(
'xml'
))
slap_partition
.
_connection_dict
=
self
.
_instanceXmlToDict
(
parameter_dict
.
pop
(
'connection_xml'
))
for
slave_instance_dict
in
parameter_dict
.
get
(
"slave_instance_list"
,
[]):
if
slave_instance_dict
.
has_key
(
"connection_xml"
):
slave_instance_dict
.
update
(
self
.
_instanceXmlToDict
(
slave_instance_dict
.
pop
(
"connection_xml"
)))
if
slave_instance_dict
.
has_key
(
"xml"
):
slave_instance_dict
.
update
(
self
.
_instanceXmlToDict
(
slave_instance_dict
.
pop
(
"xml"
)))
slap_partition
.
_parameter_dict
.
update
(
parameter_dict
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_partition
)
####################################################
####################################################
# Internal methods
# Internal methods
...
@@ -933,7 +1006,7 @@ class SlapTool(BaseTool):
...
@@ -933,7 +1006,7 @@ class SlapTool(BaseTool):
computer_partition
=
software_instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
computer_partition
=
software_instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
timestamp
=
int
(
computer_partition
.
getModificationDate
())
timestamp
=
int
(
computer_partition
.
getModificationDate
())
newtimestamp
=
int
(
software_instance
.
get
ModificationDate
(
))
newtimestamp
=
int
(
software_instance
.
get
BangTimestamp
(
int
(
software_instance
.
getModificationDate
())
))
if
(
newtimestamp
>
timestamp
):
if
(
newtimestamp
>
timestamp
):
timestamp
=
newtimestamp
timestamp
=
newtimestamp
...
@@ -960,7 +1033,7 @@ class SlapTool(BaseTool):
...
@@ -960,7 +1033,7 @@ class SlapTool(BaseTool):
'xml'
:
slave_instance
.
getTextContent
(),
'xml'
:
slave_instance
.
getTextContent
(),
'connection_xml'
:
slave_instance
.
getConnectionXml
(),
'connection_xml'
:
slave_instance
.
getConnectionXml
(),
})
})
newtimestamp
=
int
(
slave_instance
.
get
ModificationDate
())
newtimestamp
=
int
(
slave_instance
.
get
BangTimestamp
(
int
(
software_instance
.
getModificationDate
())))
if
(
newtimestamp
>
timestamp
):
if
(
newtimestamp
>
timestamp
):
timestamp
=
newtimestamp
timestamp
=
newtimestamp
return
{
return
{
...
@@ -972,7 +1045,7 @@ class SlapTool(BaseTool):
...
@@ -972,7 +1045,7 @@ class SlapTool(BaseTool):
'slap_software_release_url'
:
software_instance
.
getRootSoftwareReleaseUrl
(),
'slap_software_release_url'
:
software_instance
.
getRootSoftwareReleaseUrl
(),
'slave_instance_list'
:
slave_instance_list
,
'slave_instance_list'
:
slave_instance_list
,
'ip_list'
:
ip_list
,
'ip_list'
:
ip_list
,
'timestamp'
:
"%
s
"
%
timestamp
,
'timestamp'
:
"%
i
"
%
timestamp
,
}
}
@
UnrestrictedMethod
@
UnrestrictedMethod
...
...
master/product/Vifib/tests/testVifibDefaultUseCase.py
View file @
aa5e1094
...
@@ -32,7 +32,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -32,7 +32,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
transaction_list
=
list
(
set
(
transaction_list
))
transaction_list
=
list
(
set
(
transaction_list
))
self
.
assertEquals
(
1
,
len
(
transaction_list
))
self
.
assertEquals
(
1
,
len
(
transaction_list
))
return
transaction_list
[
0
].
getObject
()
.
getParentValue
()
return
transaction_list
[
0
].
getObject
()
def
stepCheckRegistrationAccounting
(
self
,
sequence
,
**
kw
):
def
stepCheckRegistrationAccounting
(
self
,
sequence
,
**
kw
):
"""
"""
...
@@ -481,7 +481,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -481,7 +481,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
# 1 invoice line is expected
# 1 invoice line is expected
invoice_line_list
=
sale_invoice
.
contentValues
(
invoice_line_list
=
sale_invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)
portal_type
=
"Invoice Line"
)
self
.
assertEquals
(
3
,
len
(
invoice_line_list
))
self
.
assertEquals
(
4
,
len
(
invoice_line_list
))
service_line
=
[
x
for
x
in
invoice_line_list
\
service_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
...
@@ -489,6 +489,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -489,6 +489,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
if
x
.
getResource
()
==
'service_module/vifib_instance_subscription'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_subscription'
][
0
]
hosting_line
=
[
x
for
x
in
invoice_line_list
\
hosting_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
update_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_update'
][
0
]
self
.
assertEquals
(
True
,
service_line
.
hasPrice
())
self
.
assertEquals
(
True
,
service_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0
,
service_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0
,
service_line
.
getPrice
(),
3
)
...
@@ -502,6 +504,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -502,6 +504,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
self
.
assertAlmostEquals
(
0
,
hosting_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0
,
hosting_line
.
getPrice
(),
3
)
self
.
assertEquals
(
1
,
hosting_line
.
getQuantity
())
self
.
assertEquals
(
1
,
hosting_line
.
getQuantity
())
self
.
assertEquals
(
True
,
update_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0
,
update_line
.
getPrice
(),
3
)
self
.
assertEquals
(
1
,
update_line
.
getQuantity
())
# 0 transaction line
# 0 transaction line
transaction_line_list
=
sale_invoice
.
contentValues
(
transaction_line_list
=
sale_invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)
portal_type
=
"Sale Invoice Transaction Line"
)
...
@@ -567,7 +573,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -567,7 +573,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
# 1 invoice line is expected
# 1 invoice line is expected
invoice_line_list
=
sale_invoice
.
contentValues
(
invoice_line_list
=
sale_invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)
portal_type
=
"Invoice Line"
)
self
.
assertEquals
(
4
,
len
(
invoice_line_list
))
self
.
assertEquals
(
5
,
len
(
invoice_line_list
))
service_line
=
[
x
for
x
in
invoice_line_list
\
service_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
...
@@ -577,6 +583,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -577,6 +583,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
destroy_line
=
[
x
for
x
in
invoice_line_list
\
destroy_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
update_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_update'
][
0
]
self
.
assertEquals
(
True
,
service_line
.
hasPrice
())
self
.
assertEquals
(
True
,
service_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0
,
service_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0
,
service_line
.
getPrice
(),
3
)
...
@@ -594,6 +602,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -594,6 +602,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertEquals
(
1
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
1
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
True
,
update_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0
,
update_line
.
getPrice
(),
3
)
self
.
assertEquals
(
2
,
update_line
.
getQuantity
())
# 0 transaction line
# 0 transaction line
transaction_line_list
=
sale_invoice
.
contentValues
(
transaction_line_list
=
sale_invoice
.
contentValues
(
portal_type
=
"Sale Invoice Transaction Line"
)
portal_type
=
"Sale Invoice Transaction Line"
)
...
@@ -612,7 +624,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -612,7 +624,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
portal_type
=
"Sale Invoice Transaction"
,
portal_type
=
"Sale Invoice Transaction"
,
simulation_state
=
"planned"
):
simulation_state
=
"planned"
):
invoice
=
invoice
.
getObject
()
invoice
=
invoice
.
getObject
()
invoice
.
confirm
()
invoice
.
SaleInvoiceTransaction_confirmPlanned
(
# force invoice confirmation (or moving to next month)
this_month
=
invoice
.
getStartDate
()
+
1
)
def
stepCheckWaitingInvoice
(
self
,
sequence
,
**
kw
):
def
stepCheckWaitingInvoice
(
self
,
sequence
,
**
kw
):
"""
"""
...
@@ -650,10 +665,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -650,10 +665,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
self
.
assertAlmostEquals
(
self
.
assertAlmostEquals
(
1
,
sale_invoice
.
getTotalPrice
(),
3
)
1
,
sale_invoice
.
getTotalPrice
(),
3
)
#
5
invoice lines are expected
#
6
invoice lines are expected
invoice_line_list
=
sale_invoice
.
contentValues
(
invoice_line_list
=
sale_invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)
portal_type
=
"Invoice Line"
)
self
.
assertEquals
(
5
,
len
(
invoice_line_list
))
self
.
assertEquals
(
6
,
len
(
invoice_line_list
))
service_line
=
[
x
for
x
in
invoice_line_list
\
service_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
...
@@ -663,6 +678,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -663,6 +678,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
destroy_line
=
[
x
for
x
in
invoice_line_list
\
destroy_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
update_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_update'
][
0
]
tax_line
=
[
x
for
x
in
invoice_line_list
\
tax_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_tax'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_tax'
][
0
]
...
@@ -682,6 +699,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -682,6 +699,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertEquals
(
1
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
1
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
True
,
update_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0
,
update_line
.
getPrice
(),
3
)
self
.
assertEquals
(
2
,
update_line
.
getQuantity
())
self
.
assertEquals
(
True
,
tax_line
.
hasPrice
())
self
.
assertEquals
(
True
,
tax_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0.196
,
tax_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0.196
,
tax_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0.836
,
tax_line
.
getQuantity
(),
3
)
self
.
assertAlmostEquals
(
0.836
,
tax_line
.
getQuantity
(),
3
)
...
@@ -823,7 +844,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -823,7 +844,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
# 5 invoice lines are expected
# 5 invoice lines are expected
invoice_line_list
=
sale_invoice
.
contentValues
(
invoice_line_list
=
sale_invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)
portal_type
=
"Invoice Line"
)
self
.
assertEquals
(
5
,
len
(
invoice_line_list
))
self
.
assertEquals
(
6
,
len
(
invoice_line_list
))
service_line
=
[
x
for
x
in
invoice_line_list
\
service_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
...
@@ -833,6 +854,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -833,6 +854,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
destroy_line
=
[
x
for
x
in
invoice_line_list
\
destroy_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
update_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_update'
][
0
]
tax_line
=
[
x
for
x
in
invoice_line_list
\
tax_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_tax'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_tax'
][
0
]
...
@@ -852,6 +875,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -852,6 +875,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertEquals
(
1
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
1
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
True
,
update_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0
,
update_line
.
getPrice
(),
3
)
self
.
assertEquals
(
2
,
update_line
.
getQuantity
())
self
.
assertEquals
(
True
,
tax_line
.
hasPrice
())
self
.
assertEquals
(
True
,
tax_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0.196
,
tax_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0.196
,
tax_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0.836
,
tax_line
.
getQuantity
(),
3
)
self
.
assertAlmostEquals
(
0.836
,
tax_line
.
getQuantity
(),
3
)
...
@@ -1130,7 +1157,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -1130,7 +1157,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
# 5 invoice lines are expected
# 5 invoice lines are expected
invoice_line_list
=
sale_invoice
.
contentValues
(
invoice_line_list
=
sale_invoice
.
contentValues
(
portal_type
=
"Invoice Line"
)
portal_type
=
"Invoice Line"
)
self
.
assertEquals
(
5
,
len
(
invoice_line_list
))
self
.
assertEquals
(
6
,
len
(
invoice_line_list
))
service_line
=
[
x
for
x
in
invoice_line_list
\
service_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_setup'
][
0
]
...
@@ -1140,6 +1167,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -1140,6 +1167,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_hosting'
][
0
]
destroy_line
=
[
x
for
x
in
invoice_line_list
\
destroy_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_instance_cleanup'
][
0
]
update_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_instance_update'
][
0
]
tax_line
=
[
x
for
x
in
invoice_line_list
\
tax_line
=
[
x
for
x
in
invoice_line_list
\
if
x
.
getResource
()
==
'service_module/vifib_tax'
][
0
]
if
x
.
getResource
()
==
'service_module/vifib_tax'
][
0
]
...
@@ -1159,6 +1188,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
...
@@ -1159,6 +1188,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0
,
destroy_line
.
getPrice
(),
3
)
self
.
assertEquals
(
2
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
2
,
destroy_line
.
getQuantity
())
self
.
assertEquals
(
True
,
update_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0
,
update_line
.
getPrice
(),
3
)
self
.
assertEquals
(
6
,
update_line
.
getQuantity
())
self
.
assertEquals
(
True
,
tax_line
.
hasPrice
())
self
.
assertEquals
(
True
,
tax_line
.
hasPrice
())
self
.
assertAlmostEquals
(
0.196
,
tax_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
0.196
,
tax_line
.
getPrice
(),
3
)
self
.
assertAlmostEquals
(
1.672
,
tax_line
.
getQuantity
(),
3
)
self
.
assertAlmostEquals
(
1.672
,
tax_line
.
getQuantity
(),
3
)
...
...
slapos.cfg.example
View file @
aa5e1094
...
@@ -5,9 +5,9 @@ master_url = https://slap.vifib.com/
...
@@ -5,9 +5,9 @@ master_url = https://slap.vifib.com/
# Replace computer_id by the unique identifier of your computer on vifib.net,
# Replace computer_id by the unique identifier of your computer on vifib.net,
# starting by COMP-
# starting by COMP-
computer_id = COMP-12345
computer_id = COMP-12345
key_file = /etc/opt/slapos/key
key_file = /etc/opt/slapos/
ssl/computer.
key
cert_file =
/etc/opt/slapos/certificate
cert_file =
/etc/opt/slapos/ssl/computer.crt
certificate_repository_path = /etc/opt/slapos/
pki/
certificate_repository_path = /etc/opt/slapos/
ssl/partition_pki
[slapformat]
[slapformat]
# Replace by your network interface like eth0, eth1, slapbr0...
# Replace by your network interface like eth0, eth1, slapbr0...
...
...
slapos/slap/slap.py
View file @
aa5e1094
...
@@ -489,6 +489,7 @@ class ComputerPartition(SlapDocument):
...
@@ -489,6 +489,7 @@ class ComputerPartition(SlapDocument):
return
self
.
_software_release_document
return
self
.
_software_release_document
def
setConnectionDict
(
self
,
connection_dict
,
slave_reference
=
None
):
def
setConnectionDict
(
self
,
connection_dict
,
slave_reference
=
None
):
if
self
.
getConnectionParameterDict
()
!=
connection_dict
:
self
.
_connection_helper
.
POST
(
'/setComputerPartitionConnectionXml'
,
{
self
.
_connection_helper
.
POST
(
'/setComputerPartitionConnectionXml'
,
{
'computer_id'
:
self
.
_computer_id
,
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
_partition_id
,
'computer_partition_id'
:
self
.
_partition_id
,
...
...
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