Exemple #1
0
    def delete(self, force=False):
        """Cascade delete of DB records related to env.

        It deletes all Task and Verify results related to this env as well.

        :param force: Use it if you don't want to perform status check
        """
        _status = self.status
        if not force and _status != STATUS.DESTROYED:
            raise exceptions.ManagerInvalidState(
                mgr="Env", expected=STATUS.DESTROYED, actual=_status)
        db.env_delete_cascade(self.uuid)
Exemple #2
0
    def delete(self, force=False):
        """Cascade delete of DB records related to env.

        It deletes all Task and Verify results related to this env as well.

        :param force: Use it if you don't want to perform status check
        """
        _status = self.status
        if not force and _status != STATUS.DESTROYED:
            raise exceptions.ManagerInvalidState(
                mgr="Env", expected=STATUS.DESTROYED, actual=_status)
        db.env_delete_cascade(self.uuid)
Exemple #3
0
    def test_env_delete_cascade(self):
        platforms = [{
            "status": "ANY",
            "plugin_name": "plugin_%s@plugin" % i,
            "plugin_spec": {},
            "platform_name": "plugin"
        } for i in range(3)]
        env = db.env_create("name", "status", "descr", {}, {}, {}, platforms)
        db.env_delete_cascade(env["uuid"])

        self.assertEqual(0, len(db.env_list()))
        self.assertEqual(0, len(db.platforms_list(env["uuid"])))
Exemple #4
0
    def test_env_delete_cascade(self):
        platforms = [
            {
                "status": "ANY",
                "plugin_name": "plugin_%s@plugin" % i,
                "plugin_spec": {},
                "platform_name": "plugin"
            }
            for i in range(3)
        ]
        env = db.env_create("name", "status", "descr", {}, {}, {}, platforms)
        db.env_delete_cascade(env["uuid"])

        self.assertEqual(0, len(db.env_list()))
        self.assertEqual(0, len(db.platforms_list(env["uuid"])))