本文整理汇总了Python中nailgun.db.sqlalchemy.models.Task.result[0]['absent_vlans']方法的典型用法代码示例。如果您正苦于以下问题:Python Task.result[0]['absent_vlans']方法的具体用法?Python Task.result[0]['absent_vlans']怎么用?Python Task.result[0]['absent_vlans']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.db.sqlalchemy.models.Task
的用法示例。
在下文中一共展示了Task.result[0]['absent_vlans']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_verify_networks_with_dhcp_subtask_erred
# 需要导入模块: from nailgun.db.sqlalchemy.models import Task [as 别名]
# 或者: from nailgun.db.sqlalchemy.models.Task import result[0]['absent_vlans'] [as 别名]
def test_verify_networks_with_dhcp_subtask_erred(self):
self.env.create(
cluster_kwargs={},
nodes_kwargs=[
{"api": False},
{"api": False}
]
)
cluster_db = self.env.clusters[0]
node1, node2 = self.env.nodes
nets_sent = [{'iface': 'eth0', 'vlans': range(100, 105)}]
task = Task(
name="verify_networks",
cluster_id=cluster_db.id
)
task.cache = {
"args": {
'nodes': self.nodes_message((node1, node2), nets_sent),
'offline': 0,
}
}
self.db.add(task)
self.db.commit()
dhcp_subtask = Task(
name='check_dhcp',
cluster_id=cluster_db.id,
parent_id=task.id,
status='error',
message='DHCP ERROR'
)
self.db.add(dhcp_subtask)
self.db.commit()
kwargs = {'task_uuid': task.uuid,
'status': 'ready',
'nodes': self.nodes_message((node1, node2), [])}
kwargs['nodes'][0]['networks'] = nets_sent
self.receiver.verify_networks_resp(**kwargs)
self.assertEqual(task.status, "error")
self.assertEqual(task.message, u'DHCP ERROR')
task.result[0]['absent_vlans'] = sorted(task.result[0]['absent_vlans'])
self.assertEqual(task.result, [{
u'absent_vlans': [100, 101, 102, 103, 104],
u'interface': 'eth0',
u'mac': node2.interfaces[0].mac,
u'name': 'Untitled ({0})'.format(node2.mac[-5:].lower()),
u'uid': node2.id}])
示例2: test_verify_networks_resp_incomplete_network_data_on_first_node
# 需要导入模块: from nailgun.db.sqlalchemy.models import Task [as 别名]
# 或者: from nailgun.db.sqlalchemy.models.Task import result[0]['absent_vlans'] [as 别名]
def test_verify_networks_resp_incomplete_network_data_on_first_node(self):
"""Test verifies that when network data is incomplete on first node
task would not fail and be erred as expected
"""
self.env.create(
cluster_kwargs={},
nodes_kwargs=[
{"api": False, 'name': 'node1'},
{"api": False, 'name': 'node2'},
]
)
cluster_db = self.env.clusters[0]
node1, node2 = self.env.nodes
nets_sent = [{'iface': 'eth0', 'vlans': range(100, 105)}]
task = Task(
name="super",
cluster_id=cluster_db.id
)
task.cache = {
"args": {
'nodes': self.nodes_message((node1, node2), nets_sent),
'offline': 0,
}
}
self.db.add(task)
self.db.commit()
kwargs = {'task_uuid': task.uuid,
'status': 'ready',
'nodes': self.nodes_message((node1, node2), [])}
kwargs['nodes'][1]['networks'] = nets_sent
self.receiver.verify_networks_resp(**kwargs)
self.db.flush()
self.db.refresh(task)
self.assertEqual(task.status, "error")
self.assertEqual(task.message, '')
error_nodes = [{'uid': node1.id,
'interface': 'eth0',
'name': node1.name,
'mac': node1.interfaces[0].mac,
'absent_vlans': sorted(nets_sent[0]['vlans'])}]
task.result[0]['absent_vlans'] = sorted(task.result[0]['absent_vlans'])
self.assertEqual(task.result, error_nodes)