本文整理汇总了Python中aquilon.worker.processes.DSDBRunner.show_host方法的典型用法代码示例。如果您正苦于以下问题:Python DSDBRunner.show_host方法的具体用法?Python DSDBRunner.show_host怎么用?Python DSDBRunner.show_host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aquilon.worker.processes.DSDBRunner
的用法示例。
在下文中一共展示了DSDBRunner.show_host方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from aquilon.worker.processes import DSDBRunner [as 别名]
# 或者: from aquilon.worker.processes.DSDBRunner import show_host [as 别名]
def render(self, session, logger, hostname, osname, osversion, **kwargs):
# Pull relevant info out of dsdb...
dsdb_runner = DSDBRunner(logger=logger)
try:
fields = dsdb_runner.show_host(hostname)
except ProcessException, e:
raise ArgumentError("Could not find %s in DSDB: %s" %
(hostname, e))
示例2: render
# 需要导入模块: from aquilon.worker.processes import DSDBRunner [as 别名]
# 或者: from aquilon.worker.processes.DSDBRunner import show_host [as 别名]
#.........这里部分代码省略.........
if (dbmachine.model.machine_type == 'aurora_node' and
dbpersonality.archetype.name != 'aurora'):
raise ArgumentError("Machines of type aurora_node can only be "
"added with archetype aurora.")
if dbmachine.host:
raise ArgumentError("{0:c} {0.label} is already allocated to "
"{1:l}.".format(dbmachine, dbmachine.host))
if grn or eon_id:
dbgrn = lookup_grn(session, grn, eon_id, logger=logger,
config=self.config)
else:
dbgrn = dbpersonality.owner_grn
dbhost = Host(machine=dbmachine, branch=dbbranch, owner_grn=dbgrn,
sandbox_author=dbauthor, personality=dbpersonality,
status=dbstatus, operating_system=dbos, comments=comments)
session.add(dbhost)
if self.config.has_option("archetype_" + archetype, "default_grn_target"):
dbhost.grns.append((dbhost, dbgrn,
self.config.get("archetype_" + archetype,
"default_grn_target")))
if zebra_interfaces:
# --autoip does not make sense for Zebra (at least not the way it's
# implemented currently)
dbinterface = None
else:
dbinterface = get_boot_interface(dbmachine)
# This method is allowed to return None. This can only happen
# (currently) using add_aurora_host, add_windows_host, or possibly by
# bypassing the aq client and posting a request directly.
audit_results = []
ip = generate_ip(session, logger, dbinterface,
audit_results=audit_results, **arguments)
dbdns_rec, newly_created = grab_address(session, hostname, ip,
allow_restricted_domain=True,
allow_reserved=True,
preclude=True)
dbmachine.primary_name = dbdns_rec
# Fix up auxiliary addresses to point to the primary name by default
if ip:
dns_env = dbdns_rec.fqdn.dns_environment
for addr in dbmachine.all_addresses():
if addr.interface.interface_type == "management":
continue
if addr.service_address_id: # pragma: no cover
continue
for rec in addr.dns_records:
if rec.fqdn.dns_environment == dns_env:
rec.reverse_ptr = dbdns_rec.fqdn
if zebra_interfaces:
if not ip:
raise ArgumentError("Zebra configuration requires an IP address.")
dbsrv_addr = self.assign_zebra_address(session, dbmachine, dbdns_rec,
zebra_interfaces)
else:
if ip:
if not dbinterface:
raise ArgumentError("You have specified an IP address for the "
"host, but {0:l} does not have a bootable "
"interface.".format(dbmachine))
assign_address(dbinterface, ip, dbdns_rec.network)
dbsrv_addr = None
session.flush()
plenaries = PlenaryCollection(logger=logger)
plenaries.append(Plenary.get_plenary(dbmachine))
if dbmachine.vm_container:
plenaries.append(Plenary.get_plenary(dbmachine.vm_container))
if dbsrv_addr:
plenaries.append(Plenary.get_plenary(dbsrv_addr))
key = plenaries.get_write_key()
try:
lock_queue.acquire(key)
plenaries.write(locked=True)
# XXX: This (and some of the code above) is horrible. There
# should be a generic/configurable hook here that could kick
# in based on archetype and/or domain.
dsdb_runner = DSDBRunner(logger=logger)
if dbhost.archetype.name == 'aurora':
# For aurora, check that DSDB has a record of the host.
if not skip_dsdb_check:
try:
dsdb_runner.show_host(hostname)
except ProcessException, e:
raise ArgumentError("Could not find host in DSDB: %s" % e)
elif not dbmachine.primary_ip:
logger.info("No IP for %s, not adding to DSDB." % dbmachine.fqdn)