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
Nicolas Wavrant
slapos.core
Commits
f74598cc
Commit
f74598cc
authored
Jun 23, 2011
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
merged with master
parents
22437b34
34f0974e
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
532 additions
and
37 deletions
+532
-37
CHANGES.txt
CHANGES.txt
+2
-0
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestSoftwareInstance.xml
...flow/scripts/SoftwareInstance_requestSoftwareInstance.xml
+11
-1
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStart.xml
...erface_workflow/scripts/SoftwareInstance_requestStart.xml
+13
-5
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStop.xml
...terface_workflow/scripts/SoftwareInstance_requestStop.xml
+7
-3
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/states/draft.xml
...oftware_instance_slap_interface_workflow/states/draft.xml
+2
-0
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/states/start_requested.xml
...stance_slap_interface_workflow/states/start_requested.xml
+54
-0
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/states/stop_requested.xml
...nstance_slap_interface_workflow/states/stop_requested.xml
+54
-0
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/transitions/start_requested.xml
...e_slap_interface_workflow/transitions/start_requested.xml
+62
-0
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/transitions/stop_requested.xml
...ce_slap_interface_workflow/transitions/stop_requested.xml
+62
-0
master/bt5/vifib_base/bt/revision
master/bt5/vifib_base/bt/revision
+1
-1
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SalePackingList_stop.xml
...nteraction_workflow/interactions/SalePackingList_stop.xml
+1
-1
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_requestStoredSoftwareInstanceState.xml
...ts/SalePackingList_requestStoredSoftwareInstanceState.xml
+5
-2
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+11
-5
master/product/Vifib/tests/VifibMixin.py
master/product/Vifib/tests/VifibMixin.py
+4
-4
master/product/Vifib/tests/testVifibSlapWebService.py
master/product/Vifib/tests/testVifibSlapWebService.py
+230
-4
slapos/format/__init__.py
slapos/format/__init__.py
+3
-6
slapos/grid/utils.py
slapos/grid/utils.py
+2
-1
slapos/slap/slap.py
slapos/slap/slap.py
+7
-3
No files found.
CHANGES.txt
View file @
f74598cc
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
* general: Polish requirement versions. [Arnaud Fontaine]
* general: Polish requirement versions. [Arnaud Fontaine]
* general: Remove libnetworkcache. [Lucas Carvalho]
* general: Remove libnetworkcache. [Lucas Carvalho]
* slap: Remove not needed method from interface. [Romain Courteaud]
* slap: Remove not needed method from interface. [Romain Courteaud]
* slap: state parameter is accepted and transmitted to SlapOS master [Łukasz
Nowak]
* slapformat: Implement dry run. [Vincent Pelletier]
* slapformat: Implement dry run. [Vincent Pelletier]
* slapgrid: Allow to select any buildout binary used to bootstrap environment.
* slapgrid: Allow to select any buildout binary used to bootstrap environment.
[Łukasz Nowak]
[Łukasz Nowak]
...
...
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestSoftwareInstance.xml
View file @
f74598cc
...
@@ -62,6 +62,7 @@ shared = kwargs["shared"]\n
...
@@ -62,6 +62,7 @@ shared = kwargs["shared"]\n
software_type = kwargs["software_type"]\n
software_type = kwargs["software_type"]\n
instance_xml = kwargs["instance_xml"]\n
instance_xml = kwargs["instance_xml"]\n
sla_xml = kwargs["sla_xml"]\n
sla_xml = kwargs["sla_xml"]\n
state = kwargs["state"]\n
\n
\n
# Get root software instance\n
# Get root software instance\n
predecessor_software_instance = software_instance\n
predecessor_software_instance = software_instance\n
...
@@ -129,8 +130,17 @@ else:\n
...
@@ -129,8 +130,17 @@ else:\n
predecessor_software_instance.edit(\n
predecessor_software_instance.edit(\n
predecessor_uid_list=predecessor_uid_list,\n
predecessor_uid_list=predecessor_uid_list,\n
activate_kw={\'tag\': tag},)\n
activate_kw={\'tag\': tag},)\n
\n
if state == \'started\':\n
request_software_instance.startRequested()\n
request_software_instance.activate(after_tag=tag).requestStartComputerPartition()\n
elif state == \'stopped\':\n
request_software_instance.stopRequested() \n
request_software_instance.activate(after_tag=tag).requestStopComputerPartition()\n
else:\n
raise ValueError(\'State %r is not supported\' % state)\n
predecessor_list = software_instance.getPredecessorList() + [request_software_instance.getRelativeUrl()]\n
predecessor_list = software_instance.getPredecessorList() + [request_software_instance.getRelativeUrl()]\n
\n
\n
software_instance.edit(\n
software_instance.edit(\n
predecessor_list=predecessor_list,\n
predecessor_list=predecessor_list,\n
activate_kw={\'tag\': tag},)\n
activate_kw={\'tag\': tag},)\n
...
...
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStart.xml
View file @
f74598cc
...
@@ -56,12 +56,20 @@ software_instance = state_change[\'object\']\n
...
@@ -56,12 +56,20 @@ software_instance = state_change[\'object\']\n
service_relative_url = software_instance.portal_preferences.\\\n
service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceHostingResource()\n
getPreferredInstanceHostingResource()\n
need_to_create_packing_list = False\n
need_to_create_packing_list = False\n
\n
try:\n
try:\n
sale_packing_list_line = context.SoftwareInstance_getInstanceHosting
PackingListLine(state_change)\n
instance_setup_line = context.SoftwareInstance_getInstanceSetup
PackingListLine(state_change)\n
except ValueError:\n
except ValueError:\n
need_to_create_packing_list = True
\n
pass
\n
else:\n
else:\n
if instance_setup_line.getSimulationState() == \'stopped\':\n
try:\n
sale_packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
except ValueError:\n
need_to_create_packing_list = True\n
else:\n
if sale_packing_list_line.getSimulationState() == \'stopped\':\n
# previously it was still in stop in progress state, now it shall be started again\n
sale_packing_list_line.getParentValue().deliver()\n
if sale_packing_list_line.getSimulationState() == \'delivered\':\n
if sale_packing_list_line.getSimulationState() == \'delivered\':\n
need_to_create_packing_list = True\n
need_to_create_packing_list = True\n
\n
\n
...
...
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestStop.xml
View file @
f74598cc
...
@@ -50,9 +50,13 @@
...
@@ -50,9 +50,13 @@
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
<value>
<string>
try:\n
packing_list = packing_list_line.getParentValue()\n
packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
packing_list.stop()\n
except ValueError:\n
pass\n
else:\n
packing_list = packing_list_line.getParentValue()\n
packing_list.stop()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
...
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/states/draft.xml
View file @
f74598cc
...
@@ -34,8 +34,10 @@
...
@@ -34,8 +34,10 @@
<string>
request_stop_computer_partition_action
</string>
<string>
request_stop_computer_partition_action
</string>
<string>
start_computer_partition
</string>
<string>
start_computer_partition
</string>
<string>
start_computer_partition_installation
</string>
<string>
start_computer_partition_installation
</string>
<string>
start_requested
</string>
<string>
stop_computer_partition
</string>
<string>
stop_computer_partition
</string>
<string>
stop_computer_partition_installation
</string>
<string>
stop_computer_partition_installation
</string>
<string>
stop_requested
</string>
<string>
update_slave_partition_list
</string>
<string>
update_slave_partition_list
</string>
</tuple>
</tuple>
</value>
</value>
...
...
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/states/start_requested.xml
0 → 100644
View file @
f74598cc
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"StateDefinition"
module=
"Products.DCWorkflow.States"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
start_requested
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
transitions
</string>
</key>
<value>
<tuple>
<string>
destroy_computer_partition
</string>
<string>
report_computer_partition_error
</string>
<string>
request_computer_partition
</string>
<string>
request_destroy_computer_partition
</string>
<string>
request_destroy_computer_partition_action
</string>
<string>
request_software_instance
</string>
<string>
request_start_computer_partition
</string>
<string>
request_start_computer_partition_action
</string>
<string>
request_stop_computer_partition
</string>
<string>
request_stop_computer_partition_action
</string>
<string>
start_computer_partition
</string>
<string>
start_computer_partition_installation
</string>
<string>
start_requested
</string>
<string>
stop_computer_partition
</string>
<string>
stop_computer_partition_installation
</string>
<string>
stop_requested
</string>
<string>
update_slave_partition_list
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
type_list
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/states/stop_requested.xml
0 → 100644
View file @
f74598cc
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"StateDefinition"
module=
"Products.DCWorkflow.States"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
stop_requested
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
transitions
</string>
</key>
<value>
<tuple>
<string>
destroy_computer_partition
</string>
<string>
report_computer_partition_error
</string>
<string>
request_computer_partition
</string>
<string>
request_destroy_computer_partition
</string>
<string>
request_destroy_computer_partition_action
</string>
<string>
request_software_instance
</string>
<string>
request_start_computer_partition
</string>
<string>
request_start_computer_partition_action
</string>
<string>
request_stop_computer_partition
</string>
<string>
request_stop_computer_partition_action
</string>
<string>
start_computer_partition
</string>
<string>
start_computer_partition_installation
</string>
<string>
start_requested
</string>
<string>
stop_computer_partition
</string>
<string>
stop_computer_partition_installation
</string>
<string>
stop_requested
</string>
<string>
update_slave_partition_list
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
type_list
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/transitions/start_requested.xml
0 → 100644
View file @
f74598cc
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"TransitionDefinition"
module=
"Products.DCWorkflow.Transitions"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
start_requested
</string>
</value>
</item>
<item>
<key>
<string>
new_state_id
</string>
</key>
<value>
<string>
start_requested
</string>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/transitions/stop_requested.xml
0 → 100644
View file @
f74598cc
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"TransitionDefinition"
module=
"Products.DCWorkflow.Transitions"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
stop_requested
</string>
</value>
</item>
<item>
<key>
<string>
new_state_id
</string>
</key>
<value>
<string>
stop_requested
</string>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_base/bt/revision
View file @
f74598cc
244
246
\ No newline at end of file
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SalePackingList_stop.xml
View file @
f74598cc
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
<key>
<string>
after_script_name
</string>
</key>
<key>
<string>
after_script_name
</string>
</key>
<value>
<value>
<list>
<list>
<string>
SalePackingList_requestSt
artSoftwareInstanc
e
</string>
<string>
SalePackingList_requestSt
oredSoftwareInstanceStat
e
</string>
</list>
</list>
</value>
</value>
</item>
</item>
...
...
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_requestSt
artSoftwareInstanc
e.xml
→
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_requestSt
oredSoftwareInstanceStat
e.xml
View file @
f74598cc
...
@@ -59,7 +59,10 @@ sale_packing_list_line = sale_packing_list_line_list[0]\n
...
@@ -59,7 +59,10 @@ sale_packing_list_line = sale_packing_list_line_list[0]\n
resource = sale_packing_list_line.getResource()\n
resource = sale_packing_list_line.getResource()\n
if resource == preference_tool.getPreferredInstanceSetupResource():\n
if resource == preference_tool.getPreferredInstanceSetupResource():\n
software_instance = sale_packing_list_line.getAggregateValue(portal_type=\'Software Instance\')\n
software_instance = sale_packing_list_line.getAggregateValue(portal_type=\'Software Instance\')\n
if software_instance.getSlapState() == \'start_requested\':\n
software_instance.requestStartComputerPartition()\n
software_instance.requestStartComputerPartition()\n
elif software_instance.getSlapState() == \'stop_requested\':\n
software_instance.requestStopComputerPartition()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -68,7 +71,7 @@ if resource == preference_tool.getPreferredInstanceSetupResource():\n
...
@@ -68,7 +71,7 @@ if resource == preference_tool.getPreferredInstanceSetupResource():\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
SalePackingList_requestSt
artSoftwareInstanc
e
</string>
</value>
<value>
<string>
SalePackingList_requestSt
oredSoftwareInstanceStat
e
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/vifib_slap/bt/revision
View file @
f74598cc
383
384
\ No newline at end of file
master/product/Vifib/Tool/SlapTool.py
View file @
f74598cc
...
@@ -259,7 +259,7 @@ class SlapTool(BaseTool):
...
@@ -259,7 +259,7 @@ class SlapTool(BaseTool):
def
requestComputerPartition
(
self
,
computer_id
=
None
,
def
requestComputerPartition
(
self
,
computer_id
=
None
,
computer_partition_id
=
None
,
software_release
=
None
,
software_type
=
None
,
computer_partition_id
=
None
,
software_release
=
None
,
software_type
=
None
,
partition_reference
=
None
,
shared_xml
=
None
,
partition_parameter_xml
=
None
,
partition_reference
=
None
,
shared_xml
=
None
,
partition_parameter_xml
=
None
,
filter_xml
=
None
):
filter_xml
=
None
,
state
=
None
):
"""
"""
Asynchronously requests creation of computer partition for assigned
Asynchronously requests creation of computer partition for assigned
parameters
parameters
...
@@ -273,7 +273,7 @@ class SlapTool(BaseTool):
...
@@ -273,7 +273,7 @@ class SlapTool(BaseTool):
"""
"""
return
self
.
_requestComputerPartition
(
computer_id
,
computer_partition_id
,
return
self
.
_requestComputerPartition
(
computer_id
,
computer_partition_id
,
software_release
,
software_type
,
partition_reference
,
software_release
,
software_type
,
partition_reference
,
shared_xml
,
partition_parameter_xml
,
filter_xml
)
shared_xml
,
partition_parameter_xml
,
filter_xml
,
state
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'useComputer'
)
'useComputer'
)
...
@@ -565,7 +565,7 @@ class SlapTool(BaseTool):
...
@@ -565,7 +565,7 @@ class SlapTool(BaseTool):
@
convertToREST
@
convertToREST
def
_requestComputerPartition
(
self
,
computer_id
,
computer_partition_id
,
def
_requestComputerPartition
(
self
,
computer_id
,
computer_partition_id
,
software_release
,
software_type
,
partition_reference
,
software_release
,
software_type
,
partition_reference
,
shared_xml
,
partition_parameter_xml
,
filter_xml
):
shared_xml
,
partition_parameter_xml
,
filter_xml
,
state
):
"""
"""
Asynchronously requests creation of computer partition for assigned
Asynchronously requests creation of computer partition for assigned
parameters
parameters
...
@@ -578,6 +578,10 @@ class SlapTool(BaseTool):
...
@@ -578,6 +578,10 @@ class SlapTool(BaseTool):
In any other case returns not important data and HTTP code is 403 Forbidden
In any other case returns not important data and HTTP code is 403 Forbidden
"""
"""
if
state
:
state
=
xml_marshaller
.
xml_marshaller
.
loads
(
state
)
if
state
is
None
:
state
=
'started'
if
shared_xml
:
if
shared_xml
:
shared
=
xml_marshaller
.
xml_marshaller
.
loads
(
shared_xml
)
shared
=
xml_marshaller
.
xml_marshaller
.
loads
(
shared_xml
)
else
:
else
:
...
@@ -621,7 +625,8 @@ class SlapTool(BaseTool):
...
@@ -621,7 +625,8 @@ class SlapTool(BaseTool):
partition_reference
=
partition_reference
,
partition_reference
=
partition_reference
,
shared
=
shared
,
shared
=
shared
,
instance_xml
=
instance_xml
,
instance_xml
=
instance_xml
,
sla_xml
=
sla_xml
)
sla_xml
=
sla_xml
,
state
=
state
)
# Get requested software instance
# Get requested software instance
requested_software_instance
=
software_instance_document
.
portal_catalog
.
\
requested_software_instance
=
software_instance_document
.
portal_catalog
.
\
...
@@ -643,7 +648,8 @@ class SlapTool(BaseTool):
...
@@ -643,7 +648,8 @@ class SlapTool(BaseTool):
software_title
=
partition_reference
,
software_title
=
partition_reference
,
shared
=
shared
,
shared
=
shared
,
instance_xml
=
instance_xml
,
instance_xml
=
instance_xml
,
sla_xml
=
sla_xml
)
sla_xml
=
sla_xml
,
state
=
state
)
requested_software_instance
=
person
.
portal_catalog
.
\
requested_software_instance
=
person
.
portal_catalog
.
\
getResultValue
(
getResultValue
(
portal_type
=
"Software Instance"
,
portal_type
=
"Software Instance"
,
...
...
master/product/Vifib/tests/VifibMixin.py
View file @
f74598cc
...
@@ -33,12 +33,12 @@ from Products.ERP5Type.tests.utils import DummyMailHost
...
@@ -33,12 +33,12 @@ from Products.ERP5Type.tests.utils import DummyMailHost
import
os
import
os
REQUIRED_RULE_REFERENCE_LIST
=
[
REQUIRED_RULE_REFERENCE_LIST
=
[
'default_delivery_rule'
,
'default_order_rule'
,
'default_delivering_rule'
,
'default_delivering_rule'
,
'default_invoicing_rule'
,
'default_delivery_rule'
,
'default_invoice_transaction_rule'
,
'default_invoice_rule'
,
'default_invoice_rule'
,
'default_invoice_transaction_rule'
,
'default_invoicing_rule'
,
'default_order_rule'
,
]
]
...
...
master/product/Vifib/tests/testVifibSlapWebService.py
View file @
f74598cc
...
@@ -35,6 +35,9 @@ from Products.ERP5Type.tests.backportUnittest import skip
...
@@ -35,6 +35,9 @@ from Products.ERP5Type.tests.backportUnittest import skip
from
VifibMixin
import
testVifibMixin
from
VifibMixin
import
testVifibMixin
from
random
import
random
from
random
import
random
from
slapos
import
slap
from
slapos
import
slap
import
urllib
import
urlparse
import
httplib
from
xml_marshaller
import
xml_marshaller
from
xml_marshaller
import
xml_marshaller
import
transaction
import
transaction
import
unittest
import
unittest
...
@@ -204,6 +207,15 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -204,6 +207,15 @@ class TestVifibSlapWebService(testVifibMixin):
and
q
.
getSimulationState
()
==
state
]
and
q
.
getSimulationState
()
==
state
]
self
.
assertEqual
(
1
,
len
(
delivery_line_list
))
self
.
assertEqual
(
1
,
len
(
delivery_line_list
))
def
_checkComputerPartitionNoSalePackingList
(
self
,
resource
,
sequence
):
computer_partition
=
self
.
portal
.
portal_catalog
.
getResultValue
(
uid
=
sequence
[
'computer_partition_uid'
])
delivery_line_list
=
[
q
for
q
in
computer_partition
.
getAggregateRelatedValueList
(
portal_type
=
self
.
sale_packing_list_line_portal_type
)
if
q
.
getResource
()
==
resource
]
self
.
assertEqual
(
0
,
len
(
delivery_line_list
))
def
stepCheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists
(
self
,
def
stepCheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists
(
self
,
sequence
,
**
kw
):
sequence
,
**
kw
):
self
.
_checkComputerPartitionSalePackingListDoesNotExists
(
self
.
_checkComputerPartitionSalePackingListDoesNotExists
(
...
@@ -288,6 +300,12 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -288,6 +300,12 @@ class TestVifibSlapWebService(testVifibMixin):
self
.
portal
.
portal_preferences
.
getPreferredInstanceHostingResource
(),
self
.
portal
.
portal_preferences
.
getPreferredInstanceHostingResource
(),
sequence
)
sequence
)
def
stepCheckComputerPartitionNoInstanceHostingSalePackingList
(
self
,
sequence
,
**
kw
):
self
.
_checkComputerPartitionNoSalePackingList
(
self
.
portal
.
portal_preferences
.
getPreferredInstanceHostingResource
(),
sequence
)
def
stepCheckComputerPartitionAccoutingResourceSalePackingListCancelled
(
self
,
def
stepCheckComputerPartitionAccoutingResourceSalePackingListCancelled
(
self
,
sequence
,
**
kw
):
sequence
,
**
kw
):
self
.
_checkComputerPartitionSalePackingListState
(
'cancelled'
,
self
.
_checkComputerPartitionSalePackingListState
(
'cancelled'
,
...
@@ -1381,13 +1399,33 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -1381,13 +1399,33 @@ class TestVifibSlapWebService(testVifibMixin):
partition_reference
=
sequence
.
get
(
'requested_reference'
,
partition_reference
=
sequence
.
get
(
'requested_reference'
,
'requested_reference'
),
'requested_reference'
),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}))
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}),
state
=
sequence
.
get
(
'instance_state'
))
sequence
.
edit
(
sequence
.
edit
(
requested_slap_computer_partition
=
requested_slap_computer_partition
,
requested_slap_computer_partition
=
requested_slap_computer_partition
,
requested_computer_partition_reference
=
\
requested_computer_partition_reference
=
\
requested_slap_computer_partition
.
getId
())
requested_slap_computer_partition
.
getId
())
def
stepDirectRequestComputerPartitionNotReadyResponseWithoutState
(
self
,
sequence
,
**
kw
):
request_dict
=
{
'computer_id'
:
sequence
[
'computer_reference'
]
,
'computer_partition_id'
:
sequence
[
'computer_partition_reference'
],
'software_release'
:
sequence
[
'software_release_uri'
],
'software_type'
:
sequence
.
get
(
'requested_reference'
,
'requested_reference'
),
'partition_reference'
:
sequence
.
get
(
'requested_reference'
,
'requested_reference'
),
'shared_xml'
:
xml_marshaller
.
dumps
(
False
),
'partition_parameter_xml'
:
xml_marshaller
.
dumps
({}),
'filter_xml'
:
xml_marshaller
.
dumps
({}),
#'state': Note: State is omitted
}
scheme
,
netloc
,
path
,
query
,
fragment
=
urlparse
.
urlsplit
(
self
.
server_url
)
connection
=
httplib
.
HTTPConnection
(
host
=
netloc
)
connection
.
request
(
"POST"
,
path
+
'/requestComputerPartition'
,
urllib
.
urlencode
(
request_dict
),
{
'Content-type'
:
"application/x-www-form-urlencoded"
})
response
=
connection
.
getresponse
()
self
.
assertEqual
(
httplib
.
REQUEST_TIMEOUT
,
response
.
status
)
def
stepRequestComputerPartitionNotReadyResponse
(
self
,
sequence
,
**
kw
):
def
stepRequestComputerPartitionNotReadyResponse
(
self
,
sequence
,
**
kw
):
self
.
slap
=
slap
.
slap
()
self
.
slap
=
slap
.
slap
()
self
.
slap
.
initializeConnection
(
self
.
server_url
)
self
.
slap
.
initializeConnection
(
self
.
server_url
)
...
@@ -1400,7 +1438,8 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -1400,7 +1438,8 @@ class TestVifibSlapWebService(testVifibMixin):
partition_reference
=
sequence
.
get
(
'requested_reference'
,
partition_reference
=
sequence
.
get
(
'requested_reference'
,
'requested_reference'
),
'requested_reference'
),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}))
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}),
state
=
sequence
.
get
(
'instance_state'
))
def
stepRequestComputerPartitionNotFoundResponse
(
self
,
sequence
,
**
kw
):
def
stepRequestComputerPartitionNotFoundResponse
(
self
,
sequence
,
**
kw
):
self
.
slap
=
slap
.
slap
()
self
.
slap
=
slap
.
slap
()
...
@@ -1414,7 +1453,8 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -1414,7 +1453,8 @@ class TestVifibSlapWebService(testVifibMixin):
partition_reference
=
sequence
.
get
(
'requested_reference'
,
partition_reference
=
sequence
.
get
(
'requested_reference'
,
'requested_reference'
),
'requested_reference'
),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
partition_parameter_kw
=
sequence
.
get
(
'requested_parameter_dict'
,
{}),
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}))
filter_kw
=
sequence
.
get
(
'requested_filter_dict'
,
{}),
state
=
sequence
.
get
(
'instance_state'
))
def
stepSetSoftwareInstanceChildrenA
(
self
,
sequence
,
**
kw
):
def
stepSetSoftwareInstanceChildrenA
(
self
,
sequence
,
**
kw
):
software_instance_uid
=
sequence
[
'root_software_instance_uid'
]
software_instance_uid
=
sequence
[
'root_software_instance_uid'
]
...
@@ -1620,7 +1660,8 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -1620,7 +1660,8 @@ class TestVifibSlapWebService(testVifibMixin):
shared
=
False
,
shared
=
False
,
filter_kw
=
{},
filter_kw
=
{},
instance_xml
=
self
.
minimal_correct_xml
,
instance_xml
=
self
.
minimal_correct_xml
,
sla_xml
=
self
.
minimal_correct_xml
)
sla_xml
=
self
.
minimal_correct_xml
,
state
=
None
)
finally
:
finally
:
Base
.
serialize
=
Base
.
serialize_call
Base
.
serialize
=
Base
.
serialize_call
...
@@ -3621,9 +3662,15 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -3621,9 +3662,15 @@ class TestVifibSlapWebService(testVifibMixin):
def
stepSetCurrentSoftwareInstanceRequested
(
self
,
sequence
):
def
stepSetCurrentSoftwareInstanceRequested
(
self
,
sequence
):
sequence
.
edit
(
sequence
.
edit
(
requester_software_instance_uid
=
sequence
[
'software_instance_uid'
],
software_instance_uid
=
sequence
[
'requested_software_instance_uid'
],
software_instance_uid
=
sequence
[
'requested_software_instance_uid'
],
)
)
def
stepSetCurrentSoftwareInstanceRequester
(
self
,
sequence
):
sequence
.
edit
(
software_instance_uid
=
sequence
[
'requester_software_instance_uid'
]
)
def
test_ComputerPartition_request_instantiate
(
self
):
def
test_ComputerPartition_request_instantiate
(
self
):
"""
"""
Check that after computer partition is requested it is possible to
Check that after computer partition is requested it is possible to
...
@@ -3688,6 +3735,185 @@ class TestVifibSlapWebService(testVifibMixin):
...
@@ -3688,6 +3735,185 @@ class TestVifibSlapWebService(testVifibMixin):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
stepSetInstanceStateStopped
(
self
,
sequence
=
None
,
**
kw
):
sequence
[
'instance_state'
]
=
'stopped'
def
test_ComputerPartition_request_instantiate_state_stopped
(
self
):
"""
Check that after computer partition is requested it is possible to
instantiate it and it is stopped correctly, as requested initally.
"""
self
.
computer_partition_amount
=
2
sequence_list
=
SequenceList
()
sequence_string
=
self
.
prepare_install_requested_computer_partition_sequence_string
+
'
\
SetInstanceStateStopped
\
SlapLoginCurrentSoftwareInstance
\
RequestComputerPartitionNotReadyResponse
\
Tic
\
SlapLogout
\
\
SlapLoginCurrentSoftwareInstance
\
RequestComputerPartition
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckSoftwareInstanceAndRelatedComputerPartition
\
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
\
Logout
\
\
SlapLoginCurrentSoftwareInstance
\
CheckRequestedComputerPartitionCleanParameterList
\
Logout
\
\
LoginDefaultUser
\
SetCurrentSoftwareInstanceRequested
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceBuilding
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceSetupSalePackingListStarted
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceAvailable
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceSetupSalePackingListStopped
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceStopped
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
stepCheckComputerPartitionNoInstanceHostingSalePackingList
\
Logout
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_ComputerPartition_request_instantiate_stop_later
(
self
):
"""
Check that after computer partition is requested it is possible to
instantiate it and it is started correctly, and later it is stopped
correctly as requested.
"""
self
.
computer_partition_amount
=
2
sequence_list
=
SequenceList
()
sequence_string
=
self
.
prepare_install_requested_computer_partition_sequence_string
+
'
\
SlapLoginCurrentSoftwareInstance
\
RequestComputerPartitionNotReadyResponse
\
Tic
\
SlapLogout
\
\
SlapLoginCurrentSoftwareInstance
\
RequestComputerPartition
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckSoftwareInstanceAndRelatedComputerPartition
\
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
\
Logout
\
\
SlapLoginCurrentSoftwareInstance
\
CheckRequestedComputerPartitionCleanParameterList
\
Logout
\
\
LoginDefaultUser
\
SetCurrentSoftwareInstanceRequested
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceBuilding
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceSetupSalePackingListStarted
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceAvailable
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceSetupSalePackingListStopped
\
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceStarted
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceHostingSalePackingListStarted
\
Logout
\
\
SetInstanceStateStopped
\
\
LoginDefaultUser
\
SetCurrentSoftwareInstanceRequester
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
Logout
\
\
SlapLoginCurrentSoftwareInstance
\
RequestComputerPartition
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
SetCurrentSoftwareInstanceRequested
\
SetSelectedComputerPartition
\
SelectCurrentlyUsedSalePackingListUid
\
CheckComputerPartitionInstanceHostingSalePackingListStopped
\
Logout
\
\
SlapLoginCurrentComputer
\
SoftwareInstanceStopped
\
Tic
\
SlapLogout
\
\
LoginDefaultUser
\
CheckComputerPartitionInstanceHostingSalePackingListDelivered
\
Logout
\
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_ComputerPartition_request_state_is_optional
(
self
):
"""Checks that state is optional parameter on Slap Tool
This ensures backward compatibility with old libraries."""
self
.
computer_partition_amount
=
2
sequence_list
=
SequenceList
()
sequence_string
=
\
self
.
prepare_install_requested_computer_partition_sequence_string
+
'
\
SlapLoginCurrentSoftwareInstance
\
DirectRequestComputerPartitionNotReadyResponseWithoutState
\
Tic
\
SlapLogout
\
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
# XXX: This test fails because test_vifib_customer security is cached
# XXX: This test fails because test_vifib_customer security is cached
# and this user is not in SOFTINST-x group. We do not want to clear
# and this user is not in SOFTINST-x group. We do not want to clear
# cache in tests.
# cache in tests.
...
...
slapos/format/__init__.py
View file @
f74598cc
...
@@ -723,8 +723,9 @@ class Parser(OptionParser):
...
@@ -723,8 +723,9 @@ class Parser(OptionParser):
"declaration."
,
"declaration."
,
type
=
str
),
type
=
str
),
Option
(
"-n"
,
"--dry_run"
,
Option
(
"-n"
,
"--dry_run"
,
help
=
"Apply no changes, only print what would happen."
,
help
=
"Don't actually do anything."
,
type
=
str
),
default
=
False
,
action
=
"store_true"
),
Option
(
"-v"
,
"--verbose"
,
Option
(
"-v"
,
"--verbose"
,
default
=
False
,
default
=
False
,
action
=
"store_true"
,
action
=
"store_true"
,
...
@@ -737,10 +738,6 @@ class Parser(OptionParser):
...
@@ -737,10 +738,6 @@ class Parser(OptionParser):
help
=
"Shall slapformat alter user database [default: True]"
),
help
=
"Shall slapformat alter user database [default: True]"
),
Option
(
'--alter_network'
,
choices
=
[
'True'
,
'False'
],
Option
(
'--alter_network'
,
choices
=
[
'True'
,
'False'
],
help
=
"Shall slapformat alter network configuration [default: True]"
),
help
=
"Shall slapformat alter network configuration [default: True]"
),
Option
(
"-d"
,
"--dry-run"
,
default
=
False
,
action
=
"store_true"
,
help
=
"Don't actually do anything."
),
])
])
def
check_args
(
self
):
def
check_args
(
self
):
...
...
slapos/grid/utils.py
View file @
f74598cc
...
@@ -236,6 +236,7 @@ def bootstrapBuildout(path, buildout=None,
...
@@ -236,6 +236,7 @@ def bootstrapBuildout(path, buildout=None,
invocation_list
.
append
(
pkg_resources
.
resource_filename
(
__name__
,
invocation_list
.
append
(
pkg_resources
.
resource_filename
(
__name__
,
'zc.buildout-bootstap.py'
))
'zc.buildout-bootstap.py'
))
invocation_list
.
extend
(
additional_buildout_parametr_list
)
invocation_list
.
extend
(
additional_buildout_parametr_list
)
if
buildout
is
not
None
:
invocation_list
.
append
(
'bootstrap'
)
invocation_list
.
append
(
'bootstrap'
)
try
:
try
:
umask
=
os
.
umask
(
SAFE_UMASK
)
umask
=
os
.
umask
(
SAFE_UMASK
)
...
...
slapos/slap/slap.py
View file @
f74598cc
...
@@ -149,7 +149,8 @@ class OpenOrder(SlapDocument):
...
@@ -149,7 +149,8 @@ class OpenOrder(SlapDocument):
zope
.
interface
.
implements
(
interface
.
IOpenOrder
)
zope
.
interface
.
implements
(
interface
.
IOpenOrder
)
def
request
(
self
,
software_release
,
partition_reference
,
def
request
(
self
,
software_release
,
partition_reference
,
partition_parameter_kw
=
None
,
software_type
=
None
,
filter_kw
=
None
):
partition_parameter_kw
=
None
,
software_type
=
None
,
filter_kw
=
None
,
state
=
None
):
if
partition_parameter_kw
is
None
:
if
partition_parameter_kw
is
None
:
partition_parameter_kw
=
{}
partition_parameter_kw
=
{}
if
filter_kw
is
None
:
if
filter_kw
is
None
:
...
@@ -158,7 +159,8 @@ class OpenOrder(SlapDocument):
...
@@ -158,7 +159,8 @@ class OpenOrder(SlapDocument):
'software_release'
:
software_release
,
'software_release'
:
software_release
,
'partition_reference'
:
partition_reference
,
'partition_reference'
:
partition_reference
,
'partition_parameter_xml'
:
xml_marshaller
.
dumps
(
partition_parameter_kw
),
'partition_parameter_xml'
:
xml_marshaller
.
dumps
(
partition_parameter_kw
),
'filter_xml'
:
xml_marshaller
.
dumps
(
filter_kw
)
'filter_xml'
:
xml_marshaller
.
dumps
(
filter_kw
),
'state'
:
state
,
}
}
if
software_type
is
not
None
:
if
software_type
is
not
None
:
request_dict
[
'software_type'
]
=
software_type
request_dict
[
'software_type'
]
=
software_type
...
@@ -282,7 +284,8 @@ class ComputerPartition(SlapDocument):
...
@@ -282,7 +284,8 @@ class ComputerPartition(SlapDocument):
# Computer Partition data are fetch from server shall be delayed
# Computer Partition data are fetch from server shall be delayed
@
_syncComputerPartitionInformation
@
_syncComputerPartitionInformation
def
request
(
self
,
software_release
,
software_type
,
partition_reference
,
def
request
(
self
,
software_release
,
software_type
,
partition_reference
,
shared
=
False
,
partition_parameter_kw
=
None
,
filter_kw
=
None
):
shared
=
False
,
partition_parameter_kw
=
None
,
filter_kw
=
None
,
state
=
None
):
if
partition_parameter_kw
is
None
:
if
partition_parameter_kw
is
None
:
partition_parameter_kw
=
{}
partition_parameter_kw
=
{}
elif
not
isinstance
(
partition_parameter_kw
,
dict
):
elif
not
isinstance
(
partition_parameter_kw
,
dict
):
...
@@ -304,6 +307,7 @@ class ComputerPartition(SlapDocument):
...
@@ -304,6 +307,7 @@ class ComputerPartition(SlapDocument):
'partition_parameter_xml'
:
xml_marshaller
.
dumps
(
'partition_parameter_xml'
:
xml_marshaller
.
dumps
(
partition_parameter_kw
),
partition_parameter_kw
),
'filter_xml'
:
xml_marshaller
.
dumps
(
filter_kw
),
'filter_xml'
:
xml_marshaller
.
dumps
(
filter_kw
),
'state'
:
xml_marshaller
.
dumps
(
state
),
}
}
self
.
_connection_helper
.
POST
(
'/requestComputerPartition'
,
request_dict
)
self
.
_connection_helper
.
POST
(
'/requestComputerPartition'
,
request_dict
)
xml
=
self
.
_connection_helper
.
response
.
read
()
xml
=
self
.
_connection_helper
.
response
.
read
()
...
...
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