本文整理汇总了Python中bkr.server.model.System.by_fqdn方法的典型用法代码示例。如果您正苦于以下问题:Python System.by_fqdn方法的具体用法?Python System.by_fqdn怎么用?Python System.by_fqdn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bkr.server.model.System
的用法示例。
在下文中一共展示了System.by_fqdn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_lookup_secret_fqdn
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def test_lookup_secret_fqdn(self):
with session.begin():
system = data_setup.create_system()
system.private = True
lab_controller_user = LabController.by_name(self.lc_fqdn).user
system2 = System.by_fqdn(str(system.fqdn), user=lab_controller_user)
self.assertEquals(system, system2)
示例2: doit
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def doit():
distro_trees = []
for id in request.form.getlist('distro_tree_id'):
try:
distro_trees.append(DistroTree.by_id(id))
except NoResultFound:
raise BadRequest400('Distro tree %r does not exist' % id)
job_details = {}
job_details['pick'] = request.form.get('pick') or 'auto'
if job_details['pick'] == 'fqdn':
try:
job_details['system'] = System.by_fqdn(request.form.get('system'),
identity.current.user)
except NoResultFound:
raise BadRequest400('System %s not found' % request.form.get('system'))
elif job_details['pick'] == 'lab':
try:
job_details['lab'] = LabController.by_name(request.form.get('lab'))
except NoResultFound:
raise BadRequest400('Lab controller %s not found' % request.form.get('lab'))
days = int(request.form.get('reserve_days') or DEFAULT_RESERVE_DAYS)
days = min(days, MAX_DAYS_PROVISION)
job_details['reservetime'] = days * 24 * 60 * 60
job_details['whiteboard'] = request.form.get('whiteboard')
job_details['ks_meta'] = request.form.get('ks_meta')
job_details['koptions'] = request.form.get('koptions')
job_details['koptions_post'] = request.form.get('koptions_post')
with convert_internal_errors():
job = Job.provision_system_job(distro_trees, **job_details)
return 'Created %s' % job.t_id, 201, [('Location', absolute_url('/jobs/%s' % job.id))]
示例3: test_creating_a_system_with_power_settings
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def test_creating_a_system_with_power_settings(self):
s = requests.Session()
s.post(get_server_base() + 'login', data={'user_name': self.user.user_name,
'password': u'password'}).raise_for_status()
fqdn = data_setup.unique_name(u'newsystem%s')
data = {
'fqdn': fqdn,
'lab_controller_id': self.lc.id,
'power_type': u'apc_snmp_then_etherwake',
'power_address': u'dummyaddress',
'power_user': u'dummyuser',
'power_password': u'dummypassword',
'power_id': u'dummyvm',
'power_quiescent_period': 5,
'release_action': u'LeaveOn',
'reprovision_distro_tree': {'id': self.distro_tree.id},
}
response = post_json(get_server_base() + 'systems/', session=s, data=data)
with session.begin():
system = System.by_fqdn(fqdn, self.user)
self.assertEquals(system.power.power_type, PowerType.by_name(u'apc_snmp_then_etherwake'))
self.assertEquals(system.power.power_address, u'dummyaddress')
self.assertEquals(system.power.power_user, u'dummyuser')
self.assertEquals(system.power.power_passwd, u'dummypassword')
self.assertEquals(system.power.power_id, u'dummyvm')
self.assertEquals(system.power.power_quiescent_period, 5)
self.assertEquals(system.release_action, ReleaseAction.leave_on)
self.assertEquals(system.reprovision_distro_tree, self.distro_tree)
示例4: test_creating_a_system_with_hardware_details
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def test_creating_a_system_with_hardware_details(self):
s = requests.Session()
s.post(get_server_base() + 'login', data={'user_name': self.user.user_name,
'password': u'password'}).raise_for_status()
fqdn = data_setup.unique_name(u'newsystem%s')
data = {
'fqdn': fqdn,
'hypervisor': u'KVM',
'vendor': u'dummyvendor',
'location': u'dummylocation',
'model': u'dummymodel',
'serial_number': u'dummynumber',
'mac_address': u'dummymacaddress',
'memory': 111111,
'numa_nodes': 5,
}
response = post_json(get_server_base() + 'systems/', session=s, data=data)
with session.begin():
system = System.by_fqdn(fqdn, self.user)
self.assertEquals(system.fqdn, fqdn)
self.assertEquals(system.hypervisor, Hypervisor.by_name(u'KVM'))
self.assertEquals(system.location, u'dummylocation')
self.assertEquals(system.serial, u'dummynumber')
self.assertEquals(system.mac_address, u'dummymacaddress')
self.assertEquals(system.memory, 111111)
self.assertEquals(system.numa.nodes, 5)
示例5: test_create_system_set_host_hypervisor
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def test_create_system_set_host_hypervisor(self):
fqdn = data_setup.unique_name(u'mysystem%s')
run_client(['bkr', 'system-create', fqdn,
'--host-hypervisor=KVM'])
with session.begin():
system = System.by_fqdn(fqdn, User.by_user_name(u'admin'))
self.assertEquals(str(system.hypervisor), u'KVM')
self.assertEquals(system.activity[0].new_value, u'KVM')
示例6: test_create_system_set_labcontroller
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def test_create_system_set_labcontroller(self):
fqdn = data_setup.unique_name(u'mysystem%s')
lc = data_setup.create_labcontroller()
run_client(['bkr', 'system-create',
'--lab-controller', str(lc.fqdn),
fqdn])
with session.begin():
system = System.by_fqdn(fqdn, User.by_user_name(u'admin'))
self.assertTrue(system.lab_controller, lc)
示例7: clear_netboot
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def clear_netboot(self, fqdn):
"""
Clears any netboot configuration in effect for the system with the
given fully-qualified domain name.
.. verisonadded:: 0.9
"""
system = System.by_fqdn(fqdn, identity.current.user)
system.clear_netboot(service=u'XMLRPC')
return system.fqdn # because turbogears makes us return something
示例8: clear_netboot_form
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def clear_netboot_form(self, fqdn):
"""Queues the clear netboot commands
Enqueues the command to clear any netboot configuration for this
system, and on success redirects to the system page.
"""
system = System.by_fqdn(fqdn, identity.current.user)
system.clear_netboot(service=u'WEBUI')
flash(_(u'Clear netboot command enqueued'))
redirect(u'../view/%s' % fqdn)
示例9: update_loan
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def update_loan(self, fqdn=None, loaned=None, loan_comment=None, **kw):
"""Update system loan and loan comment.
Returns the loanee
"""
# The formal param 'loaned' is dictated to us by widgets.SystemForm...
loaning_to = loaned
system = System.by_fqdn(fqdn, identity.current.user)
system.change_loan(loaning_to, loan_comment)
return loaning_to if loaning_to else ''
示例10: test_create_system_set_arches
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def test_create_system_set_arches(self):
fqdn = data_setup.unique_name(u'mysystem%s')
run_client(['bkr', 'system-create',
'--arch', u'i386',
'--arch', u'x86_64',
fqdn])
with session.begin():
system = System.by_fqdn(fqdn, User.by_user_name(u'admin'))
self.assertIn(Arch.by_name(u'i386'), system.arch)
self.assertIn(Arch.by_name(u'x86_64'), system.arch)
示例11: test_create_system_set_condition
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def test_create_system_set_condition(self):
fqdn = data_setup.unique_name(u'mysystem%s')
with session.begin():
lc = data_setup.create_labcontroller()
run_client(['bkr', 'system-create', fqdn,
'--lab-controller', str(lc.fqdn),
'--condition=Automated'])
with session.begin():
system = System.by_fqdn(fqdn, User.by_user_name(u'admin'))
self.assertTrue(system.lab_controller, lc)
self.assertEquals(str(system.status), u'Automated')
示例12: check_power_action
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def check_power_action(self, action):
with session.begin():
user = data_setup.create_user(password=u'password')
system = data_setup.create_system()
data_setup.configure_system_power(system)
system.lab_controller = self.lab_controller
system.user = None
self.server.auth.login_password(user.user_name, 'password')
self.server.systems.power(action, system.fqdn)
self.assertEqual(
System.by_fqdn(system.fqdn, user).command_queue[0].action,
action)
示例13: release
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def release(self, fqdn):
"""
Releases a reservation on the system with the given fully-qualified
domain name.
The caller must be the current user of a system (i.e. must have
successfully reserved it previously).
.. versionadded:: 0.6
"""
system = System.by_fqdn(fqdn, identity.current.user)
system.unreserve_manually_reserved(service=u'XMLRPC')
return system.fqdn # because turbogears makes us return something
示例14: add_completed_command
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def add_completed_command(self, fqdn, action):
# Reports completion of a command that was executed
# synchronously by the lab controller
user = identity.current.user
system = System.by_fqdn(fqdn, user)
cmd = CommandActivity(user=user,
service=u"XMLRPC",
action=action,
status=CommandStatus.completed)
system.command_queue.append(cmd)
session.flush() # Populates cmd.system (needed for next call)
cmd.log_to_system_history()
return True
示例15: reserve
# 需要导入模块: from bkr.server.model import System [as 别名]
# 或者: from bkr.server.model.System import by_fqdn [as 别名]
def reserve(self, fqdn):
"""
"Reserves" (a.k.a. "takes") the system with the given fully-qualified domain
name. The caller then becomes the user of the system, and can
provision it at will.
A system may only be reserved when: its condition is 'Manual', it is not
currently in use, and the caller has permission to use the system.
.. versionadded:: 0.6
"""
system = System.by_fqdn(fqdn, identity.current.user)
system.reserve_manually(service=u'XMLRPC')
return system.fqdn # because turbogears makes us return something