Commit 7a0a1a85 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Romain Courteaud

slapgrid: Store instance data locally and in buildout

As Slapgrid is retrieving the full content of the instance it should
store it so that other recipe can access it directly instead of
querying master

slapgrid: Make json dump consistent when using slaptool

slapobject: dump ip addresses in instance json

slapgrid: update tests to check ip list on instance dump
parent c97eed64
......@@ -30,6 +30,7 @@
import datetime
import errno
import json
import os
import pkg_resources
import pwd
......@@ -56,6 +57,7 @@ from slapos.grid.svcbackend import getSupervisorRPC
from slapos.grid.exception import (BuildoutFailedError, WrongPermissionError,
PathDoesNotExistError, DiskSpaceError)
from slapos.grid.networkcache import download_network_cached, upload_network_cached
from slapos.grid.utils import md5digest
from slapos.human import bytes2human
from slapos.util import bytes2str, rmtree
......@@ -75,6 +77,8 @@ GROUP_PARTITION_TEMPLATE = bytes2str(
pkg_resources.resource_string(
__name__, 'templates/group_partition_supervisord.conf.in'))
SOFTWARE_INSTANCE_JSON_FILENAME = '.software-instance.json'
def free_space(path, fn):
while True:
......@@ -586,6 +590,20 @@ class Partition(object):
(self.instance_path, permission,
REQUIRED_COMPUTER_PARTITION_PERMISSION))
uid, gid = self.getUserGroupId()
# Store software instance json
instance_json_location = os.path.join(
self.instance_path,
SOFTWARE_INSTANCE_JSON_FILENAME
)
partiton_dict = self.computer_partition.copy()
partiton_dict.pop("slap_partition", None)
# XXX Check if we want them or not
partiton_dict.pop("access_status_message", None)
with open(instance_json_location, 'w') as f:
json.dump(partiton_dict, f, indent=2)
os.chown(instance_json_location, uid, gid)
# Check that Software Release directory is present
if not os.path.exists(self.software_path):
# XXX What should it raise?
......@@ -603,6 +621,7 @@ class Partition(object):
# XXX What should it raise?
raise IOError('Software Release %s is not correctly installed.\nMissing file: %s' % (
self.software_release_url, template_location))
config_location = os.path.join(self.instance_path, 'buildout.cfg')
self.logger.debug("Copying %r to %r" % (template_location, config_location))
shutil.copy(template_location, config_location)
......@@ -622,6 +641,19 @@ class Partition(object):
'storage_home': self.instance_storage_home,
'global_ipv4_network_prefix': self.ipv4_global_network,
'shared_part_list': ' '.join(self.shared_part_list.strip().splitlines(True))
'parameters_md5sum': md5digest(
json.dumps(
self.computer_partition.get("parameters", {}), sort_keys=True
)
),
'connection_parameters_md5sum': md5digest(
json.dumps(
self.computer_partition.get("connection_parameters", {}), sort_keys=True
)
),
'instance_state': self.computer_partition.get("state"),
'instance_software_type': self.computer_partition.get("software_type"),
'instance_processing_timestamp': self.computer_partition.get("processing_timestamp"),
}
with open(config_location, 'w') as f:
f.write(buildout_text)
......@@ -637,7 +669,6 @@ class Partition(object):
if q.startswith('bootstrap')]
else:
bootstrap_candidate_list = []
uid, gid = self.getUserGroupId()
os.chown(config_location, -1, int(gid))
if len(bootstrap_candidate_list) == 0:
buildout_binary = os.path.join(self.software_path, 'bin', 'buildout')
......
......@@ -600,21 +600,27 @@ stderr_logfile_backups=1
software_release_uri = None
parameter_dict = partition.getInstanceParameterDict()
self.computer_partition_list.append({
instance_dict = {
"reference": getattr(partition, '_instance_guid', None),
"portal_type": "Software Instance",
"compute_node_id": getattr(partition, '_computer_id', None),
"compute_partition_id": partition.getId(),
"state": partition.getState(),
"software_type": parameter_dict.get('slap_software_type', None),
"parameters": parameter_dict,
"processing_timestamp": parameter_dict.get("timestamp"),
"shared": False,
"software_type": parameter_dict.pop('slap_software_type', None),
"processing_timestamp": parameter_dict.pop("timestamp", None),
"slap_partition": partition,
"ip_list": parameter_dict.get("ip_list", []),
"full_ip_list": parameter_dict.get("full_ip_list", []),
"ip_list": parameter_dict.pop("ip_list", []),
"full_ip_list": parameter_dict.pop("full_ip_list", []),
"access_status_message": partition.getAccessStatus(),
"software_release_uri": software_release_uri,
"sla_parameters": getattr(partition, '_filter_dict', {}),
})
"connection_parameters": partition.getConnectionParameterDict(),
"root_instance_title": parameter_dict.pop("root_instance_title", None),
"title": parameter_dict.pop("instance_title", None),
}
instance_dict["parameters"] = parameter_dict
self.computer_partition_list.append(instance_dict)
return self.computer_partition_list
def sendPartitionError(self, partition, error_message, logger=None):
......
......@@ -32,3 +32,11 @@ storage-home = %(storage_home)s
[network-information]
global-ipv4-network = %(global_ipv4_network_prefix)s
# This is end of zc.buildout profile's tail added by slapgrid
[software-instance-data]
state = %(instance_state)s
software-type = %(instance_software_type)s
reference = %(software_instance_reference)s
processing-timestamp = %(instance_processing_timestamp)s
connection-parameters-md5sum = %(connection_parameters_md5sum)s
parameters-md5sum = %(parameters_md5sum)s
\ No newline at end of file
......@@ -263,6 +263,16 @@ class BasicMixin(object):
instance_list.append('sv.sock')
six.assertCountEqual(self, os.listdir(self.instance_root), instance_list)
def assertSoftwareInstanceJSONIsCorrect(self, partition_path, instance):
json_path = os.path.join(partition_path, '.software-instance.json')
self.assertTrue(os.path.exists(json_path))
with open(json_path, "r") as f:
json_data = json.load(f)
self.maxDiff = 1000
# XXx CLN Hackish
instance.pop("access_status_message", None)
self.assertEqual(json_data, instance)
def tearDown(self):
# XXX: Hardcoded pid, as it is not configurable in slapos
svc = os.path.join(self.instance_root, 'var', 'run', 'supervisord.pid')
......@@ -678,9 +688,9 @@ class InstanceForTest(object):
self.partition_path = os.path.join(self.instance_root, self.name)
os.mkdir(self.partition_path, 0o750)
self.timestamp = None
self.ip_list = [('interface0', '10.0.8.2')]
self.full_ip_list = [('route_interface0', '10.10.2.3', '10.10.0.1',
'255.0.0.0', '10.0.0.0')]
self.ip_list = [['interface0', '10.0.8.2']]
self.full_ip_list = [['route_interface0', '10.10.2.3', '10.10.0.1',
'255.0.0.0', '10.0.0.0']]
self.certificate = str(random.random())
self.key = str(random.random())
self.filter_dict = {}
......@@ -704,6 +714,28 @@ class InstanceForTest(object):
self.current_partition = partition
return partition
def asJSONText(self):
return {
"title": self.name,
"reference": self.name,
"software_release_uri": self.software.name,
"software_type": None,
"state": self.requested_state,
"connection_parameters": {
},
"parameters": {},
"shared": False,
"root_instance_title": self.name,
"ip_list": self.ip_list,
"full_ip_list": self.full_ip_list,
"sla_parameters": self.filter_dict,
"compute_node_id": None,
"compute_partition_id": self.name,
"processing_timestamp": self.timestamp,
"access_status_message": self.error_log,
"portal_type": "Software Instance"
}
def getSoftwareRelease(self):
"""
Return software release for Instance
......@@ -857,7 +889,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition), ['.slapgrid', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/api/allDocs/', '/api/get/', '/api/get/', '/api/put/'])
......@@ -876,7 +910,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition), ['.slapgrid', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/api/allDocs/', '/api/get/', '/api/get/', '/api/put/'])
......@@ -909,7 +945,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(partition.partition_path, partition.asJSONText())
wrapper_log = os.path.join(partition.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [partition.software.software_hash])
......@@ -928,7 +966,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(partition.partition_path, partition.asJSONText())
wrapper_log = os.path.join(partition.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [partition.software.software_hash])
......@@ -946,7 +986,9 @@ exit 1
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay', '.slapgrid-0-error.log'])
'.slapos-retention-lock-delay', '.slapgrid-0-error.log',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
self.assertEqual(computer.sequence,
['/api/allDocs/', '/api/get/', '/api/get/', '/api/put/', '/getHateoasUrl',
'/api/allDocs/', '/api/get/', '/api/get/', '/api/put/'])
......@@ -984,7 +1026,9 @@ chmod 755 etc/run/wrapper
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
......@@ -999,7 +1043,9 @@ chmod 755 etc/run/wrapper
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
self.assertLogContent(wrapper_log, 'Signal handler called with signal 15')
self.assertEqual(computer.sequence,
['/getHateoasUrl',
......@@ -1042,7 +1088,9 @@ chmod 755 etc/run/wrapper
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root),
......@@ -1065,7 +1113,9 @@ exit 1
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay', '.slapgrid-0-error.log'])
'.slapos-retention-lock-delay', '.slapgrid-0-error.log',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
self.assertLogContent(wrapper_log, 'Signal handler called with signal 15')
self.assertEqual(computer.sequence,
['/getHateoasUrl',
......@@ -1088,7 +1138,9 @@ exit 1
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', 'buildout.cfg', 'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root),
[instance.software.software_hash])
self.assertEqual(computer.sequence,
......@@ -1106,7 +1158,9 @@ exit 1
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.0_wrapper.log', 'etc',
'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root),
[instance.software.software_hash])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
......@@ -1316,7 +1370,8 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_daemon.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
daemon_log = os.path.join(partition.partition_path, '.0_daemon.log')
self.assertLogContent(daemon_log, 'Failing')
self.assertIsCreated(self.watchdog_banged)
......@@ -1364,7 +1419,7 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_daemon.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'launched', 'crashed'])
'launched', 'crashed', '.software-instance.json'])
daemon_log = os.path.join(partition.partition_path, '.0_daemon.log')
self.assertLogContent(daemon_log, 'Failing')
self.assertIsNotCreated(self.watchdog_banged)
......@@ -1656,7 +1711,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
timestamp_path = os.path.join(instance.partition_path, '.timestamp')
self.setSlapgrid()
......@@ -1678,7 +1734,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(self.launchSlapgrid(develop=True),
......@@ -1701,7 +1758,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
instance.timestamp = str(int(timestamp) - 1)
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
......@@ -1719,7 +1777,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
instance.timestamp = str(int(timestamp) + 1)
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
......@@ -1740,7 +1799,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root),
[instance.software.software_hash])
instance.timestamp = None
......@@ -1768,7 +1828,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
time.sleep(2)
# dummify install() so that it doesn't actually do anything so that it
......@@ -1778,7 +1839,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.launchSlapgrid()
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
def test_one_partition_periodicity_from_file_does_not_disturb_others(self):
"""
......@@ -2136,7 +2198,8 @@ echo %s; echo %s; exit 42""" % (line1, line2))
six.assertCountEqual(self,
os.listdir(instance.partition_path),
['etc', '.slapgrid', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay']
['etc', '.slapgrid', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json']
)
self.assertFalse(os.path.exists(promise_ran))
self.assertEqual(len(instance.sequence), 1)
......@@ -2205,7 +2268,8 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
......@@ -2292,7 +2356,8 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
......@@ -2312,14 +2377,16 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay'])
'.slapos-retention-lock-delay',
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay'])
'.slapos-retention-lock-delay',
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
self.assertEqual(computer.sequence,
......@@ -2803,7 +2870,7 @@ exit 1
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', 'buildout.cfg', 'software_release',
'.slapgrid-0-error.log'])
'.slapgrid-0-error.log', '.software-instance.json'])
promise_file = os.path.join(instance.partition_path, 'promise_ran')
promise = textwrap.dedent("""\
......@@ -2829,7 +2896,7 @@ exit 1
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', 'buildout.cfg', 'software_release',
'.slapgrid-0-error.log'])
'.slapgrid-0-error.log', '.software-instance.json'])
promise_file = os.path.join(instance.partition_path, 'promise_ran')
promise = textwrap.dedent("""\
......@@ -3318,7 +3385,8 @@ exit 0
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertEqual(computer.sequence,
['/api/allDocs/',
'/api/get/',
......@@ -3337,7 +3405,8 @@ exit 0
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list'])
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root),
[partition.software.software_hash])
......@@ -3381,7 +3450,7 @@ exit 0
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay',
'.slapos-retention-lock-date'])
'.slapos-retention-lock-date', '.software-instance.json'])
self.assertTrue(os.path.exists(pre_delete_script))
self.assertTrue(os.path.exists(os.path.join(
partition.partition_path,
......@@ -3397,7 +3466,7 @@ exit 0
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay', '.slapos-retention-lock-date',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
])
'.software-instance.json'])
# wait until the pre-delete script is finished
self._wait_prerm_script_finished(partition.partition_path)
......@@ -3429,7 +3498,8 @@ exit 0
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list'])
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
'.software-instance.json'])
# wait until the pre-delete script is finished
self._wait_prerm_script_finished(partition.partition_path)
......@@ -3466,7 +3536,8 @@ exit 0
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list'])
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
'.software-instance.json'])
stat_info = os.stat(partition.partition_path)
uid = stat_info.st_uid
......
......@@ -260,6 +260,16 @@ class BasicMixin(object):
instance_list.append('sv.sock')
six.assertCountEqual(self, os.listdir(self.instance_root), instance_list)
def assertSoftwareInstanceJSONIsCorrect(self, partition_path, instance):
json_path = os.path.join(partition_path, '.software-instance.json')
self.assertTrue(os.path.exists(json_path))
with open(json_path, "r") as f:
json_data = json.load(f)
self.maxDiff = 1000
# XXx CLN Hackish
instance.pop("access_status_message", None)
self.assertEqual(json_data, instance)
def tearDown(self):
# XXX: Hardcoded pid, as it is not configurable in slapos
svc = os.path.join(self.instance_root, 'var', 'run', 'supervisord.pid')
......@@ -554,9 +564,10 @@ class InstanceForTest(object):
self.partition_path = os.path.join(self.instance_root, self.name)
os.mkdir(self.partition_path, 0o750)
self.timestamp = None
self.ip_list = [('interface0', '10.0.8.2')]
self.full_ip_list = [('route_interface0', '10.10.2.3', '10.10.0.1',
'255.0.0.0', '10.0.0.0')]
self.ip_list = [['interface0', '10.0.8.2']]
self.full_ip_list = [['route_interface0', '10.10.2.3', '10.10.0.1',
'255.0.0.0', '10.0.0.0']]
self.filter_dict = {}
def getInstance(self, computer_id, ):
"""
......@@ -577,6 +588,28 @@ class InstanceForTest(object):
self.current_partition = partition
return partition
def asJSONText(self):
return {
"reference": None,
"software_release_uri": self.software.name,
"software_type": None,
"state": self.requested_state,
"connection_parameters": {
},
"parameters": {},
"shared": False,
"root_instance_title": None,
"title": None,
"ip_list": self.ip_list,
"full_ip_list": self.full_ip_list,
"sla_parameters": self.filter_dict,
"compute_node_id": 'computer',
"compute_partition_id": self.name,
"processing_timestamp": self.timestamp,
"access_status_message": self.error_log,
"portal_type": "Software Instance"
}
def getSoftwareRelease(self):
"""
Return software release for Instance
......@@ -732,7 +765,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition), ['.slapgrid', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation',
......@@ -753,7 +788,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition), ['.slapgrid', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(computer.sequence,
['/getFullComputerInformation',
......@@ -786,7 +823,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(partition.partition_path, partition.asJSONText())
wrapper_log = os.path.join(partition.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [partition.software.software_hash])
......@@ -806,7 +845,9 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(partition.partition_path, partition.asJSONText())
wrapper_log = os.path.join(partition.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [partition.software.software_hash])
......@@ -825,7 +866,9 @@ exit 1
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay', '.slapgrid-0-error.log'])
'.slapos-retention-lock-delay', '.slapgrid-0-error.log',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(partition.partition_path, partition.asJSONText())
self.assertEqual(computer.sequence,
['/getFullComputerInformation',
'/getComputerPartitionCertificate',
......@@ -867,7 +910,9 @@ chmod 755 etc/run/wrapper
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
......@@ -883,7 +928,9 @@ chmod 755 etc/run/wrapper
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
self.assertLogContent(wrapper_log, 'Signal handler called with signal 15')
self.assertEqual(computer.sequence,
['/getHateoasUrl',
......@@ -928,7 +975,9 @@ chmod 755 etc/run/wrapper
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root),
......@@ -949,7 +998,9 @@ exit 1
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay', '.slapgrid-0-error.log'])
'.slapos-retention-lock-delay', '.slapgrid-0-error.log',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
self.assertLogContent(wrapper_log, 'Signal handler called with signal 15')
self.assertEqual(computer.sequence,
['/getHateoasUrl',
......@@ -970,7 +1021,9 @@ exit 1
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', 'buildout.cfg', 'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root),
[instance.software.software_hash])
self.assertEqual(computer.sequence,
......@@ -986,7 +1039,9 @@ exit 1
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.0_wrapper.log', 'etc',
'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertSoftwareInstanceJSONIsCorrect(instance.partition_path, instance.asJSONText())
six.assertCountEqual(self, os.listdir(self.software_root),
[instance.software.software_hash])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
......@@ -1065,7 +1120,8 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_daemon.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
daemon_log = os.path.join(partition.partition_path, '.0_daemon.log')
self.assertLogContent(daemon_log, 'Failing')
self.assertIsCreated(self.watchdog_banged)
......@@ -1113,7 +1169,7 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_daemon.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'launched', 'crashed'])
'launched', 'crashed', '.software-instance.json'])
daemon_log = os.path.join(partition.partition_path, '.0_daemon.log')
self.assertLogContent(daemon_log, 'Failing')
self.assertIsNotCreated(self.watchdog_banged)
......@@ -1405,7 +1461,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
timestamp_path = os.path.join(instance.partition_path, '.timestamp')
self.setSlapgrid()
......@@ -1427,7 +1484,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
self.assertEqual(self.launchSlapgrid(develop=True),
......@@ -1449,7 +1507,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
instance.timestamp = str(int(timestamp) - 1)
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
......@@ -1467,7 +1526,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
instance.timestamp = str(int(timestamp) + 1)
self.assertEqual(self.launchSlapgrid(), slapgrid.SLAPGRID_SUCCESS)
......@@ -1498,7 +1558,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay'])
['.slapgrid', '.timestamp', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root),
[instance.software.software_hash])
instance.timestamp = None
......@@ -1533,7 +1594,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
partition = os.path.join(self.instance_root, '0')
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
time.sleep(2)
# dummify install() so that it doesn't actually do anything so that it
......@@ -1543,7 +1605,8 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self.launchSlapgrid()
six.assertCountEqual(self, os.listdir(partition),
['.slapgrid', '.timestamp', 'buildout.cfg',
'software_release', 'worked', '.slapos-retention-lock-delay'])
'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
def test_one_partition_periodicity_from_file_does_not_disturb_others(self):
"""
......@@ -1882,7 +1945,8 @@ echo %s; echo %s; exit 42""" % (line1, line2))
six.assertCountEqual(self,
os.listdir(instance.partition_path),
['etc', '.slapgrid', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay']
['etc', '.slapgrid', 'buildout.cfg', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json']
)
self.assertFalse(os.path.exists(promise_ran))
self.assertFalse(instance.sequence)
......@@ -1906,7 +1970,8 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
......@@ -1982,7 +2047,8 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
six.assertCountEqual(self, os.listdir(self.software_root), [instance.software.software_hash])
......@@ -2003,14 +2069,16 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay', request_list_file])
'.slapos-retention-lock-delay', request_list_file,
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked',
'.slapos-retention-lock-delay', request_list_file])
'.slapos-retention-lock-delay', request_list_file,
'.software-instance.json'])
wrapper_log = os.path.join(instance.partition_path, '.0_wrapper.log')
self.assertLogContent(wrapper_log, 'Working')
self.assertEqual(computer.sequence,
......@@ -2346,7 +2414,7 @@ exit 1
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', 'buildout.cfg', 'software_release',
'.slapgrid-0-error.log'])
'.slapgrid-0-error.log', '.software-instance.json'])
promise_file = os.path.join(instance.partition_path, 'promise_ran')
promise = textwrap.dedent("""\
......@@ -2372,7 +2440,7 @@ exit 1
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(instance.partition_path),
['.slapgrid', 'buildout.cfg', 'software_release',
'.slapgrid-0-error.log'])
'.slapgrid-0-error.log', '.software-instance.json'])
promise_file = os.path.join(instance.partition_path, 'promise_ran')
promise = textwrap.dedent("""\
......@@ -2860,7 +2928,8 @@ exit 0
self.assertInstanceDirectoryListEqual(['0'])
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay'])
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.software-instance.json'])
self.assertEqual(computer.sequence,
['/getFullComputerInformation',
'/getComputerPartitionCertificate',
......@@ -2878,7 +2947,7 @@ exit 0
['.slapgrid', '.0_wrapper.log', 'buildout.cfg',
'etc', 'software_release', 'worked', '.slapos-retention-lock-delay',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
'.slapos-request-transaction-0'])
'.slapos-request-transaction-0', '.software-instance.json'])
six.assertCountEqual(self, os.listdir(self.software_root),
[partition.software.software_hash])
......@@ -2922,7 +2991,8 @@ exit 0
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay',
'.slapos-retention-lock-date', '.slapos-request-transaction-0'])
'.slapos-retention-lock-date', '.slapos-request-transaction-0',
'.software-instance.json'])
self.assertTrue(os.path.exists(pre_delete_script))
self.assertTrue(os.path.exists(os.path.join(
partition.partition_path,
......@@ -2938,7 +3008,7 @@ exit 0
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay', '.slapos-retention-lock-date',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
'.slapos-request-transaction-0'])
'.slapos-request-transaction-0', '.software-instance.json'])
# wait until the pre-delete script is finished
self._wait_prerm_script_finished(partition.partition_path)
......@@ -2971,7 +3041,8 @@ exit 0
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay', '.slapos-request-transaction-0',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list'])
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
'.software-instance.json'])
# wait until the pre-delete script is finished
self._wait_prerm_script_finished(partition.partition_path)
......@@ -3008,7 +3079,8 @@ exit 0
six.assertCountEqual(self, os.listdir(partition.partition_path),
['.slapgrid', 'buildout.cfg', 'etc', 'software_release',
'worked', '.slapos-retention-lock-delay', '.slapos-request-transaction-0',
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list'])
'.0-prerm_slapos_pre_delete.log', '.slapos-report-wait-service-list',
'.software-instance.json'])
stat_info = os.stat(partition.partition_path)
uid = stat_info.st_uid
......
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