Commit 70dfeda7 authored by Łukasz Nowak's avatar Łukasz Nowak

Merge remote-tracking branch 'origin/master' into payzen-fixup

parents 2173d319 35752d44
......@@ -4,10 +4,8 @@ Changes
0.25 (Unreleased)
-----------------
* Bugfix: Remove CONFIG_SITE from environment variables. On some platforms, it
can change any software's libdir name (to things like lib64) and thus
break all other software trying to fetch libraries.
[Cedric de Saint Martin]
* Fix support for no_bridge option in configuration files for some values:
no_bridge = false was stated as true. [Cedric de Saint Martin]
0.24 (2012-03-29)
-----------------
......
......@@ -68,7 +68,7 @@ CREATE TABLE `computer_partition` (\n
`free_for_request` INT(1),\n
`software_type` VARCHAR(255),\n
PRIMARY KEY (`uid`, `software_release_url`)\n
) TYPE=InnoDB;\n
) ENGINE=InnoDB;\n
</string> </value>
</item>
<item>
......
......@@ -66,7 +66,7 @@ CREATE TABLE `software_instance_tree` (\n
`uid` BIGINT UNSIGNED NOT NULL,\n
`root_uid` BIGINT UNSIGNED NOT NULL,\n
PRIMARY KEY (`uid`, `root_uid`)\n
) TYPE=InnoDB;\n
) ENGINE=InnoDB;\n
</string> </value>
</item>
<item>
......
......@@ -65,7 +65,7 @@
`url` varchar(255),\n
`state` varchar(255),\n
PRIMARY KEY (`uid`, `delivery_line_uid`)\n
) TYPE=InnoDB;\n
) ENGINE=InnoDB;\n
</string> </value>
</item>
<item>
......
......@@ -43,7 +43,7 @@
KEY `effective_date` (`effective_date`),\n
KEY `expiration_date` (`effective_date`),\n
KEY `frequency_index` (`creation_date_index`, `frequency_index`)\n
) TYPE=InnoDB;\n
) ENGINE=InnoDB;\n
</string> </value>
</item>
<item>
......
36
\ No newline at end of file
37
\ No newline at end of file
......@@ -74,6 +74,11 @@ else:\n
tag = "%s_%s_inProgress" % (person.getUid(), \n
software_title)\n
\n
if (portal.portal_activities.countMessageWithTag(tag) > 0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
# Check if it already exists\n
cleanup_resource = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
request_hosting_subscription = None\n
......@@ -86,6 +91,8 @@ for hs in portal.portal_catalog(\n
try:\n
cleanup_delivery_line = si.Item_getInstancePackingListLine(cleanup_resource)\n
except ValueError:\n
order_line = si.getAggregateRelatedValue(portal_type=\'Sale Order Line\')\n
if order_line.getSimulationState() != \'cancelled\':\n
request_hosting_subscription = hs\n
break\n
else:\n
......@@ -93,11 +100,6 @@ for hs in portal.portal_catalog(\n
request_hosting_subscription = hs\n
break\n
\n
if (portal.portal_activities.countMessageWithTag(tag) > 0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
if (request_hosting_subscription is None):\n
hosting_subscription_reference = "HOSTSUBS-%s" % context.getPortalObject().portal_ids\\\n
.generateNewId(id_group=\'slap_hosting_subscription_reference\', id_generator=\'uid\')\n
......
689
\ No newline at end of file
691
\ No newline at end of file
......@@ -1212,6 +1212,73 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_request_new_with_destroyed_while_looking_for_partition_reference(self):
"""Prove that having destroyed SI allows to request new one with same
reference, when destruction was done while looking for new partition"""
self.computer_partition_amount = 0
sequence_list = SequenceList()
sequence_string = self.prepare_published_software_release + \
self.prepare_formated_computer + """
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
SetRandomRequestedReference
SlapLoginTestVifibCustomer
PersonRequestSlapSoftwareInstancePrepare
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginTestVifibCustomer
PersonRequestSlapSoftwareInstance
Tic
SlapLogout
LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
CheckSoftwareInstanceNoDeliveryRelated
Logout
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
Logout
LoginDefaultUser
CheckSoftwareInstanceCancelledSaleOrderLine
Tic # in order to give chance to update Open Order
CheckOpenOrderLineRemoved
Logout
SlapLoginTestVifibCustomer
PersonRequestSlapSoftwareInstance
Tic
SlapLogout
LoginDefaultUser
SetCurrentPersonSlapRequestedSoftwareInstance
CheckSoftwareInstanceOrderedSaleOrderLine
CheckSoftwareInstanceNoDeliveryRelated
Logout
LoginERP5TypeTestCase
CheckSiteConsistency
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_request_new_with_destroyed_reference(self):
"""Prove that having destroyed SI allows to request new one with same
reference"""
......
......@@ -128,18 +128,6 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCheckSoftwareInstanceNoDeliveryRelated(self, sequence, **kw):
self.assertEqual(None, self.portal.portal_catalog.getResultValue(
default_aggregate_uid=sequence['software_instance_uid'],
portal_type=self.sale_packing_list_line_portal_type
))
def stepCheckSoftwareInstanceCancelledSaleOrderLine(self, sequence, **kw):
self.assertEqual('cancelled', self.portal.portal_catalog.getResultValue(
default_aggregate_uid=sequence['software_instance_uid'],
portal_type=self.sale_order_line_portal_type
).getSimulationState())
def test_person_destroy_not_instanciable_software_instance(self):
"""Check that if there is no way to instantiate software instance
on any partition person is able to destroy it"""
......
......@@ -177,6 +177,24 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
########################################
# Steps -- scenarios
########################################
def stepCheckSoftwareInstanceNoDeliveryRelated(self, sequence, **kw):
self.assertEqual(None, self.portal.portal_catalog.getResultValue(
default_aggregate_uid=sequence['software_instance_uid'],
portal_type=self.sale_packing_list_line_portal_type
))
def stepCheckSoftwareInstanceCancelledSaleOrderLine(self, sequence, **kw):
self.assertEqual('cancelled', self.portal.portal_catalog.getResultValue(
default_aggregate_uid=sequence['software_instance_uid'],
portal_type=self.sale_order_line_portal_type
).getSimulationState())
def stepCheckSoftwareInstanceOrderedSaleOrderLine(self, sequence, **kw):
self.assertEqual('ordered', self.portal.portal_catalog.getResultValue(
default_aggregate_uid=sequence['software_instance_uid'],
portal_type=self.sale_order_line_portal_type
).getSimulationState())
def stepCheckOpenOrderLineRemoved(self, sequence, **kw):
software_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
......@@ -354,9 +372,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
portal_type=self.software_instance_portal_type,
title=sequence['requested_reference']):
# only not yet destroyed ones
try:
software_instance.Item_getInstancePackingListLine(cleanup_resource)
except ValueError:
if software_instance.SoftwareInstance_getStatus() != 'Destroyed':
software_instance_list.append(software_instance)
self.assertEqual(1, len(software_instance_list))
......
......@@ -2,21 +2,22 @@
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = https://slap.vifib.com/
computer_id = your computer id
buildout = /path/to/buildout/binary
# Replace computer_id by the unique identifier of your computer on vifib.net,
# starting by COMP-
computer_id = COMP-12345
key_file = /etc/opt/slapos/key
cert_file = /etc/opt/slapos/certificate
certificate_repository_path = /etc/opt/slapos/pki/
[slapformat]
# Replace by your network interface like eth0, eth1, slapbr0...
interface_name = interfacename
computer_xml = /opt/slapos/slapos.xml
log_file = /opt/slapos/slapformat.log
partition_amount = 200
interface_name = br0
partition_amount = 20
partition_base_name = slappart
user_base_name = slapuser
tap_base_name = slaptap
# You can choose any other local network which does not conflict with your
# current machine configuration
ipv4_local_network = 10.0.0.0/16
[slapproxy]
host = 127.0.0.1
port = 5000
# You could also specify: /path/to/file
database_uri = :memory:
......@@ -1080,12 +1080,13 @@ class Config(object):
self.logger.addHandler(logging.StreamHandler())
# Convert strings to booleans
root_needed = False
for o in ['alter_network', 'alter_user']:
if getattr(self, o).lower() == 'true':
for o in ['alter_network', 'alter_user', 'no_bridge']:
attr = getattr(self, o)
if isinstance(attr, str):
if attr.lower() == 'true':
root_needed = True
setattr(self, o, True)
elif getattr(self, o).lower() == 'false':
elif attr.lower() == 'false':
setattr(self, o, False)
else:
message = 'Option %r needs to be "True" or "False", wrong value: ' \
......@@ -1102,7 +1103,10 @@ class Config(object):
if self.alter_network:
self.checkRequiredBinary(['brctl'])
if self.dry_run:
# Check if root is needed
if (self.alter_network or self.alter_user) and not self.dry_run:
root_needed = True
else:
root_needed = False
# check root
......
......@@ -57,6 +57,8 @@ import tempfile
from time import strftime
import StringIO
from lxml import etree
from time import sleep
from random import random
MANDATORY_PARAMETER_LIST = [
......@@ -114,6 +116,8 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
help="Promise timeout in seconds.")
parser.add_argument("configuration_file", nargs=1, type=argparse.FileType(),
help="SlapOS configuration file.")
parser.add_argument("--maximal_delay", help="The maximal delay value in seconds. " \
"A negative value leads start immediately.")
# Parses arguments
if argument_tuple == ():
......@@ -215,6 +219,13 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
else:
signature_certificate_list = None
maximal_delay = float(option_dict.get("maximal_delay", "300"))
if maximal_delay > 0:
duration = maximal_delay * random()
logging.info("Sleeping for %s seconds. To disable this feature, " \
"check maximal_delay parameter in manual." % duration)
time.sleep(duration)
# Returning new Slapgrid instance and options
return ([Slapgrid(software_root=option_dict['software_root'],
instance_root=option_dict['instance_root'],
......
......@@ -62,7 +62,6 @@ SYSTEM_ENVIRONMENT_REMOVE_LIST = [
'TMP',
'TMPDIR',
'USER',
'CONFIG_SITE',
]
LOCALE_ENVIRONMENT_REMOVE_LIST = [
......
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