Example #1
0
 def setUp(self):
     with session.begin():
         self.recipe = data_setup.create_recipe(task_name=u'/distribution/install')
         self.recipe.tasks.extend([
             RecipeTask.from_task(data_setup.create_task()),
             RecipeTask.from_fetch_url(u'http://example.com/tasks/example.tar.bz2'),
         ])
         data_setup.create_job_for_recipes([self.recipe])
         data_setup.mark_recipe_running(self.recipe)
Example #2
0
 def setUp(self):
     with session.begin():
         self.recipe = data_setup.create_recipe(
             task_name=u'/distribution/install')
         self.recipe.tasks.extend([
             RecipeTask.from_task(data_setup.create_task()),
             RecipeTask.from_fetch_url(
                 u'http://example.com/tasks/example.tar.bz2'),
         ])
         data_setup.create_job_for_recipes([self.recipe])
         data_setup.mark_recipe_running(self.recipe)
Example #3
0
    def test_recipe_view_shows_external_task_results(self):
        with session.begin():
            recipe = data_setup.create_recipe(task_name=u'/distribution/install')
            external_task = RecipeTask.from_fetch_url(
                url='git://example.com/externaltasks/example#master',
                subdir='examples')
            recipe.tasks.extend([external_task])
            data_setup.create_job_for_recipes([recipe], whiteboard='job with external tasks')
            data_setup.mark_recipe_complete(recipe, result=TaskResult.warn, task_status=TaskStatus.aborted)

        b = self.browser
        go_to_recipe_view(b, recipe=recipe, tab='Tasks')
        b.find_element_by_xpath('//div[@class="task-result-path"]/.[contains(text(), "%s")]' % external_task.fetch_url)
        b.find_element_by_xpath('//span[@class="task-name"]/.[contains(text(), "%s")]' % external_task.fetch_url)
Example #4
0
    def test_recipe_view_shows_external_task_results(self):
        with session.begin():
            recipe = data_setup.create_recipe(task_name=u'/distribution/install')
            external_task = RecipeTask.from_fetch_url(
                url='git://example.com/externaltasks/example#master',
                subdir='examples')
            recipe.tasks.extend([external_task])
            data_setup.create_job_for_recipes([recipe], whiteboard='job with external tasks')
            data_setup.mark_recipe_complete(recipe, result=TaskResult.warn, task_status=TaskStatus.aborted)

        b = self.browser
        go_to_recipe_view(b, recipe=recipe, tab='Tasks')
        b.find_element_by_xpath('//div[@class="task-result-path"]/.[contains(text(), "%s")]' % external_task.fetch_url)
        b.find_element_by_xpath('//span[@class="task-name"]/.[contains(text(), "%s")]' % external_task.fetch_url)
Example #5
0
        xmltasks = []
        invalid_tasks = []
        for xmltask in xmlrecipe.iter_tasks():
            if hasattr(xmltask, 'fetch'):
                # If fetch URL is given, the task doesn't need to exist.
                xmltasks.append(xmltask)
            elif Task.exists_by_name(xmltask.name, valid=True):
                xmltasks.append(xmltask)
            else:
                invalid_tasks.append(xmltask.name)
        if invalid_tasks and not ignore_missing_tasks:
            raise BX(_('Invalid task(s): %s') % ', '.join(invalid_tasks))
        for xmltask in xmltasks:
            if hasattr(xmltask, 'fetch'):
                recipetask = RecipeTask.from_fetch_url(
                    xmltask.fetch.url,
                    subdir=xmltask.fetch.subdir,
                    name=xmltask.name)
            else:
                recipetask = RecipeTask.from_task(Task.by_name(xmltask.name))
            recipetask.role = xmltask.role
            for xmlparam in xmltask.iter_params():
                param = RecipeTaskParam(name=xmlparam.name,
                                        value=xmlparam.value)
                recipetask.params.append(param)
            recipe.tasks.append(recipetask)
        if not recipe.tasks:
            raise BX(_('No Tasks! You can not have a recipe with no tasks!'))
        return recipe

    @expose('json')
    def update_recipe_set_response(self, recipe_set_id, response_id):
Example #6
0
            recipe.ks_appends.append(RecipeKSAppend(ks_append=xmlksappend))
        xmltasks = []
        invalid_tasks = []
        for xmltask in xmlrecipe.iter_tasks():
            if hasattr(xmltask, 'fetch'):
                # If fetch URL is given, the task doesn't need to exist.
                xmltasks.append(xmltask)
            elif Task.exists_by_name(xmltask.name, valid=True):
                xmltasks.append(xmltask)
            else:
                invalid_tasks.append(xmltask.name)
        if invalid_tasks and not ignore_missing_tasks:
            raise BX(_('Invalid task(s): %s') % ', '.join(invalid_tasks))
        for xmltask in xmltasks:
            if hasattr(xmltask, 'fetch'):
                recipetask = RecipeTask.from_fetch_url(xmltask.fetch.url,
                        subdir=xmltask.fetch.subdir, name=xmltask.name)
            else:
                recipetask = RecipeTask.from_task(Task.by_name(xmltask.name))
            recipetask.role = xmltask.role
            for xmlparam in xmltask.iter_params():
                param = RecipeTaskParam( name=xmlparam.name, 
                                        value=xmlparam.value)
                recipetask.params.append(param)
            recipe.tasks.append(recipetask)
        if not recipe.tasks:
            raise BX(_('No Tasks! You can not have a recipe with no tasks!'))
        return recipe

    @expose('json')
    def update_recipe_set_response(self,recipe_set_id,response_id):
        rs = RecipeSet.by_id(recipe_set_id)