本文整理汇总了Python中nailgun.objects.ClusterPlugins.is_plugin_used方法的典型用法代码示例。如果您正苦于以下问题:Python ClusterPlugins.is_plugin_used方法的具体用法?Python ClusterPlugins.is_plugin_used怎么用?Python ClusterPlugins.is_plugin_used使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.objects.ClusterPlugins
的用法示例。
在下文中一共展示了ClusterPlugins.is_plugin_used方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_plugin_used
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import is_plugin_used [as 别名]
def test_is_plugin_used(self):
self._create_test_plugins()
cluster = self._create_test_cluster()
plugin = ClusterPlugins.get_connected_plugins(cluster).first()
self.assertFalse(ClusterPlugins.is_plugin_used(plugin.id))
ClusterPlugins.set_attributes(cluster.id, plugin.id, enabled=True)
self.assertTrue(ClusterPlugins.is_plugin_used(plugin.id))
示例2: validate_delete
# 需要导入模块: from nailgun.objects import ClusterPlugins [as 别名]
# 或者: from nailgun.objects.ClusterPlugins import is_plugin_used [as 别名]
def validate_delete(cls, data, instance):
if ClusterPlugins.is_plugin_used(instance.id):
raise errors.CannotDelete(
"Can't delete plugin which is enabled "
"for some environment."
)