Error out from support diag if cluster not registered (#3970)

If user tries to run `mc support diag` for a cluster that is not yet
registered, error out asking the user to register the cluster first.
This commit is contained in:
Shireesh Anjal
2022-02-11 09:28:15 -08:00
committed by GitHub
parent 9b6f6cdbb4
commit 5d50c9beb9
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ func configureSubnetWebhook(aliasedURL string, enable bool) {
apiKey := getSubnetAPIKeyFromConfig(alias)
if len(apiKey) == 0 {
e := fmt.Errorf("Please register the cluster first by running 'mc admin subnet register %s'", alias)
e := fmt.Errorf("Please register the cluster first by running 'mc support register %s'", alias)
fatalIf(probe.NewError(e), "Cluster not registered.")
}
+5
View File
@@ -299,6 +299,11 @@ func prepareDiagUploadURL(alias string, clusterName string, filename string, lic
if len(apiKey) == 0 {
license = getSubnetLicenseFromConfig(alias)
if len(license) == 0 {
// Both api key and license not available. Ask user to register the cluster first
e := fmt.Errorf("Please register the cluster first by running 'mc support register %s', or use --airgap flag", alias)
fatalIf(probe.NewError(e), "Cluster not registered.")
}
}
}