Commit f74598cc authored by Gabriel Monnerat's avatar Gabriel Monnerat

merged with master

parents 22437b34 34f0974e
......@@ -4,6 +4,8 @@
* general: Polish requirement versions. [Arnaud Fontaine]
* general: Remove libnetworkcache. [Lucas Carvalho]
* 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]
* slapgrid: Allow to select any buildout binary used to bootstrap environment.
[Łukasz Nowak]
......
......@@ -62,6 +62,7 @@ shared = kwargs["shared"]\n
software_type = kwargs["software_type"]\n
instance_xml = kwargs["instance_xml"]\n
sla_xml = kwargs["sla_xml"]\n
state = kwargs["state"]\n
\n
# Get root software instance\n
predecessor_software_instance = software_instance\n
......@@ -129,8 +130,17 @@ else:\n
predecessor_software_instance.edit(\n
predecessor_uid_list=predecessor_uid_list,\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
\n
\n
software_instance.edit(\n
predecessor_list=predecessor_list,\n
activate_kw={\'tag\': tag},)\n
......
......@@ -56,14 +56,22 @@ software_instance = state_change[\'object\']\n
service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceHostingResource()\n
need_to_create_packing_list = False\n
\n
try:\n
sale_packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
instance_setup_line = context.SoftwareInstance_getInstanceSetupPackingListLine(state_change)\n
except ValueError:\n
need_to_create_packing_list = True\n
pass\n
else:\n
if sale_packing_list_line.getSimulationState() == \'delivered\':\n
need_to_create_packing_list = True\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
need_to_create_packing_list = True\n
\n
portal = context.getPortalObject()\n
if need_to_create_packing_list:\n
......
......@@ -50,9 +50,13 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
packing_list = packing_list_line.getParentValue()\n
packing_list.stop()\n
<value> <string>try:\n
packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
except ValueError:\n
pass\n
else:\n
packing_list = packing_list_line.getParentValue()\n
packing_list.stop()\n
</string> </value>
</item>
<item>
......
......@@ -34,8 +34,10 @@
<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>
......
<?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>
<?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>
<?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>
<?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>
......@@ -28,7 +28,7 @@
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>SalePackingList_requestStartSoftwareInstance</string>
<string>SalePackingList_requestStoredSoftwareInstanceState</string>
</list>
</value>
</item>
......
......@@ -59,7 +59,10 @@ sale_packing_list_line = sale_packing_list_line_list[0]\n
resource = sale_packing_list_line.getResource()\n
if resource == preference_tool.getPreferredInstanceSetupResource():\n
software_instance = sale_packing_list_line.getAggregateValue(portal_type=\'Software Instance\')\n
software_instance.requestStartComputerPartition()\n
if software_instance.getSlapState() == \'start_requested\':\n
software_instance.requestStartComputerPartition()\n
elif software_instance.getSlapState() == \'stop_requested\':\n
software_instance.requestStopComputerPartition()\n
</string> </value>
</item>
<item>
......@@ -68,7 +71,7 @@ if resource == preference_tool.getPreferredInstanceSetupResource():\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_requestStartSoftwareInstance</string> </value>
<value> <string>SalePackingList_requestStoredSoftwareInstanceState</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -259,7 +259,7 @@ class SlapTool(BaseTool):
def requestComputerPartition(self, computer_id=None,
computer_partition_id=None, software_release=None, software_type=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
parameters
......@@ -273,7 +273,7 @@ class SlapTool(BaseTool):
"""
return self._requestComputerPartition(computer_id, computer_partition_id,
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,
'useComputer')
......@@ -565,7 +565,7 @@ class SlapTool(BaseTool):
@convertToREST
def _requestComputerPartition(self, computer_id, computer_partition_id,
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
parameters
......@@ -578,6 +578,10 @@ class SlapTool(BaseTool):
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:
shared = xml_marshaller.xml_marshaller.loads(shared_xml)
else:
......@@ -621,7 +625,8 @@ class SlapTool(BaseTool):
partition_reference=partition_reference,
shared=shared,
instance_xml=instance_xml,
sla_xml=sla_xml)
sla_xml=sla_xml,
state=state)
# Get requested software instance
requested_software_instance = software_instance_document.portal_catalog.\
......@@ -643,7 +648,8 @@ class SlapTool(BaseTool):
software_title=partition_reference,
shared=shared,
instance_xml=instance_xml,
sla_xml=sla_xml)
sla_xml=sla_xml,
state=state)
requested_software_instance = person.portal_catalog.\
getResultValue(
portal_type="Software Instance",
......
......@@ -33,12 +33,12 @@ from Products.ERP5Type.tests.utils import DummyMailHost
import os
REQUIRED_RULE_REFERENCE_LIST = [
'default_delivery_rule',
'default_order_rule',
'default_delivering_rule',
'default_invoicing_rule',
'default_invoice_transaction_rule',
'default_delivery_rule',
'default_invoice_rule',
'default_invoice_transaction_rule',
'default_invoicing_rule',
'default_order_rule',
]
......
......@@ -723,8 +723,9 @@ class Parser(OptionParser):
"declaration.",
type=str),
Option("-n", "--dry_run",
help="Apply no changes, only print what would happen.",
type=str),
help="Don't actually do anything.",
default=False,
action="store_true"),
Option("-v", "--verbose",
default=False,
action="store_true",
......@@ -737,10 +738,6 @@ class Parser(OptionParser):
help="Shall slapformat alter user database [default: True]"),
Option('--alter_network', choices=['True', 'False'],
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):
......
......@@ -236,7 +236,8 @@ def bootstrapBuildout(path, buildout=None,
invocation_list.append(pkg_resources.resource_filename(__name__,
'zc.buildout-bootstap.py'))
invocation_list.extend(additional_buildout_parametr_list)
invocation_list.append('bootstrap')
if buildout is not None:
invocation_list.append('bootstrap')
try:
umask = os.umask(SAFE_UMASK)
logger.debug('Set umask from %03o to %03o' % (umask, SAFE_UMASK))
......
......@@ -149,7 +149,8 @@ class OpenOrder(SlapDocument):
zope.interface.implements(interface.IOpenOrder)
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:
partition_parameter_kw = {}
if filter_kw is None:
......@@ -158,7 +159,8 @@ class OpenOrder(SlapDocument):
'software_release': software_release,
'partition_reference': partition_reference,
'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:
request_dict['software_type'] = software_type
......@@ -282,7 +284,8 @@ class ComputerPartition(SlapDocument):
# Computer Partition data are fetch from server shall be delayed
@_syncComputerPartitionInformation
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:
partition_parameter_kw = {}
elif not isinstance(partition_parameter_kw, dict):
......@@ -304,6 +307,7 @@ class ComputerPartition(SlapDocument):
'partition_parameter_xml': xml_marshaller.dumps(
partition_parameter_kw),
'filter_xml': xml_marshaller.dumps(filter_kw),
'state': xml_marshaller.dumps(state),
}
self._connection_helper.POST('/requestComputerPartition', request_dict)
xml = self._connection_helper.response.read()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment