mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 08:57:17 +00:00
chore: enable unnecessary-format rule from revive (#26958)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
parent
9a19735918
commit
dce3f6e8a5
31 changed files with 87 additions and 85 deletions
|
|
@ -145,16 +145,19 @@ linters:
|
||||||
strconcat: true
|
strconcat: true
|
||||||
|
|
||||||
revive:
|
revive:
|
||||||
|
enable-all-rules: false
|
||||||
|
enable-default-rules: true
|
||||||
|
max-open-files: 2048
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
|
||||||
rules:
|
rules:
|
||||||
- name: bool-literal-in-expr
|
|
||||||
|
|
||||||
- name: blank-imports
|
- name: blank-imports
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|
||||||
|
- name: bool-literal-in-expr
|
||||||
|
|
||||||
- name: context-as-argument
|
- name: context-as-argument
|
||||||
arguments:
|
arguments:
|
||||||
- allowTypesBefore: '*testing.T,testing.TB'
|
- allow-types-before: '*testing.T,testing.TB'
|
||||||
|
|
||||||
- name: context-keys-type
|
- name: context-keys-type
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|
@ -166,14 +169,11 @@ linters:
|
||||||
|
|
||||||
- name: early-return
|
- name: early-return
|
||||||
arguments:
|
arguments:
|
||||||
- preserveScope
|
- preserve-scope
|
||||||
|
|
||||||
- name: empty-block
|
- name: empty-block
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|
||||||
- name: error-naming
|
|
||||||
disabled: true
|
|
||||||
|
|
||||||
- name: error-return
|
- name: error-return
|
||||||
|
|
||||||
- name: error-strings
|
- name: error-strings
|
||||||
|
|
@ -181,6 +181,9 @@ linters:
|
||||||
|
|
||||||
- name: errorf
|
- name: errorf
|
||||||
|
|
||||||
|
- name: exported
|
||||||
|
disabled: true
|
||||||
|
|
||||||
- name: identical-branches
|
- name: identical-branches
|
||||||
|
|
||||||
- name: if-return
|
- name: if-return
|
||||||
|
|
@ -189,7 +192,7 @@ linters:
|
||||||
|
|
||||||
- name: indent-error-flow
|
- name: indent-error-flow
|
||||||
arguments:
|
arguments:
|
||||||
- preserveScope
|
- preserve-scope
|
||||||
|
|
||||||
- name: modifies-parameter
|
- name: modifies-parameter
|
||||||
|
|
||||||
|
|
@ -206,7 +209,7 @@ linters:
|
||||||
|
|
||||||
- name: superfluous-else
|
- name: superfluous-else
|
||||||
arguments:
|
arguments:
|
||||||
- preserveScope
|
- preserve-scope
|
||||||
|
|
||||||
- name: time-equal
|
- name: time-equal
|
||||||
|
|
||||||
|
|
@ -216,6 +219,8 @@ linters:
|
||||||
- name: unexported-return
|
- name: unexported-return
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|
||||||
|
- name: unnecessary-format
|
||||||
|
|
||||||
- name: unnecessary-stmt
|
- name: unnecessary-stmt
|
||||||
|
|
||||||
- name: unreachable-code
|
- name: unreachable-code
|
||||||
|
|
@ -232,8 +237,8 @@ linters:
|
||||||
arguments:
|
arguments:
|
||||||
- - ID
|
- - ID
|
||||||
- - VM
|
- - VM
|
||||||
- - skipPackageNameChecks: true
|
- - skip-initialism-name-checks: true
|
||||||
upperCaseConst: true
|
upper-case-const: true
|
||||||
|
|
||||||
staticcheck:
|
staticcheck:
|
||||||
checks:
|
checks:
|
||||||
|
|
@ -255,7 +260,4 @@ linters:
|
||||||
usetesting:
|
usetesting:
|
||||||
os-mkdir-temp: false
|
os-mkdir-temp: false
|
||||||
|
|
||||||
output:
|
|
||||||
show-stats: false
|
|
||||||
|
|
||||||
version: "2"
|
version: "2"
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ has appropriate RBAC permissions to change other accounts.
|
||||||
|
|
||||||
_, err := usrIf.UpdatePassword(ctx, &updatePasswordRequest)
|
_, err := usrIf.UpdatePassword(ctx, &updatePasswordRequest)
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
fmt.Printf("Password updated\n")
|
fmt.Print("Password updated\n")
|
||||||
|
|
||||||
if account == "" || account == userInfo.Username {
|
if account == "" || account == userInfo.Username {
|
||||||
// Get a new JWT token after updating the password
|
// Get a new JWT token after updating the password
|
||||||
|
|
@ -254,7 +254,7 @@ func printAccountNames(accounts []*accountpkg.Account) {
|
||||||
|
|
||||||
func printAccountsTable(items []*accountpkg.Account) {
|
func printAccountsTable(items []*accountpkg.Account) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "NAME\tENABLED\tCAPABILITIES\n")
|
fmt.Fprint(w, "NAME\tENABLED\tCAPABILITIES\n")
|
||||||
for _, a := range items {
|
for _, a := range items {
|
||||||
fmt.Fprintf(w, "%s\t%v\t%s\n", a.Name, a.Enabled, strings.Join(a.Capabilities, ", "))
|
fmt.Fprintf(w, "%s\t%v\t%s\n", a.Name, a.Enabled, strings.Join(a.Capabilities, ", "))
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +356,7 @@ func printAccountDetails(acc *accountpkg.Account) {
|
||||||
fmt.Println("NONE")
|
fmt.Println("NONE")
|
||||||
} else {
|
} else {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "ID\tISSUED AT\tEXPIRING AT\n")
|
fmt.Fprint(w, "ID\tISSUED AT\tEXPIRING AT\n")
|
||||||
for _, t := range acc.Tokens {
|
for _, t := range acc.Tokens {
|
||||||
expiresAtFormatted := "never"
|
expiresAtFormatted := "never"
|
||||||
if t.ExpiresAt > 0 {
|
if t.ExpiresAt > 0 {
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ func printStatsSummary(clusters []ClusterWithInfo) {
|
||||||
|
|
||||||
avgResourcesByShard := totalResourcesCount / int64(len(resourcesCountByShard))
|
avgResourcesByShard := totalResourcesCount / int64(len(resourcesCountByShard))
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
_, _ = fmt.Fprintf(w, "SHARD\tRESOURCES COUNT\n")
|
_, _ = fmt.Fprint(w, "SHARD\tRESOURCES COUNT\n")
|
||||||
for shard := 0; shard < len(resourcesCountByShard); shard++ {
|
for shard := 0; shard < len(resourcesCountByShard); shard++ {
|
||||||
cnt := resourcesCountByShard[shard]
|
cnt := resourcesCountByShard[shard]
|
||||||
percent := (float64(cnt) / float64(avgResourcesByShard)) * 100.0
|
percent := (float64(cnt) / float64(avgResourcesByShard)) * 100.0
|
||||||
|
|
@ -318,7 +318,7 @@ func NewClusterNamespacesCommand() *cobra.Command {
|
||||||
|
|
||||||
err := runClusterNamespacesCommand(ctx, clientConfig, func(_ *versioned.Clientset, _ db.ArgoDB, clusters map[string][]string) error {
|
err := runClusterNamespacesCommand(ctx, clientConfig, func(_ *versioned.Clientset, _ db.ArgoDB, clusters map[string][]string) error {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
_, _ = fmt.Fprintf(w, "CLUSTER\tNAMESPACES\n")
|
_, _ = fmt.Fprint(w, "CLUSTER\tNAMESPACES\n")
|
||||||
|
|
||||||
for cluster, namespaces := range clusters {
|
for cluster, namespaces := range clusters {
|
||||||
// print shortest namespace names first
|
// print shortest namespace names first
|
||||||
|
|
@ -495,7 +495,7 @@ argocd admin cluster stats target-cluster`,
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
|
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
_, _ = fmt.Fprintf(w, "SERVER\tSHARD\tCONNECTION\tNAMESPACES COUNT\tAPPS COUNT\tRESOURCES COUNT\n")
|
_, _ = fmt.Fprint(w, "SERVER\tSHARD\tCONNECTION\tNAMESPACES COUNT\tAPPS COUNT\tRESOURCES COUNT\n")
|
||||||
for _, cluster := range clusters {
|
for _, cluster := range clusters {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%d\t%s\t%d\t%d\t%d\n", cluster.Server, cluster.Shard, cluster.Info.ConnectionState.Status, len(cluster.Namespaces), cluster.Info.ApplicationsCount, cluster.Info.CacheInfo.ResourcesCount)
|
_, _ = fmt.Fprintf(w, "%s\t%d\t%s\t%d\t%d\t%d\n", cluster.Server, cluster.Shard, cluster.Info.ConnectionState.Status, len(cluster.Namespaces), cluster.Info.ApplicationsCount, cluster.Info.CacheInfo.ResourcesCount)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ argocd admin settings validate --group accounts --group plugins --load-cluster-s
|
||||||
_, _ = fmt.Fprintf(os.Stdout, "%s\n", logs)
|
_, _ = fmt.Fprintf(os.Stdout, "%s\n", logs)
|
||||||
}
|
}
|
||||||
if i != len(groups)-1 {
|
if i != len(groups)-1 {
|
||||||
_, _ = fmt.Fprintf(os.Stdout, "\n")
|
_, _ = fmt.Fprint(os.Stdout, "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -429,7 +429,7 @@ argocd admin settings resource-overrides ignore-differences ./deploy.yaml --argo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = fmt.Printf("Following fields are ignored:\n\n")
|
_, _ = fmt.Print("Following fields are ignored:\n\n")
|
||||||
_ = cli.PrintDiff(res.GetName(), &res, normalizedRes)
|
_ = cli.PrintDiff(res.GetName(), &res, normalizedRes)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -476,7 +476,7 @@ argocd admin settings resource-overrides ignore-resource-updates ./deploy.yaml -
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = fmt.Printf("Following fields are ignored:\n\n")
|
_, _ = fmt.Print("Following fields are ignored:\n\n")
|
||||||
_ = cli.PrintDiff(res.GetName(), &res, normalizedRes)
|
_ = cli.PrintDiff(res.GetName(), &res, normalizedRes)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -551,7 +551,7 @@ argocd admin settings resource-overrides action list /tmp/deploy.yaml --argocd-c
|
||||||
})
|
})
|
||||||
|
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
_, _ = fmt.Fprintf(w, "NAME\tDISABLED\n")
|
_, _ = fmt.Fprint(w, "NAME\tDISABLED\n")
|
||||||
for _, action := range availableActions {
|
for _, action := range availableActions {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\n", action.Name, strconv.FormatBool(action.Disabled))
|
_, _ = fmt.Fprintf(w, "%s\t%s\n", action.Name, strconv.FormatBool(action.Disabled))
|
||||||
}
|
}
|
||||||
|
|
@ -622,7 +622,7 @@ argocd admin settings resource-overrides action /tmp/deploy.yaml restart --argoc
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _ = fmt.Printf("Following fields have been changed:\n\n")
|
_, _ = fmt.Print("Following fields have been changed:\n\n")
|
||||||
_ = cli.PrintDiff(res.GetName(), &res, result)
|
_ = cli.PrintDiff(res.GetName(), &res, result)
|
||||||
case lua.CreateOperation:
|
case lua.CreateOperation:
|
||||||
yamlBytes, err := yaml.Marshal(impactedResource.UnstructuredObj)
|
yamlBytes, err := yaml.Marshal(impactedResource.UnstructuredObj)
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ argocd admin settings rbac can someuser create application 'default/app' --defau
|
||||||
// Exactly one of --namespace or --policy-file must be given.
|
// Exactly one of --namespace or --policy-file must be given.
|
||||||
if (!nsOverride && policyFile == "") || (nsOverride && policyFile != "") {
|
if (!nsOverride && policyFile == "") || (nsOverride && policyFile != "") {
|
||||||
c.HelpFunc()(c, args)
|
c.HelpFunc()(c, args)
|
||||||
log.Fatalf("please provide exactly one of --policy-file or --namespace")
|
log.Fatal("please provide exactly one of --policy-file or --namespace")
|
||||||
}
|
}
|
||||||
|
|
||||||
restConfig, err := clientConfig.ClientConfig()
|
restConfig, err := clientConfig.ClientConfig()
|
||||||
|
|
@ -264,12 +264,12 @@ argocd admin settings rbac validate --namespace argocd
|
||||||
|
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
c.HelpFunc()(c, args)
|
c.HelpFunc()(c, args)
|
||||||
log.Fatalf("too many arguments")
|
log.Fatal("too many arguments")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (namespace == "" && policyFile == "") || (namespace != "" && policyFile != "") {
|
if (namespace == "" && policyFile == "") || (namespace != "" && policyFile != "") {
|
||||||
c.HelpFunc()(c, args)
|
c.HelpFunc()(c, args)
|
||||||
log.Fatalf("please provide exactly one of --policy-file or --namespace")
|
log.Fatal("please provide exactly one of --policy-file or --namespace")
|
||||||
}
|
}
|
||||||
|
|
||||||
restConfig, err := clientConfig.ClientConfig()
|
restConfig, err := clientConfig.ClientConfig()
|
||||||
|
|
@ -284,13 +284,13 @@ argocd admin settings rbac validate --namespace argocd
|
||||||
userPolicy, _, _ := getPolicy(ctx, policyFile, realClientset, namespace)
|
userPolicy, _, _ := getPolicy(ctx, policyFile, realClientset, namespace)
|
||||||
if userPolicy != "" {
|
if userPolicy != "" {
|
||||||
if err := rbac.ValidatePolicy(userPolicy); err == nil {
|
if err := rbac.ValidatePolicy(userPolicy); err == nil {
|
||||||
fmt.Printf("Policy is valid.\n")
|
fmt.Print("Policy is valid.\n")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
fmt.Printf("Policy is invalid: %v\n", err)
|
fmt.Printf("Policy is invalid: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
log.Fatalf("Policy is empty or could not be loaded.")
|
log.Fatal("Policy is empty or could not be loaded.")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
clientConfig = cli.AddKubectlFlagsToCmd(command)
|
clientConfig = cli.AddKubectlFlagsToCmd(command)
|
||||||
|
|
|
||||||
|
|
@ -757,7 +757,7 @@ func printAppSourceDetails(appSrc *argoappv1.ApplicationSource) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func printAppConditions(w io.Writer, app *argoappv1.Application) {
|
func printAppConditions(w io.Writer, app *argoappv1.Application) {
|
||||||
_, _ = fmt.Fprintf(w, "CONDITION\tMESSAGE\tLAST TRANSITION\n")
|
_, _ = fmt.Fprint(w, "CONDITION\tMESSAGE\tLAST TRANSITION\n")
|
||||||
for _, item := range app.Status.Conditions {
|
for _, item := range app.Status.Conditions {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\n", item.Type, item.Message, item.LastTransitionTime)
|
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\n", item.Type, item.Message, item.LastTransitionTime)
|
||||||
}
|
}
|
||||||
|
|
@ -829,7 +829,7 @@ func printHelmParams(helm *argoappv1.ApplicationSourceHelm) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
if helm != nil {
|
if helm != nil {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
_, _ = fmt.Fprintf(w, "NAME\tVALUE\n")
|
_, _ = fmt.Fprint(w, "NAME\tVALUE\n")
|
||||||
for _, p := range helm.Parameters {
|
for _, p := range helm.Parameters {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\n", p.Name, truncateString(p.Value, paramLenLimit))
|
_, _ = fmt.Fprintf(w, "%s\t%s\n", p.Name, truncateString(p.Value, paramLenLimit))
|
||||||
}
|
}
|
||||||
|
|
@ -1365,7 +1365,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
|
||||||
serverSideDiff = hasServerSideDiffAnnotation
|
serverSideDiff = hasServerSideDiffAnnotation
|
||||||
} else if serverSideDiff && !hasServerSideDiffAnnotation {
|
} else if serverSideDiff && !hasServerSideDiffAnnotation {
|
||||||
// Flag explicitly set to true, but app annotation is not set
|
// Flag explicitly set to true, but app annotation is not set
|
||||||
fmt.Fprintf(os.Stderr, "Warning: Application does not have ServerSideDiff=true annotation.\n")
|
fmt.Fprint(os.Stderr, "Warning: Application does not have ServerSideDiff=true annotation.\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server side diff with local requires server side generate to be set as there will be a mismatch with client-generated manifests.
|
// Server side diff with local requires server side generate to be set as there will be a mismatch with client-generated manifests.
|
||||||
|
|
@ -1418,7 +1418,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
|
||||||
|
|
||||||
diffOption.serversideRes = res
|
diffOption.serversideRes = res
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(os.Stderr, "Warning: local diff without --server-side-generate is deprecated and does not work with plugins. Server-side generation will be the default in v2.7.")
|
fmt.Fprint(os.Stderr, "Warning: local diff without --server-side-generate is deprecated and does not work with plugins. Server-side generation will be the default in v2.7.")
|
||||||
conn, clusterIf := clientset.NewClusterClientOrDie()
|
conn, clusterIf := clientset.NewClusterClientOrDie()
|
||||||
defer utilio.Close(conn)
|
defer utilio.Close(conn)
|
||||||
cluster, err := clusterIf.Get(ctx, &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
|
cluster, err := clusterIf.Get(ctx, &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
|
||||||
|
|
@ -2104,7 +2104,7 @@ func NewApplicationWaitCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
|
||||||
|
|
||||||
// printAppResources prints the resources of an application in a tabwriter table
|
// printAppResources prints the resources of an application in a tabwriter table
|
||||||
func printAppResources(w io.Writer, app *argoappv1.Application) {
|
func printAppResources(w io.Writer, app *argoappv1.Application) {
|
||||||
_, _ = fmt.Fprintf(w, "GROUP\tKIND\tNAMESPACE\tNAME\tSTATUS\tHEALTH\tHOOK\tMESSAGE\n")
|
_, _ = fmt.Fprint(w, "GROUP\tKIND\tNAMESPACE\tNAME\tSTATUS\tHEALTH\tHOOK\tMESSAGE\n")
|
||||||
for _, res := range getResourceStates(app, nil) {
|
for _, res := range getResourceStates(app, nil) {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", res.Group, res.Kind, res.Namespace, res.Name, res.Status, res.Health, res.Hook, res.Message)
|
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", res.Group, res.Kind, res.Namespace, res.Name, res.Status, res.Health, res.Hook, res.Message)
|
||||||
}
|
}
|
||||||
|
|
@ -2112,7 +2112,7 @@ func printAppResources(w io.Writer, app *argoappv1.Application) {
|
||||||
|
|
||||||
func printTreeView(nodeMapping map[string]argoappv1.ResourceNode, parentChildMapping map[string][]string, parentNodes map[string]struct{}, mapNodeNameToResourceState map[string]*resourceState) {
|
func printTreeView(nodeMapping map[string]argoappv1.ResourceNode, parentChildMapping map[string][]string, parentNodes map[string]struct{}, mapNodeNameToResourceState map[string]*resourceState) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
_, _ = fmt.Fprintf(w, "KIND/NAME\tSTATUS\tHEALTH\tMESSAGE\n")
|
_, _ = fmt.Fprint(w, "KIND/NAME\tSTATUS\tHEALTH\tMESSAGE\n")
|
||||||
for uid := range parentNodes {
|
for uid := range parentNodes {
|
||||||
treeViewAppGet("", nodeMapping, parentChildMapping, nodeMapping[uid], mapNodeNameToResourceState, w)
|
treeViewAppGet("", nodeMapping, parentChildMapping, nodeMapping[uid], mapNodeNameToResourceState, w)
|
||||||
}
|
}
|
||||||
|
|
@ -2121,7 +2121,7 @@ func printTreeView(nodeMapping map[string]argoappv1.ResourceNode, parentChildMap
|
||||||
|
|
||||||
func printTreeViewDetailed(nodeMapping map[string]argoappv1.ResourceNode, parentChildMapping map[string][]string, parentNodes map[string]struct{}, mapNodeNameToResourceState map[string]*resourceState) {
|
func printTreeViewDetailed(nodeMapping map[string]argoappv1.ResourceNode, parentChildMapping map[string][]string, parentNodes map[string]struct{}, mapNodeNameToResourceState map[string]*resourceState) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "KIND/NAME\tSTATUS\tHEALTH\tAGE\tMESSAGE\tREASON\n")
|
fmt.Fprint(w, "KIND/NAME\tSTATUS\tHEALTH\tAGE\tMESSAGE\tREASON\n")
|
||||||
for uid := range parentNodes {
|
for uid := range parentNodes {
|
||||||
detailedTreeViewAppGet("", nodeMapping, parentChildMapping, nodeMapping[uid], mapNodeNameToResourceState, w)
|
detailedTreeViewAppGet("", nodeMapping, parentChildMapping, nodeMapping[uid], mapNodeNameToResourceState, w)
|
||||||
}
|
}
|
||||||
|
|
@ -2453,7 +2453,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
|
||||||
|
|
||||||
foundDiffs = findAndPrintDiff(ctx, app, proj.Project, resources, argoSettings, diffOption, ignoreNormalizerOpts, serverSideDiff, appIf, appName, appNs, serverSideDiffConcurrency, serverSideDiffMaxBatchKB)
|
foundDiffs = findAndPrintDiff(ctx, app, proj.Project, resources, argoSettings, diffOption, ignoreNormalizerOpts, serverSideDiff, appIf, appName, appNs, serverSideDiffConcurrency, serverSideDiffMaxBatchKB)
|
||||||
if !foundDiffs {
|
if !foundDiffs {
|
||||||
fmt.Printf("====== No Differences found ======\n")
|
fmt.Print("====== No Differences found ======\n")
|
||||||
// if no differences found, then no need to sync
|
// if no differences found, then no need to sync
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -2973,7 +2973,7 @@ func setParameterOverrides(app *argoappv1.Application, parameters []string, sour
|
||||||
source.Helm.AddParameter(*newParam)
|
source.Helm.AddParameter(*newParam)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
log.Fatalf("Parameters can only be set against Helm applications")
|
log.Fatal("Parameters can only be set against Helm applications")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3028,13 +3028,13 @@ func printApplicationHistoryTable(revHistory []argoappv1.RevisionHistory) {
|
||||||
}
|
}
|
||||||
for i, key := range varHistoryKeys {
|
for i, key := range varHistoryKeys {
|
||||||
_, _ = fmt.Fprintf(w, "SOURCE\t%s\n", key)
|
_, _ = fmt.Fprintf(w, "SOURCE\t%s\n", key)
|
||||||
_, _ = fmt.Fprintf(w, "ID\tDATE\tREVISION\n")
|
_, _ = fmt.Fprint(w, "ID\tDATE\tREVISION\n")
|
||||||
for _, history := range varHistory[key] {
|
for _, history := range varHistory[key] {
|
||||||
_, _ = fmt.Fprintf(w, "%d\t%s\t%s\n", history.id, history.date, history.revision)
|
_, _ = fmt.Fprintf(w, "%d\t%s\t%s\n", history.id, history.date, history.revision)
|
||||||
}
|
}
|
||||||
// Add a newline if it's not the last iteration
|
// Add a newline if it's not the last iteration
|
||||||
if i < len(varHistoryKeys)-1 {
|
if i < len(varHistoryKeys)-1 {
|
||||||
_, _ = fmt.Fprintf(w, "\n")
|
_, _ = fmt.Fprint(w, "\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ = w.Flush()
|
_ = w.Flush()
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ func NewApplicationResourceActionsListCommand(clientOpts *argocdclient.ClientOpt
|
||||||
fmt.Println(string(jsonBytes))
|
fmt.Println(string(jsonBytes))
|
||||||
case "":
|
case "":
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "GROUP\tKIND\tNAME\tACTION\tDISABLED\n")
|
fmt.Fprint(w, "GROUP\tKIND\tNAME\tACTION\tDISABLED\n")
|
||||||
for _, action := range availableActions {
|
for _, action := range availableActions {
|
||||||
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", action.Group, action.Kind, action.Name, action.Action, strconv.FormatBool(action.Disabled))
|
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", action.Group, action.Kind, action.Name, action.Action, strconv.FormatBool(action.Disabled))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,9 +217,9 @@ func reconstructObject(extracted []any, fields []string, depth int) map[string]a
|
||||||
func printManifests(objs *[]unstructured.Unstructured, filteredFields bool, showName bool, output string) {
|
func printManifests(objs *[]unstructured.Unstructured, filteredFields bool, showName bool, output string) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
if showName {
|
if showName {
|
||||||
fmt.Fprintf(w, "FIELD\tRESOURCE NAME\tVALUE\n")
|
fmt.Fprint(w, "FIELD\tRESOURCE NAME\tVALUE\n")
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(w, "FIELD\tVALUE\n")
|
fmt.Fprint(w, "FIELD\tVALUE\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, o := range *objs {
|
for i, o := range *objs {
|
||||||
|
|
@ -479,7 +479,7 @@ func printResources(listAll bool, orphaned bool, appResourceTree *v1alpha1.Appli
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
switch output {
|
switch output {
|
||||||
case "tree=detailed":
|
case "tree=detailed":
|
||||||
fmt.Fprintf(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\tAGE\tHEALTH\tREASON\n")
|
fmt.Fprint(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\tAGE\tHEALTH\tREASON\n")
|
||||||
|
|
||||||
if !orphaned || listAll {
|
if !orphaned || listAll {
|
||||||
mapUIDToNode, mapParentToChild, parentNode := parentChildInfo(appResourceTree.Nodes)
|
mapUIDToNode, mapParentToChild, parentNode := parentChildInfo(appResourceTree.Nodes)
|
||||||
|
|
@ -491,7 +491,7 @@ func printResources(listAll bool, orphaned bool, appResourceTree *v1alpha1.Appli
|
||||||
printDetailedTreeViewAppResourcesOrphaned(mapUIDToNode, mapParentToChild, parentNode, w)
|
printDetailedTreeViewAppResourcesOrphaned(mapUIDToNode, mapParentToChild, parentNode, w)
|
||||||
}
|
}
|
||||||
case "tree":
|
case "tree":
|
||||||
fmt.Fprintf(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\n")
|
fmt.Fprint(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\n")
|
||||||
|
|
||||||
if !orphaned || listAll {
|
if !orphaned || listAll {
|
||||||
mapUIDToNode, mapParentToChild, parentNode := parentChildInfo(appResourceTree.Nodes)
|
mapUIDToNode, mapParentToChild, parentNode := parentChildInfo(appResourceTree.Nodes)
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ func NewApplicationSetCreateCommand(clientOpts *argocdclient.ClientOptions) *cob
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
|
|
||||||
if len(appsets) == 0 {
|
if len(appsets) == 0 {
|
||||||
fmt.Printf("No ApplicationSets found while parsing the input file")
|
fmt.Print("No ApplicationSets found while parsing the input file")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -271,7 +271,7 @@ func NewApplicationSetGenerateCommand(clientOpts *argocdclient.ClientOptions) *c
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
|
|
||||||
if len(appsets) != 1 {
|
if len(appsets) != 1 {
|
||||||
fmt.Printf("Input file must contain one ApplicationSet")
|
fmt.Print("Input file must contain one ApplicationSet")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
appset := appsets[0]
|
appset := appsets[0]
|
||||||
|
|
@ -544,7 +544,7 @@ func printAppSetSummaryTable(appSet *arogappsetv1.ApplicationSet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func printAppSetConditions(w io.Writer, appSet *arogappsetv1.ApplicationSet) {
|
func printAppSetConditions(w io.Writer, appSet *arogappsetv1.ApplicationSet) {
|
||||||
_, _ = fmt.Fprintf(w, "CONDITION\tSTATUS\tMESSAGE\tLAST TRANSITION\n")
|
_, _ = fmt.Fprint(w, "CONDITION\tSTATUS\tMESSAGE\tLAST TRANSITION\n")
|
||||||
for _, item := range appSet.Status.Conditions {
|
for _, item := range appSet.Status.Conditions {
|
||||||
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", item.Type, item.Status, item.Message, item.LastTransitionTime)
|
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", item.Type, item.Status, item.Message, item.LastTransitionTime)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ func NewCertListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
|
||||||
// Print table of certificate info
|
// Print table of certificate info
|
||||||
func printCertTable(certs []appsv1.RepositoryCertificate, sortOrder string) {
|
func printCertTable(certs []appsv1.RepositoryCertificate, sortOrder string) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "HOSTNAME\tTYPE\tSUBTYPE\tINFO\n")
|
fmt.Fprint(w, "HOSTNAME\tTYPE\tSUBTYPE\tINFO\n")
|
||||||
|
|
||||||
switch sortOrder {
|
switch sortOrder {
|
||||||
case "hostname", "":
|
case "hostname", "":
|
||||||
|
|
|
||||||
|
|
@ -377,15 +377,15 @@ func formatNamespaces(cluster argoappv1.Cluster) string {
|
||||||
|
|
||||||
func printClusterDetails(clusters []argoappv1.Cluster) {
|
func printClusterDetails(clusters []argoappv1.Cluster) {
|
||||||
for _, cluster := range clusters {
|
for _, cluster := range clusters {
|
||||||
fmt.Printf("Cluster information\n\n")
|
fmt.Print("Cluster information\n\n")
|
||||||
fmt.Printf(" Server URL: %s\n", cluster.Server)
|
fmt.Printf(" Server URL: %s\n", cluster.Server)
|
||||||
fmt.Printf(" Server Name: %s\n", strWithDefault(cluster.Name, "-"))
|
fmt.Printf(" Server Name: %s\n", strWithDefault(cluster.Name, "-"))
|
||||||
fmt.Printf(" Server Version: %s\n", cluster.Info.ServerVersion)
|
fmt.Printf(" Server Version: %s\n", cluster.Info.ServerVersion)
|
||||||
fmt.Printf(" Namespaces: %s\n", formatNamespaces(cluster))
|
fmt.Printf(" Namespaces: %s\n", formatNamespaces(cluster))
|
||||||
fmt.Printf("\nTLS configuration\n\n")
|
fmt.Print("\nTLS configuration\n\n")
|
||||||
fmt.Printf(" Client cert: %v\n", len(cluster.Config.CertData) != 0)
|
fmt.Printf(" Client cert: %v\n", len(cluster.Config.CertData) != 0)
|
||||||
fmt.Printf(" Cert validation: %v\n", !cluster.Config.Insecure)
|
fmt.Printf(" Cert validation: %v\n", !cluster.Config.Insecure)
|
||||||
fmt.Printf("\nAuthentication\n\n")
|
fmt.Print("\nAuthentication\n\n")
|
||||||
fmt.Printf(" Basic authentication: %v\n", cluster.Config.Username != "")
|
fmt.Printf(" Basic authentication: %v\n", cluster.Config.Username != "")
|
||||||
fmt.Printf(" oAuth authentication: %v\n", cluster.Config.BearerToken != "")
|
fmt.Printf(" oAuth authentication: %v\n", cluster.Config.BearerToken != "")
|
||||||
fmt.Printf(" AWS authentication: %v\n", cluster.Config.AWSAuthConfig != nil)
|
fmt.Printf(" AWS authentication: %v\n", cluster.Config.AWSAuthConfig != nil)
|
||||||
|
|
@ -468,7 +468,7 @@ argocd cluster rm cluster-name`,
|
||||||
// Print table of cluster information
|
// Print table of cluster information
|
||||||
func printClusterTable(clusters []argoappv1.Cluster) {
|
func printClusterTable(clusters []argoappv1.Cluster) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
_, _ = fmt.Fprintf(w, "SERVER\tNAME\tVERSION\tSTATUS\tMESSAGE\tPROJECT\n")
|
_, _ = fmt.Fprint(w, "SERVER\tNAME\tVERSION\tSTATUS\tMESSAGE\tPROJECT\n")
|
||||||
for _, c := range clusters {
|
for _, c := range clusters {
|
||||||
server := c.Server
|
server := c.Server
|
||||||
if len(c.Namespaces) > 0 {
|
if len(c.Namespaces) > 0 {
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ func NewGPGAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
|
||||||
if len(resp.Skipped) > 0 {
|
if len(resp.Skipped) > 0 {
|
||||||
fmt.Printf(", and %d key(s) were skipped because they exist already", len(resp.Skipped))
|
fmt.Printf(", and %d key(s) were skipped because they exist already", len(resp.Skipped))
|
||||||
}
|
}
|
||||||
fmt.Printf(".\n")
|
fmt.Print(".\n")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
command.Flags().StringVarP(&fromFile, "from", "f", "", "Path to the file that contains the GPG public key to import")
|
command.Flags().StringVarP(&fromFile, "from", "f", "", "Path to the file that contains the GPG public key to import")
|
||||||
|
|
@ -192,7 +192,7 @@ func NewGPGDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command
|
||||||
// Print table of certificate info
|
// Print table of certificate info
|
||||||
func printKeyTable(keys []appsv1.GnuPGPublicKey) {
|
func printKeyTable(keys []appsv1.GnuPGPublicKey) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "KEYID\tTYPE\tIDENTITY\n")
|
fmt.Fprint(w, "KEYID\tTYPE\tIDENTITY\n")
|
||||||
|
|
||||||
for _, k := range keys {
|
for _, k := range keys {
|
||||||
fmt.Fprintf(w, "%s\t%s\t%s\n", k.KeyID, strings.ToUpper(k.SubType), k.Owner)
|
fmt.Fprintf(w, "%s\t%s\t%s\n", k.KeyID, strings.ToUpper(k.SubType), k.Owner)
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ func oauth2Login(
|
||||||
// flow where the id_token is contained in a URL fragment, making it inaccessible to be
|
// flow where the id_token is contained in a URL fragment, making it inaccessible to be
|
||||||
// read from the request. This javascript will redirect the browser to send the
|
// read from the request. This javascript will redirect the browser to send the
|
||||||
// fragments as query parameters so our callback handler can read and return token.
|
// fragments as query parameters so our callback handler can read and return token.
|
||||||
fmt.Fprintf(w, `<script>window.location.search = window.location.hash.substring(1)</script>`)
|
fmt.Fprint(w, `<script>window.location.search = window.location.hash.substring(1)</script>`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ func oauth2Login(
|
||||||
if errMsg != "" {
|
if errMsg != "" {
|
||||||
log.Fatal(errMsg)
|
log.Fatal(errMsg)
|
||||||
}
|
}
|
||||||
fmt.Printf("Authentication successful\n")
|
fmt.Print("Authentication successful\n")
|
||||||
ctx, cancel := context.WithTimeout(ctx, 1*time.Second)
|
ctx, cancel := context.WithTimeout(ctx, 1*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_ = srv.Shutdown(ctx)
|
_ = srv.Shutdown(ctx)
|
||||||
|
|
@ -375,7 +375,7 @@ func passwordLogin(ctx context.Context, acdClient argocdclient.Client, username,
|
||||||
|
|
||||||
func ssoAuthFlow(url string, ssoLaunchBrowser bool) {
|
func ssoAuthFlow(url string, ssoLaunchBrowser bool) {
|
||||||
if ssoLaunchBrowser {
|
if ssoLaunchBrowser {
|
||||||
fmt.Printf("Opening system default browser for authentication\n")
|
fmt.Print("Opening system default browser for authentication\n")
|
||||||
err := open.Start(url)
|
err := open.Start(url)
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ argocd logout cd.argoproj.io
|
||||||
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
|
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
|
||||||
errutil.CheckError(err)
|
errutil.CheckError(err)
|
||||||
if localCfg == nil {
|
if localCfg == nil {
|
||||||
log.Fatalf("Nothing to logout from")
|
log.Fatal("Nothing to logout from")
|
||||||
}
|
}
|
||||||
|
|
||||||
promptUtil := utils.NewPrompt(clientOpts.PromptsEnabled)
|
promptUtil := utils.NewPrompt(clientOpts.PromptsEnabled)
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,7 @@ func NewProjectAddSourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.C
|
||||||
|
|
||||||
for _, item := range proj.Spec.SourceRepos {
|
for _, item := range proj.Spec.SourceRepos {
|
||||||
if item == "*" {
|
if item == "*" {
|
||||||
fmt.Printf("Source repository '*' already allowed in project\n")
|
fmt.Print("Source repository '*' already allowed in project\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if git.SameURL(item, url) {
|
if git.SameURL(item, url) {
|
||||||
|
|
@ -535,7 +535,7 @@ func NewProjectAddSourceNamespace(clientOpts *argocdclient.ClientOptions) *cobra
|
||||||
|
|
||||||
for _, item := range proj.Spec.SourceNamespaces {
|
for _, item := range proj.Spec.SourceNamespaces {
|
||||||
if item == "*" || item == srcNamespace {
|
if item == "*" || item == srcNamespace {
|
||||||
fmt.Printf("Source namespace '*' already allowed in project\n")
|
fmt.Print("Source namespace '*' already allowed in project\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -868,7 +868,7 @@ func printProjectNames(projects []v1alpha1.AppProject) {
|
||||||
// Print table of project info
|
// Print table of project info
|
||||||
func printProjectTable(projects []v1alpha1.AppProject) {
|
func printProjectTable(projects []v1alpha1.AppProject) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "NAME\tDESCRIPTION\tDESTINATIONS\tSOURCES\tCLUSTER-RESOURCE-WHITELIST\tNAMESPACE-RESOURCE-BLACKLIST\tSIGNATURE-KEYS\tORPHANED-RESOURCES\tDESTINATION-SERVICE-ACCOUNTS\n")
|
fmt.Fprint(w, "NAME\tDESCRIPTION\tDESTINATIONS\tSOURCES\tCLUSTER-RESOURCE-WHITELIST\tNAMESPACE-RESOURCE-BLACKLIST\tSIGNATURE-KEYS\tORPHANED-RESOURCES\tDESTINATION-SERVICE-ACCOUNTS\n")
|
||||||
for _, p := range projects {
|
for _, p := range projects {
|
||||||
printProjectLine(w, &p)
|
printProjectLine(w, &p)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ fa9d3517-c52d-434c-9bff-215b38508842 2023-10-08T11:08:18+01:00 Never
|
||||||
}
|
}
|
||||||
|
|
||||||
writer := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0)
|
writer := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0)
|
||||||
_, err = fmt.Fprintf(writer, "ID\tISSUED AT\tEXPIRES AT\n")
|
_, err = fmt.Fprint(writer, "ID\tISSUED AT\tEXPIRES AT\n")
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
|
|
||||||
tokenRowFormat := "%s\t%v\t%v\n"
|
tokenRowFormat := "%s\t%v\t%v\n"
|
||||||
|
|
@ -515,7 +515,7 @@ func printProjectRoleListName(roles []v1alpha1.ProjectRole) {
|
||||||
// Print table of project roles
|
// Print table of project roles
|
||||||
func printProjectRoleListTable(roles []v1alpha1.ProjectRole) {
|
func printProjectRoleListTable(roles []v1alpha1.ProjectRole) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "ROLE-NAME\tDESCRIPTION\n")
|
fmt.Fprint(w, "ROLE-NAME\tDESCRIPTION\n")
|
||||||
for _, role := range roles {
|
for _, role := range roles {
|
||||||
fmt.Fprintf(w, "%s\t%s\n", role.Name, role.Description)
|
fmt.Fprintf(w, "%s\t%s\n", role.Name, role.Description)
|
||||||
}
|
}
|
||||||
|
|
@ -603,9 +603,9 @@ ID ISSUED-AT EXPIRES-AT
|
||||||
printRoleFmtStr := "%-15s%s\n"
|
printRoleFmtStr := "%-15s%s\n"
|
||||||
fmt.Printf(printRoleFmtStr, "Role Name:", roleName)
|
fmt.Printf(printRoleFmtStr, "Role Name:", roleName)
|
||||||
fmt.Printf(printRoleFmtStr, "Description:", role.Description)
|
fmt.Printf(printRoleFmtStr, "Description:", role.Description)
|
||||||
fmt.Printf("Policies:\n")
|
fmt.Print("Policies:\n")
|
||||||
fmt.Printf("%s\n", proj.ProjectPoliciesString())
|
fmt.Printf("%s\n", proj.ProjectPoliciesString())
|
||||||
fmt.Printf("Groups:\n")
|
fmt.Print("Groups:\n")
|
||||||
// if the group exists in the role
|
// if the group exists in the role
|
||||||
// range over each group and print it
|
// range over each group and print it
|
||||||
if v1alpha1.RoleGroupExists(role) {
|
if v1alpha1.RoleGroupExists(role) {
|
||||||
|
|
@ -615,9 +615,9 @@ ID ISSUED-AT EXPIRES-AT
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("<none>")
|
fmt.Println("<none>")
|
||||||
}
|
}
|
||||||
fmt.Printf("JWT Tokens:\n")
|
fmt.Print("JWT Tokens:\n")
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "ID\tISSUED-AT\tEXPIRES-AT\n")
|
fmt.Fprint(w, "ID\tISSUED-AT\tEXPIRES-AT\n")
|
||||||
for _, token := range proj.Status.JWTTokensByRole[roleName].Items {
|
for _, token := range proj.Status.JWTTokensByRole[roleName].Items {
|
||||||
expiresAt := "<none>"
|
expiresAt := "<none>"
|
||||||
if token.ExpiresAt > 0 {
|
if token.ExpiresAt > 0 {
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ argocd proj windows delete new-project 1`,
|
||||||
_, err = projIf.Update(ctx, &projectpkg.ProjectUpdateRequest{Project: proj})
|
_, err = projIf.Update(ctx, &projectpkg.ProjectUpdateRequest{Project: proj})
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("The command to delete the sync window was cancelled\n")
|
fmt.Print("The command to delete the sync window was cancelled\n")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ func NewReloginCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
|
||||||
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
|
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
if localCfg == nil {
|
if localCfg == nil {
|
||||||
log.Fatalf("No context found. Login using `argocd login`")
|
log.Fatal("No context found. Login using `argocd login`")
|
||||||
}
|
}
|
||||||
configCtx, err := localCfg.ResolveContext(localCfg.CurrentContext)
|
configCtx, err := localCfg.ResolveContext(localCfg.CurrentContext)
|
||||||
errors.CheckError(err)
|
errors.CheckError(err)
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command
|
||||||
// Print table of repo info
|
// Print table of repo info
|
||||||
func printRepoTable(repos appsv1.Repositories) {
|
func printRepoTable(repos appsv1.Repositories) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
_, _ = fmt.Fprintf(w, "TYPE\tNAME\tREPO\tINSECURE\tOCI\tLFS\tCREDS\tSTATUS\tMESSAGE\tPROJECT\n")
|
_, _ = fmt.Fprint(w, "TYPE\tNAME\tREPO\tINSECURE\tOCI\tLFS\tCREDS\tSTATUS\tMESSAGE\tPROJECT\n")
|
||||||
for _, r := range repos {
|
for _, r := range repos {
|
||||||
var hasCreds string
|
var hasCreds string
|
||||||
if r.InheritedCreds {
|
if r.InheritedCreds {
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ func NewRepoCredsRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
|
||||||
// Print the repository credentials as table
|
// Print the repository credentials as table
|
||||||
func printRepoCredsTable(repos []appsv1.RepoCreds) {
|
func printRepoCredsTable(repos []appsv1.RepoCreds) {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
|
||||||
fmt.Fprintf(w, "URL PATTERN\tUSERNAME\tSSH_CREDS\tTLS_CREDS\n")
|
fmt.Fprint(w, "URL PATTERN\tUSERNAME\tSSH_CREDS\tTLS_CREDS\n")
|
||||||
for _, r := range repos {
|
for _, r := range repos {
|
||||||
if r.Username == "" {
|
if r.Username == "" {
|
||||||
r.Username = "-"
|
r.Username = "-"
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ func SetParameterOverrides(app *argoappv1.Application, parameters []string, inde
|
||||||
source.Helm.AddParameter(*newParam)
|
source.Helm.AddParameter(*newParam)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
log.Fatalf("Parameters can only be set against Helm applications")
|
log.Fatal("Parameters can only be set against Helm applications")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ func TestReadAppSet(t *testing.T) {
|
||||||
var appSets []*argoprojiov1alpha1.ApplicationSet
|
var appSets []*argoprojiov1alpha1.ApplicationSet
|
||||||
err := readAppset([]byte(appSet), &appSets)
|
err := readAppset([]byte(appSet), &appSets)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf("Failed reading appset file")
|
t.Log("Failed reading appset file")
|
||||||
}
|
}
|
||||||
assert.Len(t, appSets, 1)
|
assert.Len(t, appSets, 1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ func (generator *ApplicationGenerator) Generate(opts *util.GenerateOpts) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("Pick destination %q", destination)
|
log.Printf("Pick destination %q", destination)
|
||||||
log.Printf("Create application")
|
log.Print("Create application")
|
||||||
_, err = applications.Create(context.TODO(), &v1alpha1.Application{
|
_, err = applications.Create(context.TODO(), &v1alpha1.Application{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
GenerateName: "application-",
|
GenerateName: "application-",
|
||||||
|
|
@ -105,7 +105,7 @@ func (generator *ApplicationGenerator) Generate(opts *util.GenerateOpts) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (generator *ApplicationGenerator) Clean(opts *util.GenerateOpts) error {
|
func (generator *ApplicationGenerator) Clean(opts *util.GenerateOpts) error {
|
||||||
log.Printf("Clean applications")
|
log.Print("Clean applications")
|
||||||
applications := generator.argoClientSet.ArgoprojV1alpha1().Applications(opts.Namespace)
|
applications := generator.argoClientSet.ArgoprojV1alpha1().Applications(opts.Namespace)
|
||||||
return applications.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
|
return applications.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
|
||||||
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
|
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ func (cg *ClusterGenerator) Generate(opts *util.GenerateOpts) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cg *ClusterGenerator) Clean(opts *util.GenerateOpts) error {
|
func (cg *ClusterGenerator) Clean(opts *util.GenerateOpts) error {
|
||||||
log.Printf("Clean clusters")
|
log.Print("Clean clusters")
|
||||||
namespaces, err := cg.clientSet.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
|
namespaces, err := cg.clientSet.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ func (pg *ProjectGenerator) Generate(opts *util.GenerateOpts) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pg *ProjectGenerator) Clean(opts *util.GenerateOpts) error {
|
func (pg *ProjectGenerator) Clean(opts *util.GenerateOpts) error {
|
||||||
log.Printf("Clean projects")
|
log.Print("Clean projects")
|
||||||
projects := pg.clientSet.ArgoprojV1alpha1().AppProjects(opts.Namespace)
|
projects := pg.clientSet.ArgoprojV1alpha1().AppProjects(opts.Namespace)
|
||||||
return projects.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
|
return projects.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
|
||||||
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
|
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ func (rg *RepoGenerator) Generate(opts *util.GenerateOpts) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rg *RepoGenerator) Clean(opts *util.GenerateOpts) error {
|
func (rg *RepoGenerator) Clean(opts *util.GenerateOpts) error {
|
||||||
log.Printf("Clean repos")
|
log.Print("Clean repos")
|
||||||
secrets := rg.clientSet.CoreV1().Secrets(opts.Namespace)
|
secrets := rg.clientSet.CoreV1().Secrets(opts.Namespace)
|
||||||
return secrets.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
|
return secrets.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
|
||||||
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
|
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ func TestHandlerConstructLogoutURL(t *testing.T) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
t.Errorf("expected error but did not get one")
|
t.Error("expected error but did not get one")
|
||||||
} else {
|
} else {
|
||||||
require.Equal(t, tt.expectedLogoutURL, tt.responseRecorder.Result().Header["Location"][0])
|
require.Equal(t, tt.expectedLogoutURL, tt.responseRecorder.Result().Header["Location"][0])
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ func TestManagedByURLFallbackToCurrentInstance(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !found {
|
if !found {
|
||||||
t.Logf("Returned links:")
|
t.Log("Returned links:")
|
||||||
for _, link := range links.Items {
|
for _, link := range links.Items {
|
||||||
if link.Url != nil {
|
if link.Url != nil {
|
||||||
t.Logf("- %s", *link.Url)
|
t.Logf("- %s", *link.Url)
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ func TestSetLogFormat(t *testing.T) {
|
||||||
if errors.As(err, &e) {
|
if errors.As(err, &e) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.Fatalf("expected fatal exit for invalid log format")
|
t.Fatal("expected fatal exit for invalid log format")
|
||||||
} else {
|
} else {
|
||||||
SetLogFormat(tt.logFormat)
|
SetLogFormat(tt.logFormat)
|
||||||
assert.Equal(t, tt.expected, os.Getenv(common.EnvLogFormat))
|
assert.Equal(t, tt.expected, os.Getenv(common.EnvLogFormat))
|
||||||
|
|
|
||||||
|
|
@ -719,7 +719,7 @@ entries: {}
|
||||||
|
|
||||||
// Should succeed because our implementation sets User-Agent
|
// Should succeed because our implementation sets User-Agent
|
||||||
require.NoError(t, err, "Request should succeed with User-Agent set")
|
require.NoError(t, err, "Request should succeed with User-Agent set")
|
||||||
t.Logf("Success! Server accepted request with User-Agent")
|
t.Log("Success! Server accepted request with User-Agent")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ func getTLSConfigCustomizer(minVersionStr, maxVersionStr, tlsCiphersStr string)
|
||||||
}
|
}
|
||||||
|
|
||||||
if tlsCiphersStr == "list" {
|
if tlsCiphersStr == "list" {
|
||||||
fmt.Printf("Supported TLS ciphers:\n")
|
fmt.Print("Supported TLS ciphers:\n")
|
||||||
for _, s := range tls.CipherSuites() {
|
for _, s := range tls.CipherSuites() {
|
||||||
fmt.Printf("* %s (TLS versions: %s)\n", tls.CipherSuiteName(s.ID), strings.Join(tlsVersionsToStr(s.SupportedVersions), ", "))
|
fmt.Printf("* %s (TLS versions: %s)\n", tls.CipherSuiteName(s.ID), strings.Join(tlsVersionsToStr(s.SupportedVersions), ", "))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue