From 2ad21f1be800b95411b857ef985ce23f44450797 Mon Sep 17 00:00:00 2001 From: Cai Chen Date: Wed, 31 Jul 2024 16:11:53 -0400 Subject: [PATCH] Sync from server repo (2818ae277ae) --- rfc7807/errors.go | 5 +++++ vclusterops/fetch_node_state.go | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/rfc7807/errors.go b/rfc7807/errors.go index f5af687..3b7b257 100644 --- a/rfc7807/errors.go +++ b/rfc7807/errors.go @@ -232,4 +232,9 @@ var ( "Message queue is full", http.StatusInternalServerError, ) + FetchDownDatabase = newProblemID( + path.Join(errorEndpointsPrefix, "fetch-down-database"), + "Fetch information from a down database", + http.StatusInternalServerError, + ) ) diff --git a/vclusterops/fetch_node_state.go b/vclusterops/fetch_node_state.go index 41704a0..45d9646 100644 --- a/vclusterops/fetch_node_state.go +++ b/vclusterops/fetch_node_state.go @@ -14,6 +14,8 @@ type VFetchNodeStateOptions struct { // operations: NMAHealth and NMA readCatalogEditor. This is useful // when we cannot get the version for down nodes from a running database GetVersion bool + + SkipDownDatabase bool } func VFetchNodeStateOptionsFactory() VFetchNodeStateOptions { @@ -82,6 +84,10 @@ func (vcc VClusterCommands) VFetchNodeState(options *VFetchNodeStateOptions) ([] } } + if options.SkipDownDatabase { + return []NodeInfo{}, rfc7807.New(rfc7807.FetchDownDatabase) + } + return vcc.fetchNodeStateFromDownDB(options) } @@ -130,6 +136,10 @@ func (vcc VClusterCommands) VFetchNodeState(options *VFetchNodeStateOptions) ([] } if upNodeCount == 0 { + if options.SkipDownDatabase { + return []NodeInfo{}, rfc7807.New(rfc7807.FetchDownDatabase) + } + return vcc.fetchNodeStateFromDownDB(options) }