Skip to content

Commit

Permalink
[Security Solution][Endpoint][Admin] Fixes bug where license watch up…
Browse files Browse the repository at this point in the history
…dates policy in fleet (#93691) (#93769)
parkiino authored Mar 5, 2021
1 parent 8994adc commit 83483fc
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -30,20 +30,20 @@ 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,
esStart: ElasticsearchServiceStart,
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

0 comments on commit 83483fc

Please sign in to comment.