本文整理汇总了Python中bkr.server.model.System.record_bulk_activity方法的典型用法代码示例。如果您正苦于以下问题:Python System.record_bulk_activity方法的具体用法?Python System.record_bulk_activity怎么用?Python System.record_bulk_activity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.System
的用法示例。
在下文中一共展示了System.record_bulk_activity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import record_bulk_activity [as 别名]
def remove(self, id, *args, **kw):
labcontroller = LabController.by_id(id)
labcontroller.removed = datetime.utcnow()
# de-associate systems
systems = System.query.filter(System.lab_controller == labcontroller)
System.record_bulk_activity(systems, user=identity.current.user,
service=u'WEBUI', action=u'Changed', field=u'lab_controller',
old=labcontroller.fqdn, new=None)
systems.update({'lab_controller_id': None}, synchronize_session=False)
# cancel running recipes
watchdogs = Watchdog.by_status(labcontroller=labcontroller,
status='active')
for w in watchdogs:
w.recipe.recipeset.job.cancel(msg='LabController %s has been deleted' % labcontroller.fqdn)
# remove distro trees
distro_tree_assocs = LabControllerDistroTree.query\
.filter(LabControllerDistroTree.lab_controller == labcontroller)\
.join(LabControllerDistroTree.distro_tree)
DistroTree.record_bulk_activity(distro_tree_assocs, user=identity.current.user,
service=u'WEBUI', action=u'Removed', field=u'lab_controller_assocs',
old=labcontroller.fqdn, new=None)
distro_tree_assocs.delete(synchronize_session=False)
labcontroller.disabled = True
labcontroller.record_activity(user=identity.current.user, service=u'WEBUI',
field=u'Disabled', action=u'Changed', old=unicode(False), new=unicode(True))
labcontroller.record_activity(user=identity.current.user, service=u'WEBUI',
field=u'Removed', action=u'Changed', old=unicode(False), new=unicode(True))
flash( _(u"%s removed") % labcontroller.fqdn )
raise redirect(".")