Skip to content

Commit

Permalink
#4: Argument --client-name shown as -- in error message
Browse files Browse the repository at this point in the history
- also fixes a typo in cce.go
  • Loading branch information
Jessé Moraes Braga committed Jan 25, 2023
1 parent c4aecbe commit ed400d6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
34 changes: 17 additions & 17 deletions src/argument_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import (
)

const (
envOsUsername string = "OS_USERNAME"
envOsPassword string = "OS_PASSWORD"
envOsDomainName string = "OS_DOMAIN_NAME"
envOsUserDomainId string = "OS_USER_DOMAIN_ID"
envOsProjectName string = "OS_PROJECT_NAME"
envIdpName string = "IDP_NAME"
envIdpUrl string = "IDP_URL"
envClientId string = "CLIENT_ID"
envClientSecret string = "CLIENT_SECRET"
envClusterName string = "CLUSTER_NAME"

authTypeIDP string = "idp"
authTypeIAM string = "iam"

protocolSAML string = "saml"
protocolOIDC string = "oidc"
envOsUsername = "OS_USERNAME"
envOsPassword = "OS_PASSWORD"
envOsDomainName = "OS_DOMAIN_NAME"
envOsUserDomainId = "OS_USER_DOMAIN_ID"
envOsProjectName = "OS_PROJECT_NAME"
envIdpName = "IDP_NAME"
envIdpUrl = "IDP_URL"
envClientId = "CLIENT_ID"
envClientSecret = "CLIENT_SECRET"
envClusterName = "CLUSTER_NAME"

authTypeIDP = "idp"
authTypeIAM = "iam"

protocolSAML = "saml"
protocolOIDC = "oidc"
)

func getProjectNameOrThrow(projectName string) string {
Expand All @@ -38,7 +38,7 @@ func getClusterNameOrThrow(clusterName string) string {
return clusterName
}

return getEnvironmentVariableOrThrow(clusterName, envClusterName)
return getEnvironmentVariableOrThrow(clusterArg, envClusterName)
}

func getIdpInfoOrThrow(provider string, url string) (string, string) {
Expand Down
2 changes: 1 addition & 1 deletion src/cce/cce.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func getClusterId(clusterName string, projectName string) (clusterId string, err
Id: cluster.Metadata.UID,
})
}
println(fmt.Sprintf("Clustes for project %s:\n%s", projectName, strings.Join(clusters.GetClusterNames(), ",\n")))
println(fmt.Sprintf("Clusters for project %s:\n%s", projectName, strings.Join(clusters.GetClusterNames(), ",\n")))

config.UpdateClusters(clusters)
cloud = config.GetActiveCloudConfig()
Expand Down
3 changes: 2 additions & 1 deletion src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
idpUrlArg = "idp-url"
clientIdArg = "client-id"
clientSecretArg = "client-secret"
clusterArg = "cluster"
)

func main() {
Expand Down Expand Up @@ -91,7 +92,7 @@ func main() {

// Get Kubernetes Configuration
getKubeConfigCommand := cceCommand.NewCommand("get-kube-config", "Get remote kube config and merge it with existing local config file.")
clusterName := getKubeConfigCommand.String("c", "cluster", &argparse.Options{Required: false, Help: fmt.Sprintf("Name of the cluster you want to access %s %s.", provideArgumentHelp, envClusterName)})
clusterName := getKubeConfigCommand.String("c", clusterArg, &argparse.Options{Required: false, Help: fmt.Sprintf("Name of the clusterArg you want to access %s %s.", provideArgumentHelp, envClusterName)})
daysValid := getKubeConfigCommand.String("v", "days-valid", &argparse.Options{Required: false, Help: "Period (in days) that the config will be valid", Default: "7"})

// AK/SK Management
Expand Down

0 comments on commit ed400d6

Please sign in to comment.