Commit ecf144ee authored by Rafael Monnerat's avatar Rafael Monnerat

runner: Fix symlinks on softwareLink

   The generation of the link and the verification were inconsistent, this commit
   normalize both.

   PS.: Software Links are deprecated, it should be removed in future, as it lost
   the goals
parent 6cba6d95
......@@ -352,10 +352,8 @@ def config_SR_folder(config):
cf.write(current_project + '#' + folder)
# First create the link for current project
with open(os.path.join(config['etc_dir'], ".project")) as f:
current_project = f.read().strip().rstrip('/')
profile = getCurrentSoftwareReleaseProfile(config)
name = current_project.split('/')[-1]
name = getSoftwareReleaseName(config)
md5sum = md5digest(profile)
link_to_folder(name, md5sum)
# check other links
......@@ -656,7 +654,9 @@ def getSoftwareReleaseName(config):
sr_profile = os.path.join(config['etc_dir'], ".project")
if os.path.exists(sr_profile):
with open(sr_profile, "r") as f:
project = f.read().split("/")
project = f.read().strip().rstrip().split("/")
# we always use the suffix workspace, so this is the intention
# behind this method, get the checkout.
software = project[-2]
return software.replace(' ', '_')
return None
......@@ -853,8 +853,8 @@ def isSoftwareReleaseCompleted(config):
software_name = getSoftwareReleaseName(config)
if software_name is None:
return False
elif os.path.exists(os.path.join(config['runner_workdir'],
'softwareLink', software_name, '.completed')):
elif os.path.exists(os.path.join(config['software_link'],
software_name, '.completed')):
return True
else:
return False
......
......@@ -208,7 +208,7 @@ class TestRunnerBackEnd(unittest.TestCase):
# First tests that if the current instance doesn't extend the Software
# Release to delete, the instance isn't deleted
runner_utils.open = mock.mock_open(read_data="/workspace/software/another/")
runner_utils.open = mock.mock_open(read_data="/workspace/my_project/software/another/")
runner_utils.removeSoftwareByName(config, '1234567890', 'my_software_name')
self.assertFalse(mock_removeCurrentInstance.called)
......@@ -218,7 +218,7 @@ class TestRunnerBackEnd(unittest.TestCase):
# be removed
mock_removeSoftwareRootDirectory.reset_mock()
runner_utils.open = mock.mock_open(read_data="/workspace/software/my_software_name/")
runner_utils.open = mock.mock_open(read_data="/workspace/my_project/software/my_software_name/")
runner_utils.removeSoftwareByName(config, '1234567890', 'my_software_name')
self.assertTrue(mock_removeCurrentInstance.called)
......
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