diff --git a/pkg/errors/codes/codes.go b/pkg/errors/codes/codes.go index 1c953f53..81fc5e48 100644 --- a/pkg/errors/codes/codes.go +++ b/pkg/errors/codes/codes.go @@ -60,6 +60,7 @@ const ( VolumeAccessInconsistent PreCheckFailed ProviderNotReady + InconsistentVersion // This is not a valid code, it is used to get the maximum code value. // Any new codes should be defined above this. _maxCode diff --git a/pkg/errors/codes/codes_string.go b/pkg/errors/codes/codes_string.go index d6f25214..2acdb4e3 100644 --- a/pkg/errors/codes/codes_string.go +++ b/pkg/errors/codes/codes_string.go @@ -113,6 +113,8 @@ func (c MocCode) String() string { return "PreCheckFailed" case ProviderNotReady: return "ProviderNotReady" + case InconsistentVersion: + return "InconsistentVersion" default: return "MocCode(" + strconv.FormatUint(uint64(c), 10) + ")" } diff --git a/pkg/errors/errors.go b/pkg/errors/errors.go index 80b90d2f..473c18f8 100644 --- a/pkg/errors/errors.go +++ b/pkg/errors/errors.go @@ -134,6 +134,7 @@ var ( IPOutOfRange error = NewMocError(moccodes.IPOutOfRange) PreCheckFailed error = NewMocError(moccodes.PreCheckFailed) ProviderNotReady error = NewMocError(moccodes.ProviderNotReady) + InconsistentVersion error = NewMocError(moccodes.InconsistentVersion) ) // legacyErrorMessages - map of error codes to their legacy string representation. This is solely for backwards compatibility @@ -570,6 +571,10 @@ func IsProviderNotReady(err error) bool { return checkError(err, ProviderNotReady) } +func IsInconsistentVersion(err error) bool { + return checkError(err, InconsistentVersion) +} + // checkError checks if the wrappedError has the same MocCode as the err error according to GetMocErrorCode. // If the error is not matched by GetMocErrorCode and the error does not have a GRPC code (or is a GRPC Unknown code), // it will attempt to match the error strings through string matching (even for multierrors). diff --git a/rpc/common/admin/health/moc_common_health.proto b/rpc/common/admin/health/moc_common_health.proto index 93df4ee7..9e1e2482 100644 --- a/rpc/common/admin/health/moc_common_health.proto +++ b/rpc/common/admin/health/moc_common_health.proto @@ -26,6 +26,7 @@ message AgentInfoResponse{ google.protobuf.BoolValue Result = 2; string Error = 3; string deploymentId = 4; + string version = 5; } service HealthAgent { diff --git a/rpc/common/admin/moc_common_health.pb.go b/rpc/common/admin/moc_common_health.pb.go index 544ebdfa..156ab846 100644 --- a/rpc/common/admin/moc_common_health.pb.go +++ b/rpc/common/admin/moc_common_health.pb.go @@ -134,6 +134,7 @@ type AgentInfoResponse struct { Result *wrappers.BoolValue `protobuf:"bytes,2,opt,name=Result,proto3" json:"Result,omitempty"` Error string `protobuf:"bytes,3,opt,name=Error,proto3" json:"Error,omitempty"` DeploymentId string `protobuf:"bytes,4,opt,name=deploymentId,proto3" json:"deploymentId,omitempty"` + Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -192,6 +193,13 @@ func (m *AgentInfoResponse) GetDeploymentId() string { return "" } +func (m *AgentInfoResponse) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + func init() { proto.RegisterType((*HealthRequest)(nil), "moc.common.admin.HealthRequest") proto.RegisterType((*HealthResponse)(nil), "moc.common.admin.HealthResponse") @@ -203,33 +211,34 @@ func init() { } var fileDescriptor_4d110a1beda4379f = []byte{ - // 416 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x4d, 0x6f, 0xd4, 0x30, - 0x10, 0xad, 0xa1, 0x5b, 0xb5, 0x4e, 0xbb, 0x2a, 0x56, 0x05, 0x21, 0x48, 0x10, 0x05, 0x54, 0x05, - 0x21, 0xd9, 0x52, 0x38, 0x70, 0xa6, 0xa8, 0x02, 0x0e, 0x70, 0x70, 0x25, 0x0e, 0x5c, 0xaa, 0x7c, - 0x4c, 0x3e, 0x44, 0xec, 0x09, 0x8e, 0x23, 0xd4, 0x3f, 0xc3, 0x1f, 0xe0, 0xc2, 0x4f, 0x44, 0xb1, - 0xb7, 0xab, 0xed, 0xae,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0xf2, 0xdd, 0x1c, 0x2e, 0x3d, 0xcd, 0x22, 0x7a, - 0x28, 0xa1, 0x40, 0xb4, 0x50, 0x85, 0x8b, 0x98, 0xa4, 0x87, 0x72, 0xfd, 0x4e, 0xfe, 0x10, 0xfa, - 0xe8, 0x7d, 0x03, 0xda, 0x7e, 0xd6, 0x35, 0xae, 0x3d, 0xa6, 0x74, 0x7f, 0x9e, 0x80, 0x0b, 0x15, - 0x64, 0x67, 0x7c, 0x63, 0x03, 0x5f, 0xb1, 0x02, 0xa7, 0x75, 0x8a, 0x7b, 0x4c, 0x93, 0xd0, 0xe3, - 0x0a, 0x86, 0x1e, 0x6f, 0xd4, 0xec, 0xa6, 0x72, 0xa1, 0x8e, 0xe4, 0x1d, 0x2c, 0xfb, 0x4b, 0x68, - 0xe0, 0x03, 0x3a, 0xcf, 0x4c, 0xd2, 0xe0, 0x43, 0x0b, 0xe5, 0x0f, 0x8f, 0xb1, 0x17, 0x7c, 0xfb, - 0x54, 0xf8, 0x9d, 0xb5, 0x45, 0xf1, 0xff, 0x05, 0x3e, 0x79, 0xb2, 0xc7, 0xbe, 0xd0, 0xe3, 0x8f, - 0x60, 0xd7, 0x33, 0x61, 0x8f, 0x77, 0x12, 0x5d, 0xce, 0xd7, 0x16, 0xbd, 0xdc, 0xad, 0xb5, 0x33, - 0xc8, 0x64, 0xef, 0xe2, 0xcd, 0xf7, 0xd7, 0x4d, 0x67, 0xdb, 0xa9, 0x98, 0xa5, 0x42, 0x75, 0xa5, - 0xc1, 0x11, 0x6b, 0x3b, 0x5f, 0xbb, 0x30, 0x43, 0x29, 0x7c, 0x01, 0xe1, 0x0a, 0x14, 0x07, 0xae, - 0xc7, 0xdb, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3e, 0x88, 0xf2, 0xbc, 0x19, 0x03, 0x00, 0x00, + // 431 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff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7, 0xab, 0xe1, 0x1d, 0xc6, 0x2f, 0xf6, 0x67, 0xed, 0x45, 0x9c, + 0x1e, 0x5c, 0xbe, 0xfe, 0xf6, 0x6a, 0xd1, 0xb8, 0xba, 0x9f, 0x0d, 0x54, 0xa1, 0x9a, 0xd2, 0xa0, + 0xc5, 0xb9, 0x1b, 0xfe, 0x81, 0x30, 0x5d, 0x29, 0xc2, 0x00, 0xe1, 0x07, 0xcc, 0x8e, 0xfc, 0x8e, + 0x37, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x90, 0x1e, 0x7f, 0x78, 0x33, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used.