def test_broken_power_aborts_recipe(self):
        # Start a recipe, let it be provisioned, mark the power command as failed,
        # and the recipe should be aborted.
        with session.begin():
            system = data_setup.create_system(
                fqdn=u"broken.dreams.example.org",
                lab_controller=self.lab_controller,
                status=SystemStatus.automated,
                shared=True,
            )
            distro_tree = data_setup.create_distro_tree(osmajor=u"Fedora20")
            job = data_setup.create_job(distro_tree=distro_tree)
            job.recipesets[0].recipes[0]._host_requires = (
                u"""
                <hostRequires>
                    <hostname op="=" value="%s" />
                </hostRequires>
                """
                % system.fqdn
            )

        beakerd.process_new_recipes()
        beakerd.update_dirty_jobs()
        beakerd.queue_processed_recipesets()
        beakerd.update_dirty_jobs()
        beakerd.schedule_queued_recipes()
        beakerd.update_dirty_jobs()
        beakerd.provision_scheduled_recipesets()
        beakerd.update_dirty_jobs()

        with session.begin():
            job = Job.query.get(job.id)
            self.assertEqual(job.status, TaskStatus.waiting)
            system = System.query.get(system.id)
            command = system.command_queue[0]
            self.assertEquals(command.action, "on")

        self.server.labcontrollers.mark_command_running(command.id)
        self.server.labcontrollers.mark_command_failed(command.id, u"needs moar powa")
        with session.begin():
            job = Job.query.get(job.id)
            job.update_status()
            self.assertEqual(job.recipesets[0].recipes[0].status, TaskStatus.aborted)
Beispiel #2
0
    def test_broken_power_aborts_recipe(self):
        # Start a recipe, let it be provisioned, mark the power command as failed,
        # and the recipe should be aborted.
        with session.begin():
            system = data_setup.create_system(
                fqdn=u'broken.dreams.example.org',
                lab_controller=self.lab_controller,
                status=SystemStatus.automated,
                shared=True)
            distro_tree = data_setup.create_distro_tree(osmajor=u'Fedora20')
            job = data_setup.create_job(distro_tree=distro_tree)
            job.recipesets[0].recipes[0]._host_requires = (u"""
                <hostRequires>
                    <hostname op="=" value="%s" />
                </hostRequires>
                """ % system.fqdn)

        beakerd.process_new_recipes()
        beakerd.update_dirty_jobs()
        beakerd.queue_processed_recipesets()
        beakerd.update_dirty_jobs()
        beakerd.schedule_queued_recipes()
        beakerd.update_dirty_jobs()
        beakerd.provision_scheduled_recipesets()
        beakerd.update_dirty_jobs()

        with session.begin():
            job = Job.query.get(job.id)
            self.assertEqual(job.status, TaskStatus.waiting)
            system = System.query.get(system.id)
            command = system.command_queue[0]
            self.assertEquals(command.action, 'on')

        self.server.labcontrollers.mark_command_running(command.id)
        self.server.labcontrollers.mark_command_failed(command.id,
                                                       u'needs moar powa')
        with session.begin():
            job = Job.query.get(job.id)
            job.update_status()
            self.assertEqual(job.recipesets[0].recipes[0].status,
                             TaskStatus.aborted)
Beispiel #3
0
    def test_failure_in_configure_netboot_aborts_recipe(self):
        with session.begin():
            system = data_setup.create_system(
                lab_controller=self.lab_controller,
                status=SystemStatus.automated,
                shared=True)
            distro_tree = data_setup.create_distro_tree(osmajor=u'Fedora20')
            job = data_setup.create_job(distro_tree=distro_tree)
            job.recipesets[0].recipes[0]._host_requires = (u"""
                <hostRequires>
                    <hostname op="=" value="%s" />
                </hostRequires>
                """ % system.fqdn)

        beakerd.process_new_recipes()
        beakerd.update_dirty_jobs()
        beakerd.queue_processed_recipesets()
        beakerd.update_dirty_jobs()
        beakerd.schedule_queued_recipes()
        beakerd.update_dirty_jobs()
        beakerd.provision_scheduled_recipesets()
        beakerd.update_dirty_jobs()

        with session.begin():
            job = Job.query.get(job.id)
            self.assertEqual(job.status, TaskStatus.waiting)
            system = System.query.get(system.id)
            command = system.command_queue[2]
            self.assertEquals(command.action, 'configure_netboot')

        self.server.labcontrollers.mark_command_running(command.id)
        self.server.labcontrollers.mark_command_failed(command.id,
                                                       u'oops it borked')
        with session.begin():
            job = Job.query.get(job.id)
            job.update_status()
            self.assertEqual(job.recipesets[0].recipes[0].status,
                             TaskStatus.aborted)
    def test_failure_in_configure_netboot_aborts_recipe(self):
        with session.begin():
            system = data_setup.create_system(
                lab_controller=self.lab_controller, status=SystemStatus.automated, shared=True
            )
            distro_tree = data_setup.create_distro_tree(osmajor=u"Fedora20")
            job = data_setup.create_job(distro_tree=distro_tree)
            job.recipesets[0].recipes[0]._host_requires = (
                u"""
                <hostRequires>
                    <hostname op="=" value="%s" />
                </hostRequires>
                """
                % system.fqdn
            )

        beakerd.process_new_recipes()
        beakerd.update_dirty_jobs()
        beakerd.queue_processed_recipesets()
        beakerd.update_dirty_jobs()
        beakerd.schedule_queued_recipes()
        beakerd.update_dirty_jobs()
        beakerd.provision_scheduled_recipesets()
        beakerd.update_dirty_jobs()

        with session.begin():
            job = Job.query.get(job.id)
            self.assertEqual(job.status, TaskStatus.waiting)
            system = System.query.get(system.id)
            command = system.command_queue[2]
            self.assertEquals(command.action, "configure_netboot")

        self.server.labcontrollers.mark_command_running(command.id)
        self.server.labcontrollers.mark_command_failed(command.id, u"oops it borked")
        with session.begin():
            job = Job.query.get(job.id)
            job.update_status()
            self.assertEqual(job.recipesets[0].recipes[0].status, TaskStatus.aborted)