本文整理汇总了Python中aquilon.worker.processes.DSDBRunner.update_alias方法的典型用法代码示例。如果您正苦于以下问题:Python DSDBRunner.update_alias方法的具体用法?Python DSDBRunner.update_alias怎么用?Python DSDBRunner.update_alias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aquilon.worker.processes.DSDBRunner
的用法示例。
在下文中一共展示了DSDBRunner.update_alias方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: from aquilon.worker.processes import DSDBRunner [as 别名]
# 或者: from aquilon.worker.processes.DSDBRunner import update_alias [as 别名]
def render(self, session, logger, fqdn, dns_environment, target, comments,
**kwargs):
dbdns_env = DnsEnvironment.get_unique_or_default(session,
dns_environment)
dbalias = Alias.get_unique(session, fqdn=fqdn,
dns_environment=dbdns_env, compel=True)
old_target_fqdn = str(dbalias.target.fqdn)
old_comments = dbalias.comments
if target:
old_target = dbalias.target
dbalias.target = create_target_if_needed(session, logger,
target, dbdns_env)
if dbalias.target != old_target:
delete_target_if_needed(session, old_target)
if comments is not None:
dbalias.comments = comments
session.flush()
if dbdns_env.is_default and dbalias.fqdn.dns_domain.name == "ms.com":
dsdb_runner = DSDBRunner(logger=logger)
dsdb_runner.update_alias(fqdn, dbalias.target.fqdn,
dbalias.comments, old_target_fqdn,
old_comments)
dsdb_runner.commit_or_rollback("Could not update alias in DSDB")
return
示例2: render
# 需要导入模块: from aquilon.worker.processes import DSDBRunner [as 别名]
# 或者: from aquilon.worker.processes.DSDBRunner import update_alias [as 别名]
def render(self, session, logger, fqdn, dns_environment, target, comments,
**kwargs):
dbdns_env = DnsEnvironment.get_unique_or_default(session,
dns_environment)
dbalias = Alias.get_unique(session, fqdn=fqdn,
dns_environment=dbdns_env, compel=True)
old_target_fqdn = str(dbalias.target.fqdn)
old_comments = dbalias.comments
if target:
old_target = dbalias.target
dbalias.target = create_target_if_needed(session, logger,
target, dbdns_env)
# TODO: at some day we should verify that the new target is also
# bound as a server, and modify the ServiceInstanceServer bindings
# accordingly
for srv in dbalias.services_provided:
if srv.host or srv.cluster:
provider = srv.host or srv.cluster
logger.client_info("Warning: {0} provides {1:l}, and is "
"bound to {2:l}. Updating the target of "
"the alias may leave that server "
"binding in an inconsistent state."
.format(dbalias, srv.service_instance,
provider))
if dbalias.target != old_target:
delete_target_if_needed(session, old_target)
if comments is not None:
dbalias.comments = comments
session.flush()
if dbdns_env.is_default and dbalias.fqdn.dns_domain.name == "ms.com":
dsdb_runner = DSDBRunner(logger=logger)
dsdb_runner.update_alias(fqdn, dbalias.target.fqdn,
dbalias.comments, old_target_fqdn,
old_comments)
dsdb_runner.commit_or_rollback("Could not update alias in DSDB")
return