[Security Solution] Adds missing migration script execution for Endpoint policy (#115969)
This commit is contained in:
parent
00f05ce207
commit
c11e228b3d
2 changed files with 19 additions and 2 deletions
|
@ -44,7 +44,7 @@ import {
|
|||
} from './migrations/to_v7_13_0';
|
||||
import { migratePackagePolicyToV7140, migrateInstallationToV7140 } from './migrations/to_v7_14_0';
|
||||
import { migratePackagePolicyToV7150 } from './migrations/to_v7_15_0';
|
||||
import { migrateInstallationToV7160 } from './migrations/to_v7_16_0';
|
||||
import { migrateInstallationToV7160, migratePackagePolicyToV7160 } from './migrations/to_v7_16_0';
|
||||
|
||||
/*
|
||||
* Saved object types and mappings
|
||||
|
@ -294,6 +294,7 @@ const getSavedObjectTypes = (
|
|||
'7.13.0': migratePackagePolicyToV7130,
|
||||
'7.14.0': migratePackagePolicyToV7140,
|
||||
'7.15.0': migratePackagePolicyToV7150,
|
||||
'7.16.0': migratePackagePolicyToV7160,
|
||||
},
|
||||
},
|
||||
[PACKAGES_SAVED_OBJECT_TYPE]: {
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
|
||||
import type { SavedObjectMigrationFn } from 'kibana/server';
|
||||
|
||||
import type { Installation } from '../../../common';
|
||||
import type { Installation, PackagePolicy } from '../../../common';
|
||||
import { AUTO_UPDATE_PACKAGES, DEFAULT_PACKAGES } from '../../../common';
|
||||
|
||||
import { migratePackagePolicyToV7160 as SecSolMigratePackagePolicyToV7160 } from './security_solution';
|
||||
|
||||
export const migrateInstallationToV7160: SavedObjectMigrationFn<Installation, Installation> = (
|
||||
installationDoc,
|
||||
migrationContext
|
||||
|
@ -26,3 +28,17 @@ export const migrateInstallationToV7160: SavedObjectMigrationFn<Installation, In
|
|||
|
||||
return updatedInstallationDoc;
|
||||
};
|
||||
|
||||
export const migratePackagePolicyToV7160: SavedObjectMigrationFn<PackagePolicy, PackagePolicy> = (
|
||||
packagePolicyDoc,
|
||||
migrationContext
|
||||
) => {
|
||||
let updatedPackagePolicyDoc = packagePolicyDoc;
|
||||
|
||||
// Endpoint specific migrations
|
||||
if (packagePolicyDoc.attributes.package?.name === 'endpoint') {
|
||||
updatedPackagePolicyDoc = SecSolMigratePackagePolicyToV7160(packagePolicyDoc, migrationContext);
|
||||
}
|
||||
|
||||
return updatedPackagePolicyDoc;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue