mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Security Solution][Endpoint][Admin] Fixes bug where license watch updates policy in fleet (#93691)
This commit is contained in:
parent
d0b6891abf
commit
bf1dcb7679
1 changed files with 10 additions and 5 deletions
|
@ -30,10 +30,10 @@ import { isAtLeast, LicenseService } from '../../../../common/license/license';
|
|||
|
||||
export class PolicyWatcher {
|
||||
private logger: Logger;
|
||||
private soClient: SavedObjectsClientContract;
|
||||
private esClient: ElasticsearchClient;
|
||||
private policyService: PackagePolicyServiceInterface;
|
||||
private subscription: Subscription | undefined;
|
||||
private soStart: SavedObjectsServiceStart;
|
||||
constructor(
|
||||
policyService: PackagePolicyServiceInterface,
|
||||
soStart: SavedObjectsServiceStart,
|
||||
|
@ -41,9 +41,9 @@ export class PolicyWatcher {
|
|||
logger: Logger
|
||||
) {
|
||||
this.policyService = policyService;
|
||||
this.soClient = this.makeInternalSOClient(soStart);
|
||||
this.esClient = esStart.client.asInternalUser;
|
||||
this.logger = logger;
|
||||
this.soStart = soStart;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +89,7 @@ export class PolicyWatcher {
|
|||
};
|
||||
do {
|
||||
try {
|
||||
response = await this.policyService.list(this.soClient, {
|
||||
response = await this.policyService.list(this.makeInternalSOClient(this.soStart), {
|
||||
page: page++,
|
||||
perPage: 100,
|
||||
kuery: `${PACKAGE_POLICY_SAVED_OBJECT_TYPE}.package.name: endpoint`,
|
||||
|
@ -119,12 +119,17 @@ export class PolicyWatcher {
|
|||
license
|
||||
);
|
||||
try {
|
||||
await this.policyService.update(this.soClient, this.esClient, policy.id, updatePolicy);
|
||||
await this.policyService.update(
|
||||
this.makeInternalSOClient(this.soStart),
|
||||
this.esClient,
|
||||
policy.id,
|
||||
updatePolicy
|
||||
);
|
||||
} catch (e) {
|
||||
// try again for transient issues
|
||||
try {
|
||||
await this.policyService.update(
|
||||
this.soClient,
|
||||
this.makeInternalSOClient(this.soStart),
|
||||
this.esClient,
|
||||
policy.id,
|
||||
updatePolicy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue