diff --git a/cmd/license-register.go b/cmd/license-register.go index e6525fdf..76a5faf4 100644 --- a/cmd/license-register.go +++ b/cmd/license-register.go @@ -170,13 +170,18 @@ func mainLicenseRegister(ctx *cli.Context) error { regInfo := getClusterRegInfo(getAdminInfo(aliasedURL), clusterName) alreadyRegistered := false - apiKey, _, e := getSubnetCreds(alias) - fatalIf(probe.NewError(e), "Error in fetching subnet API Key") - if len(apiKey) > 0 { - alreadyRegistered = true - if len(accAPIKey) == 0 { + if len(accAPIKey) == 0 { + apiKey, _, e := getSubnetCreds(alias) + fatalIf(probe.NewError(e), "Error in fetching subnet API Key") + if len(apiKey) > 0 { + alreadyRegistered = true accAPIKey = apiKey } + } else { + apiKey := getSubnetAPIKeyFromConfig(alias) + if len(apiKey) > 0 { + alreadyRegistered = true + } } lrm := licRegisterMessage{Status: "success", Alias: alias} @@ -189,7 +194,7 @@ func mainLicenseRegister(ctx *cli.Context) error { lrm.URL = subnetOfflineRegisterURL(regToken) } else { lrm.Type = "online" - _, _, e = registerClusterOnSubnet(regInfo, alias, accAPIKey) + _, _, e := registerClusterOnSubnet(regInfo, alias, accAPIKey) fatalIf(probe.NewError(e), "Could not register cluster with SUBNET:") lrm.Action = "registered"