In some cases, set_state is called with DISSOCIATING, then ASSOCIATING
and DISSOCIATING again. In this case the state DISSOCIATING is
processed to remove the image and then schedule the next action which is
associating.
To fix this case, this commit removes the next_state if the state is
sets to the same state.
Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
(cherry picked from commit
b664a95889b35d0d3afbd8428e3af4976d7f81eb)
bool Policy::set_state(ImageState* image_state, StateTransition::State state,
bool ignore_current_state) {
if (!ignore_current_state && image_state->state == state) {
+ image_state->next_state = boost::none;
return false;
} else if (StateTransition::is_idle(image_state->state)) {
image_state->state = state;