本文整理汇总了Python中nailgun.network.manager.NetworkManager._update_attrs方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkManager._update_attrs方法的具体用法?Python NetworkManager._update_attrs怎么用?Python NetworkManager._update_attrs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.network.manager.NetworkManager
的用法示例。
在下文中一共展示了NetworkManager._update_attrs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PUT
# 需要导入模块: from nailgun.network.manager import NetworkManager [as 别名]
# 或者: from nailgun.network.manager.NetworkManager import _update_attrs [as 别名]
def PUT(self, node_id):
""":returns: Collection of JSONized Node objects.
:http: * 200 (nodes are successfully updated)
* 400 (invalid nodes data specified)
"""
interfaces_data = self.validator.validate_json(web.data())
node_data = {'id': node_id, 'interfaces': interfaces_data}
self.validator.validate(node_data)
NetworkManager._update_attrs(node_data)
node = self.get_object_or_404(Node, node_id)
return map(self.render, node.interfaces)
示例2: PUT
# 需要导入模块: from nailgun.network.manager import NetworkManager [as 别名]
# 或者: from nailgun.network.manager.NetworkManager import _update_attrs [as 别名]
def PUT(self):
data = self.validator.validate_collection_structure(web.data())
network_manager = NetworkManager()
updated_nodes_ids = []
for node_data in data:
self.validator.verify_data_correctness(node_data)
node_id = network_manager._update_attrs(node_data)
updated_nodes_ids.append(node_id)
updated_nodes = db().query(Node).filter(
Node.id.in_(updated_nodes_ids)
).all()
return map(self.render, updated_nodes)
示例3: PUT
# 需要导入模块: from nailgun.network.manager import NetworkManager [as 别名]
# 或者: from nailgun.network.manager.NetworkManager import _update_attrs [as 别名]
def PUT(self):
""":returns: Collection of JSONized Node objects.
:http: * 200 (nodes are successfully updated)
* 400 (invalid nodes data specified)
"""
data = self.validator.validate_collection_structure(web.data())
network_manager = NetworkManager()
updated_nodes_ids = []
for node_data in data:
self.validator.verify_data_correctness(node_data)
node_id = network_manager._update_attrs(node_data)
updated_nodes_ids.append(node_id)
updated_nodes = db().query(Node).filter(Node.id.in_(updated_nodes_ids)).all()
return map(self.render, updated_nodes)
示例4: PUT
# 需要导入模块: from nailgun.network.manager import NetworkManager [as 别名]
# 或者: from nailgun.network.manager.NetworkManager import _update_attrs [as 别名]
def PUT(self):
""":returns: Collection of JSONized Node objects.
:http: * 200 (nodes are successfully updated)
* 400 (invalid nodes data specified)
"""
data = self.checked_data(
self.validator.validate_collection_structure_and_data)
updated_nodes_ids = []
for node_data in data:
node_id = NetworkManager._update_attrs(node_data)
updated_nodes_ids.append(node_id)
updated_nodes = db().query(Node).filter(
Node.id.in_(updated_nodes_ids)
).all()
return [
{
"id": n.id,
"interfaces": map(self.render, n.interfaces)
} for n in updated_nodes
]