本文整理汇总了Python中nailgun.plugins.manager.PluginManager.enable_plugins_by_components方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.enable_plugins_by_components方法的具体用法?Python PluginManager.enable_plugins_by_components怎么用?Python PluginManager.enable_plugins_by_components使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.plugins.manager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.enable_plugins_by_components方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import enable_plugins_by_components [as 别名]
def create(cls, data):
"""Create Cluster instance with specified parameters in DB.
This includes:
* creating Cluster attributes and generating default values \
(see :func:`create_attributes`)
* creating NetworkGroups for Cluster
* adding default pending changes (see :func:`add_pending_changes`)
* if "nodes" are specified in data then they are added to Cluster \
(see :func:`update_nodes`)
:param data: dictionary of key-value pairs as object fields
:returns: Cluster instance
"""
# TODO(enchantner): fix this temporary hack in clients
if "release_id" not in data:
release_id = data.pop("release", None)
data["release_id"] = release_id
# remove read-only attribute
data.pop("is_locked", None)
assign_nodes = data.pop("nodes", [])
enabled_editable_attributes = None
if 'components' in data:
enabled_core_attributes = cls.get_cluster_attributes_by_components(
data['components'], data["release_id"])
data = dict_merge(data, enabled_core_attributes['cluster'])
enabled_editable_attributes = enabled_core_attributes['editable']
data["fuel_version"] = settings.VERSION["release"]
cluster = super(Cluster, cls).create(data)
cls.create_default_group(cluster)
cls.create_attributes(cluster, enabled_editable_attributes)
cls.create_vmware_attributes(cluster)
cls.create_default_extensions(cluster)
try:
cls.get_network_manager(cluster).\
create_network_groups_and_config(cluster, data)
cls.add_pending_changes(
cluster, consts.CLUSTER_CHANGES.attributes)
cls.add_pending_changes(
cluster, consts.CLUSTER_CHANGES.networks)
cls.add_pending_changes(
cluster, consts.CLUSTER_CHANGES.vmware_attributes)
if assign_nodes:
cls.update_nodes(cluster, assign_nodes)
except (
errors.OutOfVLANs,
errors.OutOfIPs,
errors.NoSuitableCIDR
) as exc:
raise errors.CannotCreate(exc.message)
db().flush()
ClusterPlugins.add_compatible_plugins(cluster)
PluginManager.enable_plugins_by_components(cluster)
return cluster