Skip to content

Commit

Permalink
issue-2732: correct issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vladstepanyuk committed Dec 25, 2024
1 parent 7e848ee commit 6774585
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ void TChangeAgentStateActor::Notify(
<< "&AgentID=" << AgentID,
alertLevel);

auto response =
std::make_unique<NMon::TEvRemoteHttpInfoRes>(std::move(out.Str()));
auto response = std::make_unique<NMon::TEvRemoteHttpInfoRes>(out.Str());
NCloud::Reply(ctx, *RequestInfo, std::move(response));
}

Expand Down Expand Up @@ -190,7 +189,12 @@ void TDiskRegistryActor::HandleHttpInfo_ChangeAgentState(
return;
}

if (newState == NProto::EAgentState::AGENT_STATE_UNAVAILABLE) {
static const THashSet<NProto::EAgentState> NewStateWhiteList = {
NProto::EAgentState::AGENT_STATE_ONLINE,
NProto::EAgentState::AGENT_STATE_WARNING,
};

if (!NewStateWhiteList.contains(newState)) {
RejectHttpRequest(ctx, *requestInfo, "Invalid new state");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ void TChangeDeviceStateActor::Notify(
<< "&DeviceUUID=" << DeviceUUID,
alertLevel);

auto response =
std::make_unique<NMon::TEvRemoteHttpInfoRes>(std::move(out.Str()));
auto response = std::make_unique<NMon::TEvRemoteHttpInfoRes>(out.Str());
NCloud::Reply(ctx, *RequestInfo, std::move(response));
}

Expand Down Expand Up @@ -192,7 +191,12 @@ void TDiskRegistryActor::HandleHttpInfo_ChangeDeviseState(
return;
}

if (newState == NProto::EDeviceState::DEVICE_STATE_ERROR) {
static const THashSet<NProto::EDeviceState> NewStateWhiteList = {
NProto::EDeviceState::DEVICE_STATE_ONLINE,
NProto::EDeviceState::DEVICE_STATE_WARNING,
};

if (!NewStateWhiteList.contains(newState)) {
RejectHttpRequest(ctx, *requestInfo, "Invalid new state");
return;
}
Expand Down

0 comments on commit 6774585

Please sign in to comment.