Skip to content

Commit bd1712f

Browse files
committed
[odcshim] Correctly handle early GetState calls
1 parent 21cdac4 commit bd1712f

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

odcshim/occserver/occserver.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,20 @@ func (s *OccServerImpl) GetState(ctx context.Context, req *pb.GetStateRequest) (
159159
return nil, status.Errorf(codes.Internal, "ODC not connected")
160160
}
161161

162-
// Provisional response
162+
// Provisional response STANDBY when we know we're connected but haven't
163+
// reached CONFIGURE yet so we don't have an envId to use for an ODC.GetState call
163164
rep := &pb.GetStateReply{
164-
State: "UNKNOWN",
165+
State: "STANDBY",
165166
}
166167

167-
newState, err := handleGetState(ctx, s.odcClient, s.environmentId)
168-
if err == nil {
169-
rep.State = newState
168+
if len(s.environmentId) > 0 {
169+
newState, err := handleGetState(ctx, s.odcClient, s.environmentId)
170+
if err == nil {
171+
rep.State = newState
172+
}
173+
return rep, err
170174
}
171-
return rep, err
175+
return rep, nil
172176
}
173177

174178
func (s *OccServerImpl) Transition(ctx context.Context, req *pb.TransitionRequest) (*pb.TransitionReply, error) {

0 commit comments

Comments
 (0)