本文整理汇总了Python中ansible.constants.COLOR_SKIP属性的典型用法代码示例。如果您正苦于以下问题:Python constants.COLOR_SKIP属性的具体用法?Python constants.COLOR_SKIP怎么用?Python constants.COLOR_SKIP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ansible.constants
的用法示例。
在下文中一共展示了constants.COLOR_SKIP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: v2_runner_on_failed
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_on_failed(self, result, ignore_errors=False):
delegated_vars = result._result.get('_ansible_delegated_vars', None)
self._clean_results(result._result, result._task.action)
if self._last_task_banner != result._task._uuid:
self._print_task_banner(result._task)
self._handle_exception(result._result, use_stderr=self.display_failed_stderr)
self._handle_warnings(result._result)
if result._task.loop and 'results' in result._result:
self._process_items(result)
else:
if delegated_vars:
self._display.display("fatal: [%s -> %s]: FAILED! => %s" % (result._host.get_name(), delegated_vars['ansible_host'],
self._dump_results(result._result)),
color=C.COLOR_ERROR, stderr=self.display_failed_stderr)
else:
self._display.display("fatal: [%s]: FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)),
color=C.COLOR_ERROR, stderr=self.display_failed_stderr)
if ignore_errors:
self._display.display("...ignoring", color=C.COLOR_SKIP)
示例2: v2_runner_on_skipped
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_on_skipped(self, result):
if self.display_skipped_hosts:
self._clean_results(result._result, result._task.action)
if self._last_task_banner != result._task._uuid:
self._print_task_banner(result._task)
if result._task.loop and 'results' in result._result:
self._process_items(result)
else:
msg = "skipping: [%s]" % result._host.get_name()
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
msg += " => %s" % self._dump_results(result._result)
self._display.display(msg, color=C.COLOR_SKIP)
示例3: v2_runner_item_on_skipped
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_item_on_skipped(self, result):
if not C.DISPLAY_SKIPPED_HOSTS:
return
self._clean_results(result._result, result._task.action)
line = [
self._get_uuid(result),
self._get_state('SKIPPED'),
self._get_task_name(result),
self._get_host(result=result)
]
color = C.COLOR_SKIP
item_result = self._get_item_label(result._result)
# don't display if None
if item_result:
line.append('item=%s' % item_result)
if self._run_is_verbose(result):
line.append('result=%s' % self._dump_results(result._result))
self._output(line, color)
示例4: v2_runner_on_skipped
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_on_skipped(self, result):
# TODO(mwhahaha): this is broken?
# if self.display_skipped_hosts:
self._clean_results(result._result, result._task.action)
if result._task.loop and 'results' in result._result:
self._process_items(result)
else:
line = [
self._get_uuid(result),
self._get_state('SKIPPED'),
self._get_task_name(result),
self._get_host(result=result)
]
color = C.COLOR_SKIP
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, color)
示例5: v2_runner_on_skipped
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_on_skipped(self, result):
duration = self._get_duration()
self._emit_line("%s | SKIPPED | %s" %
(self._host_string(result), duration), color=C.COLOR_SKIP)
示例6: v2_playbook_on_include
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_playbook_on_include(self, included_file):
if self.task_start_preamble.endswith(" ..."):
self.task_start_preamble = " "
msg = '| {} | {} | {}'.format(
", ".join([h.name for h in included_file._hosts]),
'INCLUDED',
os.path.basename(included_file._filename))
self._display.display(msg, color=C.COLOR_SKIP)
示例7: v2_playbook_on_include
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_playbook_on_include(self, included_file):
"""Print out paths to statically included files"""
msg = 'included: %s for %s' % (included_file._filename, ", ".join([h.name for h in included_file._hosts]))
self._display.display(msg, color=C.COLOR_SKIP, log_only=True)
示例8: v2_runner_item_on_skipped
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_item_on_skipped(self, result):
"""Print out task results when an item is skipped"""
if C.DISPLAY_SKIPPED_HOSTS:
msg = "skipping: [%s] => (item=%s) " % (result._host.get_name(), self._get_item(result._result))
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
msg += " => %s" % self._dump_results(result._result)
self._display.display(msg, color=C.COLOR_SKIP, log_only=True)
示例9: v2_runner_on_skipped
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_on_skipped(self, result):
"""Print out task results when a task (or something else?) is skipped"""
if C.DISPLAY_SKIPPED_HOSTS:
if result._task.loop and 'results' in result._result:
self._process_items(result)
else:
msg = "skipping: [%s]" % result._host.get_name()
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
msg += " => %s" % self._dump_results(result._result)
self._display.display(msg, color=C.COLOR_SKIP, log_only=True)
示例10: v2_playbook_on_notify
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_playbook_on_notify(self, res, handler):
"""What happens when a task result is 'changed' and the task has a
'notify' list attached.
"""
self._display.display("skipping: no hosts matched", color=C.COLOR_SKIP, log_only=True)
示例11: v2_playbook_on_no_hosts_matched
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_playbook_on_no_hosts_matched(self):
self._display.display("skipping: no hosts matched", color=C.COLOR_SKIP)
示例12: v2_runner_item_on_skipped
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_item_on_skipped(self, result):
if self.display_skipped_hosts:
if self._last_task_banner != result._task._uuid:
self._print_task_banner(result._task)
self._clean_results(result._result, result._task.action)
msg = "skipping: [%s] => (item=%s) " % (result._host.get_name(), self._get_item_label(result._result))
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
msg += " => %s" % self._dump_results(result._result)
## refactored for litmuschaos
self._display.display(msg, color=C.COLOR_SKIP)
示例13: v2_playbook_on_include
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_playbook_on_include(self, included_file):
msg = 'included: %s for %s' % (included_file._filename, ", ".join([h.name for h in included_file._hosts]))
if 'item' in included_file._args:
msg += " => (item=%s)" % (self._get_item_label(included_file._args),)
self._display.display(msg, color=C.COLOR_SKIP)
示例14: v2_runner_on_failed
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_runner_on_failed(self, result, ignore_errors=False):
self._clean_results(result._result, result._task.action)
# TODO(mwhahaha): implement this one
self._handle_exception(result._result)
self._handle_warnings(result._result)
if result._task.loop and 'results' in result._result:
self._process_items(result)
else:
if ignore_errors:
status = 'IGNORED'
color = C.COLOR_SKIP
else:
status = 'FATAL'
color = C.COLOR_ERROR
line = [
self._get_uuid(result),
self._get_state(status),
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)
line.append('error=%s' % self._dump_results(result._result))
self._output(line, color)
示例15: v2_playbook_on_include
# 需要导入模块: from ansible import constants [as 别名]
# 或者: from ansible.constants import COLOR_SKIP [as 别名]
def v2_playbook_on_include(self, included_file):
color = C.COLOR_SKIP
# included files don't have tasks so lets generate one for the file
# for consistency. Should this be optional?
file_id = str(uuid.uuid4())
for host in included_file._hosts:
line = [
file_id,
self._get_state('INCLUDED'),
included_file._filename,
host.name
]
self._output(line, color)