mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Set state_output_profile as option and update docs
This commit is contained in:
parent
7a994b4910
commit
b997a74922
5 changed files with 40 additions and 7 deletions
|
@ -635,6 +635,10 @@
|
||||||
# states is cluttering the logs. Set it to True to ignore them.
|
# states is cluttering the logs. Set it to True to ignore them.
|
||||||
#state_output_diff: False
|
#state_output_diff: False
|
||||||
|
|
||||||
|
# The state_output_profile setting changes whether profile information
|
||||||
|
# will be shown for each state run.
|
||||||
|
#state_output_profile: True
|
||||||
|
|
||||||
# Automatically aggregate all states that have support for mod_aggregate by
|
# Automatically aggregate all states that have support for mod_aggregate by
|
||||||
# setting to 'True'. Or pass a list of state module names to automatically
|
# setting to 'True'. Or pass a list of state module names to automatically
|
||||||
# aggregate just those types.
|
# aggregate just those types.
|
||||||
|
|
|
@ -2518,6 +2518,20 @@ states is cluttering the logs. Set it to True to ignore them.
|
||||||
|
|
||||||
state_output_diff: False
|
state_output_diff: False
|
||||||
|
|
||||||
|
.. conf_master:: state_output_profile
|
||||||
|
|
||||||
|
``state_output_profile``
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Default: ``True``
|
||||||
|
|
||||||
|
The ``state_output_profile`` setting changes whether profile information
|
||||||
|
will be shown for each state run.
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
state_output_profile: True
|
||||||
|
|
||||||
.. conf_master:: state_aggregate
|
.. conf_master:: state_aggregate
|
||||||
|
|
||||||
``state_aggregate``
|
``state_aggregate``
|
||||||
|
|
|
@ -2277,6 +2277,20 @@ states is cluttering the logs. Set it to True to ignore them.
|
||||||
|
|
||||||
state_output_diff: False
|
state_output_diff: False
|
||||||
|
|
||||||
|
.. conf_minion:: state_output_profile
|
||||||
|
|
||||||
|
``state_output_profile``
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Default: ``True``
|
||||||
|
|
||||||
|
The ``state_output_profile`` setting changes whether profile information
|
||||||
|
will be shown for each state run.
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
state_output_profile: True
|
||||||
|
|
||||||
.. conf_minion:: autoload_dynamic_modules
|
.. conf_minion:: autoload_dynamic_modules
|
||||||
|
|
||||||
``autoload_dynamic_modules``
|
``autoload_dynamic_modules``
|
||||||
|
|
|
@ -372,6 +372,8 @@ VALID_OPTS = immutabletypes.freeze(
|
||||||
"state_output": str,
|
"state_output": str,
|
||||||
# Tells the highstate outputter to only report diffs of states that changed
|
# Tells the highstate outputter to only report diffs of states that changed
|
||||||
"state_output_diff": bool,
|
"state_output_diff": bool,
|
||||||
|
# Tells the highstate outputter whether profile information will be shown for each state run
|
||||||
|
"state_output_profile": bool,
|
||||||
# When true, states run in the order defined in an SLS file, unless requisites re-order them
|
# When true, states run in the order defined in an SLS file, unless requisites re-order them
|
||||||
"state_auto_order": bool,
|
"state_auto_order": bool,
|
||||||
# Fire events as state chunks are processed by the state compiler
|
# Fire events as state chunks are processed by the state compiler
|
||||||
|
@ -1145,6 +1147,7 @@ DEFAULT_MINION_OPTS = immutabletypes.freeze(
|
||||||
"state_verbose": True,
|
"state_verbose": True,
|
||||||
"state_output": "full",
|
"state_output": "full",
|
||||||
"state_output_diff": False,
|
"state_output_diff": False,
|
||||||
|
"state_output_profile": True,
|
||||||
"state_auto_order": True,
|
"state_auto_order": True,
|
||||||
"state_events": False,
|
"state_events": False,
|
||||||
"state_aggregate": False,
|
"state_aggregate": False,
|
||||||
|
@ -1478,6 +1481,7 @@ DEFAULT_MASTER_OPTS = immutabletypes.freeze(
|
||||||
"state_verbose": True,
|
"state_verbose": True,
|
||||||
"state_output": "full",
|
"state_output": "full",
|
||||||
"state_output_diff": False,
|
"state_output_diff": False,
|
||||||
|
"state_output_profile": True,
|
||||||
"state_auto_order": True,
|
"state_auto_order": True,
|
||||||
"state_events": False,
|
"state_events": False,
|
||||||
"state_aggregate": False,
|
"state_aggregate": False,
|
||||||
|
|
|
@ -112,7 +112,6 @@ Example output with no special settings in configuration files:
|
||||||
Total: 0
|
Total: 0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Import python libs
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import pprint
|
import pprint
|
||||||
|
@ -120,8 +119,6 @@ import re
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import salt.output
|
import salt.output
|
||||||
|
|
||||||
# Import salt libs
|
|
||||||
import salt.utils.color
|
import salt.utils.color
|
||||||
import salt.utils.data
|
import salt.utils.data
|
||||||
import salt.utils.stringutils
|
import salt.utils.stringutils
|
||||||
|
@ -356,7 +353,7 @@ def _format_host(host, data, indent_level=1):
|
||||||
" {tcolor} Result: {ret[result]!s}{colors[ENDC]}",
|
" {tcolor} Result: {ret[result]!s}{colors[ENDC]}",
|
||||||
" {tcolor} Comment: {comment}{colors[ENDC]}",
|
" {tcolor} Comment: {comment}{colors[ENDC]}",
|
||||||
]
|
]
|
||||||
if __opts__.get("state_output_profile", True) and "start_time" in ret:
|
if __opts__.get("state_output_profile") and "start_time" in ret:
|
||||||
state_lines.extend(
|
state_lines.extend(
|
||||||
[
|
[
|
||||||
" {tcolor} Started: {ret[start_time]!s}{colors[ENDC]}",
|
" {tcolor} Started: {ret[start_time]!s}{colors[ENDC]}",
|
||||||
|
@ -498,7 +495,7 @@ def _format_host(host, data, indent_level=1):
|
||||||
)
|
)
|
||||||
hstrs.append(colorfmt.format(colors["CYAN"], totals, colors))
|
hstrs.append(colorfmt.format(colors["CYAN"], totals, colors))
|
||||||
|
|
||||||
if __opts__.get("state_output_profile", True):
|
if __opts__.get("state_output_profile"):
|
||||||
sum_duration = sum(rdurations)
|
sum_duration = sum(rdurations)
|
||||||
duration_unit = "ms"
|
duration_unit = "ms"
|
||||||
# convert to seconds if duration is 1000ms or more
|
# convert to seconds if duration is 1000ms or more
|
||||||
|
@ -570,7 +567,7 @@ def _format_terse(tcolor, comps, ret, colors, tabular):
|
||||||
c=colors, w="\n".join(ret["warnings"])
|
c=colors, w="\n".join(ret["warnings"])
|
||||||
)
|
)
|
||||||
fmt_string += "{0}"
|
fmt_string += "{0}"
|
||||||
if __opts__.get("state_output_profile", True) and "start_time" in ret:
|
if __opts__.get("state_output_profile") and "start_time" in ret:
|
||||||
fmt_string += "{6[start_time]!s} [{6[duration]!s:>7} ms] "
|
fmt_string += "{6[start_time]!s} [{6[duration]!s:>7} ms] "
|
||||||
fmt_string += "{2:>10}.{3:<10} {4:7} Name: {1}{5}"
|
fmt_string += "{2:>10}.{3:<10} {4:7} Name: {1}{5}"
|
||||||
elif isinstance(tabular, str):
|
elif isinstance(tabular, str):
|
||||||
|
@ -582,7 +579,7 @@ def _format_terse(tcolor, comps, ret, colors, tabular):
|
||||||
c=colors, w="\n".join(ret["warnings"])
|
c=colors, w="\n".join(ret["warnings"])
|
||||||
)
|
)
|
||||||
fmt_string += " {0} Name: {1} - Function: {2}.{3} - Result: {4}"
|
fmt_string += " {0} Name: {1} - Function: {2}.{3} - Result: {4}"
|
||||||
if __opts__.get("state_output_profile", True) and "start_time" in ret:
|
if __opts__.get("state_output_profile") and "start_time" in ret:
|
||||||
fmt_string += " Started: - {6[start_time]!s} Duration: {6[duration]!s} ms"
|
fmt_string += " Started: - {6[start_time]!s} Duration: {6[duration]!s} ms"
|
||||||
fmt_string += "{5}"
|
fmt_string += "{5}"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue