mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Fix package policy merge logic for boolean values (#123974)
This commit is contained in:
parent
bfb9e94c21
commit
159825a476
2 changed files with 14 additions and 1 deletions
|
@ -1993,6 +1993,10 @@ describe('Package policy service', () => {
|
|||
type: 'text',
|
||||
value: ['/var/log/logfile.log'],
|
||||
},
|
||||
is_value_enabled: {
|
||||
type: 'bool',
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
streams: [],
|
||||
},
|
||||
|
@ -2023,6 +2027,10 @@ describe('Package policy service', () => {
|
|||
name: 'path',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'is_value_enabled',
|
||||
type: 'bool',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -2042,6 +2050,10 @@ describe('Package policy service', () => {
|
|||
type: 'text',
|
||||
value: '/var/log/new-logfile.log',
|
||||
},
|
||||
is_value_enabled: {
|
||||
type: 'bool',
|
||||
value: 'true',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -2055,6 +2067,7 @@ describe('Package policy service', () => {
|
|||
false
|
||||
);
|
||||
expect(result.inputs[0]?.vars?.path.value).toEqual(['/var/log/logfile.log']);
|
||||
expect(result.inputs[0]?.vars?.is_value_enabled.value).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1369,7 +1369,7 @@ function deepMergeVars(original: any, override: any, keepOriginalValue = false):
|
|||
|
||||
// Ensure that any value from the original object is persisted on the newly merged resulting object,
|
||||
// even if we merge other data about the given variable
|
||||
if (keepOriginalValue && originalVar?.value) {
|
||||
if (keepOriginalValue && originalVar?.value !== undefined) {
|
||||
result.vars[name].value = originalVar.value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue