本文整理汇总了Python中bkr.server.model.LabController.fqdn方法的典型用法代码示例。如果您正苦于以下问题:Python LabController.fqdn方法的具体用法?Python LabController.fqdn怎么用?Python LabController.fqdn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.LabController
的用法示例。
在下文中一共展示了LabController.fqdn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from bkr.server.model import LabController [as 别名]
# 或者: from bkr.server.model.LabController import fqdn [as 别名]
def save(self, **kw):
if kw.get('id'):
labcontroller = LabController.by_id(kw['id'])
else:
labcontroller = LabController()
session.add(labcontroller)
if labcontroller.fqdn != kw['fqdn']:
activity = LabControllerActivity(identity.current.user,
'WEBUI', 'Changed', 'FQDN', labcontroller.fqdn, kw['fqdn'])
labcontroller.fqdn = kw['fqdn']
labcontroller.write_activity.append(activity)
# labcontroller.user is used by the lab controller to login here
try:
# pick up an existing user if it exists.
luser = User.query.filter_by(user_name=kw['lusername']).one()
except InvalidRequestError:
# Nope, create from scratch
luser = User()
if labcontroller.user != luser:
if labcontroller.user is None:
old_user_name = None
else:
old_user_name = labcontroller.user.user_name
activity = LabControllerActivity(identity.current.user, 'WEBUI',
'Changed', 'User', old_user_name, unicode(kw['lusername']))
labcontroller.user = luser
labcontroller.write_activity.append(activity)
# Make sure user is a member of lab_controller group
group = Group.by_name(u'lab_controller')
if group not in luser.groups:
luser.groups.append(group)
luser.display_name = kw['fqdn']
luser.email_address = kw['email']
luser.user_name = kw['lusername']
if kw['lpassword']:
luser.password = kw['lpassword']
if labcontroller.disabled != kw['disabled']:
activity = LabControllerActivity(identity.current.user, 'WEBUI',
'Changed', 'Disabled', unicode(labcontroller.disabled),
unicode(kw['disabled']))
labcontroller.disabled = kw['disabled']
labcontroller.write_activity.append(activity)
flash( _(u"%s saved" % labcontroller.fqdn) )
redirect(".")