Skip to content

Commit

Permalink
fix bug when clearing ilm priority field
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth committed Jun 28, 2020
1 parent 40ff82d commit 3b534c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,15 @@ const phaseFromES = (phase, phaseName, defaultEmptyPolicy) => {
}

if (actions.set_priority) {
policy[PHASE_INDEX_PRIORITY] = actions.set_priority.priority;
const { priority } = actions.set_priority;

if (priority) {
policy[PHASE_INDEX_PRIORITY] = priority;
} else {
policy[PHASE_INDEX_PRIORITY] = '';
}
}

if (actions.wait_for_snapshot) {
policy[PHASE_WAIT_FOR_SNAPSHOT_POLICY] = actions.wait_for_snapshot.policy;
}
Expand Down Expand Up @@ -311,6 +318,10 @@ export const phaseToES = (phase, originalEsPhase) => {
esPhase.actions.set_priority = {
priority: phase[PHASE_INDEX_PRIORITY],
};
} else if (phase[PHASE_INDEX_PRIORITY] === '') {
esPhase.actions.set_priority = {
priority: null,
};
}

if (phase[PHASE_WAIT_FOR_SNAPSHOT_POLICY]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const minAgeSchema = schema.maybe(schema.string());

const setPrioritySchema = schema.maybe(
schema.object({
priority: schema.number(),
priority: schema.nullable(schema.number()),
})
);

Expand Down

0 comments on commit 3b534c1

Please sign in to comment.