Project

General

Profile

« Previous | Next » 

Revision 16bdad98

Added by Alexis Mousset over 6 years ago

Fixes #11897: Remove multiline output from agent

View differences:

share/commands/agent-factory-reset
# @man *-r*: run the agent with raw output
# @man +
# @man *-R*: run the agent in completely unparsed mode, with no return code of 1 in case of error. A little faster.
# @man +
# @man *-m*: run the agent with multiline output
. "${BASEDIR}/../lib/common.sh"
share/commands/agent-inventory
# @man +
# @man *-R*: run the agent in completely unparsed mode, with no return code of 1 in case of error. A little faster.
# @man +
# @man *-m*: run the agent with multiline output
# @man +
# @man *-f*: run the agent even if it is disabled
. "${BASEDIR}/../lib/common.sh"
share/commands/agent-log
# @man +
# @man *-R*: show log in completely unparsed mode, with no return code of 1 in case of error. A little faster.
# @man +
# @man *-m*: show log with multiline output
# @man +
# @man *-l*: show log from the given file
# @man +
# @man *-n*: show log from the nth run before the last one
share/commands/agent-run
# @man +
# @man *-R*: run the agent in completely unparsed mode, with no return code of 1 in case of error. A little faster.
# @man +
# @man *-m*: run the agent with multiline output
# @man +
# @man *-b*: run the agent on a specific bundle
# @man +
# @man *-D*: define a class for this run
share/commands/remote-run
# @man +
# @man *-R*: run the agent in completely unparsed mode, with no return code of 1 in case of error. A little faster.
# @man +
# @man *-m*: run the agent with multiline output
# @man +
# @man *-D*: define a class for this run
# @man +
# @man *-a*: run the agent on all known nodes
share/lib/cfengine_parsing.sh
BUNDLE=""
CLASS=""
VERBOSITY=""
# Use multiline formatting
MULTILINE=0
# Display logs between Rudder reports
DISPLAY_INFO=0
# Only display a summary at the end of the run, keep the logs unmodified
......
AWK_OPTS="-u"
fi
PRETTY="awk -v info=\"\${DISPLAY_INFO}\" -v full_strings=\"\${FULL_STRINGS}\" -v summary_only=\"\${SUMMARY_ONLY}\" -v quiet=\"\${QUIET}\" -v multiline=\"\${MULTILINE}\" -v multihost=\"\${MULTIHOST}\" \
PRETTY="awk -v info=\"\${DISPLAY_INFO}\" -v full_strings=\"\${FULL_STRINGS}\" -v summary_only=\"\${SUMMARY_ONLY}\" -v quiet=\"\${QUIET}\" -v multihost=\"\${MULTIHOST}\" \
-v green=\"\${GREEN}\" -v darkgreen=\"\${DARKGREEN}\" -v red=\"\${RED}\" -v yellow=\"\${YELLOW}\" -v magenta=\"\${MAGENTA}\" -v normal=\"\${NORMAL}\" -v white=\"\${WHITE}\" -v cyan=\"\${CYAN}\" \
-v dblue=\"\${DBLUE}\" -v dgreen=\"\${DGREEN}\" -v timing=\"\${TIMING}\" -v has_fflush=\"\${AWK_FFLUSH}\" ${AWK_OPTS} -f ${PRETTY_FILTER}"
share/lib/reports.awk
printf "%s\n", message;
}
function print_report_multiline() {
printf "%s%s%s: %s\n", state_color[result], state, normal, message;
if (timing) {
if (mode != "") {
printf "%s%s%6.2fs%-74.74s%s\n", white , "-- Time: ", component_time, " " padding_dash, normal;
}
}
printf "%s%-80.80s%s\n", white, "-- Mode: " mode " " padding_dash, normal;
if (key != "") {
printf "%s%-80.80s%s\n", white, "-- Key: " key " " padding_dash, normal;
}
printf "%s%-80.80s%s\n", white, "-- Component: " component " " padding_dash, normal;
printf "%s%-80.80s%s\n", white, "-- Technique: " technique " " padding_dash, normal;
printf "%s%-80.80s%s\n\n", white, padding, normal;
}
{
#### 1/ Parse the line
......
#### 5/ Display reports
{
if (!summary_only) {
if (multiline) {
if (!header_printed) {
header_printed = 1;
printf "%s%-80.80s%s\n", white, padding, normal;
}
print_report_multiline();
if (!last_line) {
printf "%s%-80.80s%s\n", white, padding, normal;
if (!header_printed) {
printf "%s", white;
header_printed = 1;
if (multihost) {
printf "%-10.10s ", "Hostname";
}
} else {
if (!header_printed) {
printf "%s", white;
header_printed = 1;
if (multihost) {
printf "%-10.10s ", "Hostname";
}
if (timing) {
printf "%8.8s", "Time "
}
if (timing) {
printf "%8.8s", "Time "
}
if (full_strings) {
printf "%-7.7s ", "Mode";
} else {
printf "%-1.1s| ", "Mode";
}
if (full_strings) {
printf "%-7.7s ", "Mode";
} else {
printf "%-1.1s| ", "Mode";
}
printf "%-13.13s %-25.25s %-25.25s %-18.18s %s%s\n", "State", "Technique", "Component", "Key", "Message", normal;
}
printf "%-13.13s %-25.25s %-25.25s %-18.18s %s%s\n", "State", "Technique", "Component", "Key", "Message", normal;
print_report_singleline();
}
print_report_singleline();
}
if (has_fflush) {
fflush();
}
......
if (!end_run && full_compliance) {
run_error++;
printf "%s", red;
if (multiline) {
printf "error: Rudder agent was interrupted during execution by a fatal error.";
if (!info) {
printf " Run with -i to see log messages.";
}
} else {
printf "error Rudder agent was interrupted during execution by a fatal error";
if (!info) {
printf "\n Run with -i to see log messages.";
}
printf "error Rudder agent was interrupted during execution by a fatal error";
if (!info) {
printf "\n Run with -i to see log messages.";
}
printf "%s\n", normal;
}
# Check for unparsable reports
if (broken_reports) {
printf "%s", magenta;
if (multiline) {
printf "warning: %d reports were not parsable.", broken_reports;
if (!info) {
printf " Run with -i to see log messages.";
}
} else {
printf "warning %d reports were not parsable.", broken_reports;
if (!info) {
printf "\n Run with -i to see log messages.";
}
printf "warning %d reports were not parsable.", broken_reports;
if (!info) {
printf "\n Run with -i to see log messages.";
}
printf "%s\n", normal;
}

Also available in: Unified diff