def ensure_task_based_deploy_allowed(cls, task): """Raises error if task does not support cross-dependencies. :param task: the task instance :raises: errors.TaskBaseDeploymentNotAllowed """ if task.get('type') in cls.unversioned_task_types: return version = StrictVersion(task.get('version', '0.0.0')) if version < cls.min_supported_task_version: message = ("Task '{0}' does not support cross-dependencies.\n" "You can enable option 'propagate_task_deploy'" "for cluster to use task adaptation mechanism.".format( task['id'])) logger.warning(message) if settings.LCM_CHECK_TASK_VERSION: raise errors.TaskBaseDeploymentNotAllowed(message)
def test_400_if_task_based_not_allowed(self, check_task_mock): check_task_mock.side_effect = errors.TaskBaseDeploymentNotAllowed() resp = self.get_serialized_tasks(self.cluster.id) self.assertEqual(resp.status_code, 400) self.assertIn("The task-based deployment is not allowed", resp.body)