def test_is_plugin_used(self): self._create_test_plugins() cluster = self._create_test_cluster() plugin = ClusterPlugin.get_connected_plugins(cluster).first() self.assertFalse(ClusterPlugin.is_plugin_used(plugin.id)) ClusterPlugin.set_attributes(cluster.id, plugin.id, enabled=True) self.assertTrue(ClusterPlugin.is_plugin_used(plugin.id))
def validate_delete(cls, data, instance): if ClusterPlugin.is_plugin_used(instance.id): raise errors.CannotDelete("Can't delete plugin which is enabled " "for some environment.")
def validate_delete(cls, data, instance): if ClusterPlugin.is_plugin_used(instance.id): raise errors.CannotDelete( "Can't delete plugin which is enabled " "for some environment." )