本文整理汇总了Python中ansible.constants.COLOR_UNREACHABLE属性的典型用法代码示例。如果您正苦于以下问题:Python constants.COLOR_UNREACHABLE属性的具体用法?Python constants.COLOR_UNREACHABLE怎么用?Python constants.COLOR_UNREACHABLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ansible.constants
的用法示例。
在下文中一共展示了constants.COLOR_UNREACHABLE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: v2_playbook_on_stats
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_UNREACHABLE [as 别名]
def v2_playbook_on_stats(self, stats):
self._open_section("system")
self._emit_line("-- Play recap --")
hosts = sorted(stats.processed.keys())
for h in hosts:
t = stats.summarize(h)
self._emit_line(u"%s : %s %s %s %s" % (
hostcolor(h, t),
colorize(u'ok', t['ok'], C.COLOR_OK),
colorize(u'changed', t['changed'], C.COLOR_CHANGED),
colorize(u'unreachable', t['unreachable'], C.COLOR_UNREACHABLE),
colorize(u'failed', t['failures'], C.COLOR_ERROR)))
示例2: v2_playbook_on_stats
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_UNREACHABLE [as 别名]
def v2_playbook_on_stats(self, stats):
"""Print the final playbook run stats"""
self._display.display("", screen_only=True)
self.banner("PLAY RECAP")
hosts = sorted(stats.processed.keys())
for h in hosts:
t = stats.summarize(h)
self._display.display(
u"%s : %s %s %s %s" % (
hostcolor(h, t),
colorize(u'ok', t['ok'], C.COLOR_OK),
colorize(u'changed', t['changed'], C.COLOR_CHANGED),
colorize(u'unreachable', t['unreachable'], C.COLOR_UNREACHABLE),
colorize(u'failed', t['failures'], C.COLOR_ERROR)),
screen_only=True
)
self._display.display(
u"%s : %s %s %s %s" % (
hostcolor(h, t, False),
colorize(u'ok', t['ok'], None),
colorize(u'changed', t['changed'], None),
colorize(u'unreachable', t['unreachable'], None),
colorize(u'failed', t['failures'], None)),
log_only=True
)
self._display.display("", screen_only=True)
self._display.display("", screen_only=True)
# Some plays are conditional and won't run (such as load
# balancers) if they aren't required. Let the user know about
# this to avoid potential confusion.
if self.plays_total_ran != self.plays_count:
print("Installation Complete: Note: Play count is an estimate and some were skipped because your install does not require them")
self._display.display("", screen_only=True)
示例3: v2_runner_on_unreachable
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_UNREACHABLE [as 别名]
def v2_runner_on_unreachable(self, result):
if self._last_task_banner != result._task._uuid:
self._print_task_banner(result._task)
delegated_vars = result._result.get('_ansible_delegated_vars', None)
if delegated_vars:
self._display.display("fatal: [%s -> %s]: UNREACHABLE! => %s" % (result._host.get_name(), delegated_vars['ansible_host'],
self._dump_results(result._result)),
color=C.COLOR_UNREACHABLE)
else:
self._display.display("fatal: [%s]: UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(result._result)), color=C.COLOR_UNREACHABLE)
示例4: v2_runner_on_unreachable
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_UNREACHABLE [as 别名]
def v2_runner_on_unreachable(self, result):
line = [
self._get_uuid(result),
self._get_state('UNREACHABLE'),
self._get_task_name(result),
self._get_host(result=result)
]
item_result = self._get_item_label(result._result)
# don't display if None
if item_result:
line.append('item=%s' % item_result)
self._output(line, C.COLOR_UNREACHABLE)
示例5: v2_runner_on_unreachable
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_UNREACHABLE [as 别名]
def v2_runner_on_unreachable(self, result):
self._process_results(result, 'UNREACHABLE', C.COLOR_UNREACHABLE)
示例6: v2_playbook_on_stats
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_UNREACHABLE [as 别名]
def v2_playbook_on_stats(self, stats):
'''
self._display.banner("PLAY RECAP")
'''
self._display.banner("************ RELAX, EXPERIMENT ENDS! ************")
hosts = sorted(stats.processed.keys())
for h in hosts:
t = stats.summarize(h)
self._display.display(u"%s : %s %s %s %s" % (
hostcolor(h, t),
colorize(u'ok', t['ok'], C.COLOR_OK),
colorize(u'changed', t['changed'], C.COLOR_CHANGED),
colorize(u'unreachable', t['unreachable'], C.COLOR_UNREACHABLE),
colorize(u'failed', t['failures'], C.COLOR_ERROR)),
screen_only=True
)
self._display.display(u"%s : %s %s %s %s" % (
hostcolor(h, t, False),
colorize(u'ok', t['ok'], None),
colorize(u'changed', t['changed'], None),
colorize(u'unreachable', t['unreachable'], None),
colorize(u'failed', t['failures'], None)),
log_only=True
)
self._display.display("", screen_only=True)
# print custom stats if required
if stats.custom and self.show_custom_stats:
self._display.banner("CUSTOM STATS: ")
# per host
# TODO: come up with 'pretty format'
for k in sorted(stats.custom.keys()):
if k == '_run':
continue
self._display.display('\t%s: %s' % (k, self._dump_results(stats.custom[k], indent=1).replace('\n', '')))
# print per run custom stats
if '_run' in stats.custom:
self._display.display("", screen_only=True)
self._display.display('\tRUN: %s' % self._dump_results(stats.custom['_run'], indent=1).replace('\n', ''))
self._display.display("", screen_only=True)