Fixes backwards compatibility with rule exports (#115888)
## Summary We at least want to do our best to retain n-1 version compatible with exports and then best effort for n-2 or more. During testing I saw that we changed our export contract and I was getting these errors importing from 7.15 into 7.16: <img width="814" alt="Screen Shot 2021-10-20 at 8 25 07 PM" src="https://user-images.githubusercontent.com/1151048/138202992-c6e016e6-388c-4597-b302-b13d7126e705.png"> The reason is because it thinks the final "summary line" which has `exported_count` instead of `exported_rules_count` will think that is a rule based ndjson line and not exclude it. This was introduced in this PR: https://github.com/elastic/kibana/pull/115144 I was under the impression that was adding more information and not subtracting information when I did the PR review. I almost think that we should keep the `exported_count` in addition to the new lines that are added so the user has a total count of everything exported. This PR doesn't do that, it just fixes the backwards compatibility to not have errors. If we ship like this the other rules from 7.15 and previous will still import but users will see error messages like that one above which they should never see. However, really, we should be careful about changes that are not just additive with formats. ### Checklist No this PR currently does not have tests for backwards compatibility but I think we should add it either here or a follow up. - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
parent
079fbce79d
commit
7337a67c53
1 changed files with 2 additions and 0 deletions
|
@ -24,6 +24,7 @@ import {
|
|||
filterExportedRulesCounts,
|
||||
filterExceptions,
|
||||
createLimitStream,
|
||||
filterExportedCounts,
|
||||
} from '../../../utils/read_stream/create_stream_from_ndjson';
|
||||
|
||||
export const validateRules = (): Transform => {
|
||||
|
@ -60,6 +61,7 @@ export const createRulesStreamFromNdJson = (ruleLimit: number) => {
|
|||
return [
|
||||
createSplitStream('\n'),
|
||||
parseNdjsonStrings(),
|
||||
filterExportedCounts(),
|
||||
filterExportedRulesCounts(),
|
||||
filterExceptions(),
|
||||
validateRules(),
|
||||
|
|
Loading…
Reference in a new issue