本文整理汇总了Python中nailgun.api.models.Task.message方法的典型用法代码示例。如果您正苦于以下问题:Python Task.message方法的具体用法?Python Task.message怎么用?Python Task.message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.api.models.Task
的用法示例。
在下文中一共展示了Task.message方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from nailgun.api.models import Task [as 别名]
# 或者: from nailgun.api.models.Task import message [as 别名]
def execute(self, nets, vlan_ids):
self.remove_previous_task()
task = Task(
name="check_networks",
cluster=self.cluster
)
if not task.cluster.nodes:
task.status = 'error'
task.message = ('There should be at least 1 node for dhcp check.'
'And 2 nodes for connectivity check')
db().add(task)
db().commit()
self._call_silently(
task,
tasks.CheckNetworksTask,
data=nets,
check_admin_untagged=True
)
db().refresh(task)
#disable neutron with vlan connectivity check after deployment
if task.status != 'error':
if (
task.cluster.status != 'new' and
task.cluster.net_provider == 'neutron'
):
task.status = 'error'
task.message = ('Network verification on Neutron'
' is not implemented yet')
db().commit()
if task.status != 'error':
# this one is connected with UI issues - we need to
# separate if error happened inside nailgun or somewhere
# in the orchestrator, and UI does it by task name.
dhcp_subtask = Task(
name='check_dhcp',
cluster=self.cluster,
parent_id=task.id)
db().add(dhcp_subtask)
db().commit()
db().refresh(task)
task.name = 'verify_networks'
self._call_silently(
task,
tasks.VerifyNetworksTask,
vlan_ids
)
return task
示例2: execute
# 需要导入模块: from nailgun.api.models import Task [as 别名]
# 或者: from nailgun.api.models.Task import message [as 别名]
def execute(self, nets, vlan_ids):
self.remove_previous_task()
task = Task(
name="check_networks",
cluster=self.cluster
)
if not task.cluster.nodes:
task.status = 'error'
task.message = ('There should be at least 1 node for dhcp check.'
'And 2 nodes for connectivity check')
db().add(task)
db().commit()
self._call_silently(
task,
tasks.CheckNetworksTask,
nets
)
db().refresh(task)
if task.status != 'error':
# this one is connected with UI issues - we need to
# separate if error happened inside nailgun or somewhere
# in the orchestrator, and UI does it by task name.
dhcp_subtask = Task(
name='check_dhcp',
cluster=self.cluster,
parent_id=task.id)
db().add(dhcp_subtask)
db().commit()
db().refresh(task)
task.name = 'verify_networks'
self._call_silently(
task,
tasks.VerifyNetworksTask,
vlan_ids
)
return task