Skip to content

Commit

Permalink
Do not call toggleRuleEnabledOnUpdate in upgradePrebuiltRule, sin…
Browse files Browse the repository at this point in the history
…ce it won't do anything
  • Loading branch information
nikitaindik committed Jun 18, 2024
1 parent bfcac78 commit 8d3fe01
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ import { transformAlertToRuleAction } from '../../../../../../../common/detectio
import { RuleResponse } from '../../../../../../../common/api/detection_engine/model/rule_schema';
import { transform } from '../../../utils/utils';

import {
validateMlAuth,
ClientError,
RuleResponseValidationError,
toggleRuleEnabledOnUpdate,
} from '../utils';
import { validateMlAuth, ClientError, RuleResponseValidationError } from '../utils';

import { readRules } from '../read_rules';

Expand Down Expand Up @@ -90,12 +85,6 @@ export const upgradePrebuiltRule = async (
data: patchedRule,
});

const { enabled } = await toggleRuleEnabledOnUpdate(
rulesClient,
existingRule,
patchedInternalRule.enabled
);

const updatedRule = await readRules({
rulesClient,
ruleId: ruleAsset.rule_id,
Expand All @@ -107,7 +96,7 @@ export const upgradePrebuiltRule = async (
}

/* Trying to convert the internal rule to a RuleResponse object */
const parseResult = RuleResponse.safeParse(transform({ ...patchedInternalRule, enabled }));
const parseResult = RuleResponse.safeParse(transform(patchedInternalRule));

if (!parseResult.success) {
throw new RuleResponseValidationError({
Expand Down

0 comments on commit 8d3fe01

Please sign in to comment.