getClusterUUID returns the cluster UUID. rosmar does not have a ClusterUUID, so this will return an empty cluster UUID and no error in this case.
(ctx context.Context)
| 2308 | |
| 2309 | // getClusterUUID returns the cluster UUID. rosmar does not have a ClusterUUID, so this will return an empty cluster UUID and no error in this case. |
| 2310 | func (sc *ServerContext) getClusterUUID(ctx context.Context) (string, error) { |
| 2311 | allDbNames := sc.AllDatabaseNames() |
| 2312 | // we can use db context to retrieve clusterUUID |
| 2313 | if len(allDbNames) > 0 { |
| 2314 | db, err := sc.GetDatabase(ctx, allDbNames[0]) |
| 2315 | if err == nil { |
| 2316 | return db.ServerUUID, nil |
| 2317 | } |
| 2318 | } |
| 2319 | // no cluster uuid for rosmar cluster |
| 2320 | if base.ServerIsWalrus(sc.Config.Bootstrap.Server) { |
| 2321 | return "", nil |
| 2322 | } |
| 2323 | // request server for cluster uuid |
| 2324 | eps, client, err := sc.ObtainManagementEndpointsAndHTTPClient() |
| 2325 | if err != nil { |
| 2326 | return "", err |
| 2327 | } |
| 2328 | statusCode, output, err := doHTTPAuthRequest(ctx, client, sc.Config.Bootstrap.Username, sc.Config.Bootstrap.Password, http.MethodGet, "/pools", eps, nil) |
| 2329 | if err != nil { |
| 2330 | return "", err |
| 2331 | } |
| 2332 | if statusCode != http.StatusOK { |
| 2333 | return "", fmt.Errorf("unable to get cluster UUID from server: %s", output) |
| 2334 | } |
| 2335 | return base.ParseClusterUUID(output) |
| 2336 | } |
| 2337 | |
| 2338 | func (sc *ServerContext) getBucketCCVSettings() map[string]bool { |
| 2339 | bucketCCVSettings := make(map[string]bool) |
no test coverage detected