Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #21736: when a key is multi-line, the reporting fails because agent add the datetime in fron of each new line #4474

Conversation

amousset
Copy link
Member

@amousset amousset commented Sep 9, 2022

@amousset amousset requested a review from Fdall September 9, 2022 10:31
@amousset
Copy link
Member Author

amousset commented Sep 9, 2022

not finished yet.

@amousset
Copy link
Member Author

amousset commented Sep 9, 2022

PR updated with a new commit

2 similar comments
@amousset
Copy link
Member Author

amousset commented Sep 9, 2022

PR updated with a new commit

@amousset
Copy link
Member Author

amousset commented Sep 9, 2022

PR updated with a new commit

fn simpleline_until_metadata(i: &str) -> IResult<&str, &str> {
let (i, _) = not(tag("@@"))(i)?;
let (i, _) = opt(line_timestamp)(i)?;
// Try to parse as sigle line metadata.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Try to parse as sigle line metadata.
// Try to parse as single line metadata.

@amousset
Copy link
Member Author

amousset commented Sep 9, 2022

PR updated with a new commit

@@ -594,6 +682,41 @@ mod tests {
maybe_report(report).unwrap().1,
Err("2018-08-24T15:55:01+00:00 R: @@Common@@broken".to_string())
);
let report = "garbage\n2018-08-24T15:55:01+00:00 R: @@Common@@result_repaired@@hasPolicyServer-root@@common-root@@0@@CRON Daemon@@multi\r\n2018-08-24T15:55:01+00:00 line@@2018-08-24 15:55:01 +00:00##root@#Cron daemon status was repaired\r\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a date in the after the newline in the component key? On windows node we do no report like that. The date prefix is only added on new report lines. Not on newline inside a report.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because on Linux the timestamp do not come from the logs but are added by the wrapper, so we can't really know which line require a prefix, so we add it on all lines.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added another test for the full windows case.

@amousset
Copy link
Member Author

amousset commented Sep 9, 2022

PR updated with a new commit

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/4474
-- Your faithful QA
Kant merge: "Thoughts without content are empty, intuitions without concepts are blind."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/59556/console)

@amousset
Copy link
Member Author

amousset commented Sep 9, 2022

OK, squash merging this PR

…gent add the datetime in fron of each new line
@amousset amousset force-pushed the bug_21736/when_a_key_is_multi_line_the_reporting_fails_because_agent_add_the_datetime_in_fron_of_each_new_line branch from 6055149 to 109e064 Compare September 9, 2022 12:41
@amousset amousset merged commit 109e064 into Normation:branches/rudder/7.1 Sep 9, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants