Skip to content
Snippets Groups Projects
Commit d7129d6b authored by Somtochi Onyekwere's avatar Somtochi Onyekwere
Browse files

Remove validation from sub-commands

parent 4a893b13
No related branches found
No related tags found
No related merge requests found
Showing with 1 addition and 48 deletions
......@@ -59,7 +59,7 @@ func init() {
name := args[0]
if !validateObjectName(name) {
return fmt.Errorf("name '%s' is invalid, it should adhere to standard defined in RFC 1123", name)
return fmt.Errorf("name '%s' is invalid, it should adhere to standard defined in RFC 1123, the name can only contain alphanumeric characters or '-'", name)
}
return nil
......
......@@ -63,9 +63,6 @@ func init() {
}
func createAlertCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("Alert name is required")
}
name := args[0]
if alertArgs.providerRef == "" {
......
......@@ -73,9 +73,6 @@ func init() {
}
func createAlertProviderCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("Provider name is required")
}
name := args[0]
if alertProviderArgs.alertType == "" {
......
......@@ -139,9 +139,6 @@ func init() {
}
func createHelmReleaseCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("HelmRelease name is required")
}
name := args[0]
if helmReleaseArgs.chart == "" {
......
......@@ -84,9 +84,6 @@ func (obj imagePolicyAdapter) getObservedGeneration() int64 {
}
func createImagePolicyRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("ImagePolicy name is required")
}
objectName := args[0]
if imagePolicyArgs.imageRef == "" {
......
......@@ -83,9 +83,6 @@ func init() {
}
func createImageRepositoryRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("ImageRepository name is required")
}
objectName := args[0]
if imageRepoArgs.image == "" {
......
......@@ -94,9 +94,6 @@ func init() {
}
func createImageUpdateRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("ImageUpdateAutomation name is required")
}
objectName := args[0]
if imageUpdateArgs.gitRepoName == "" {
......
......@@ -119,9 +119,6 @@ func NewKustomizationFlags() kustomizationFlags {
}
func createKsCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("Kustomization name is required")
}
name := args[0]
if kustomizationArgs.path == "" {
......
......@@ -67,9 +67,6 @@ func init() {
}
func createReceiverCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("Receiver name is required")
}
name := args[0]
if receiverArgs.receiverType == "" {
......
......@@ -112,9 +112,6 @@ func NewSecretGitFlags() secretGitFlags {
}
func createSecretGitCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("secret name is required")
}
name := args[0]
if secretGitArgs.url == "" {
return fmt.Errorf("url is required")
......
......@@ -18,7 +18,6 @@ package main
import (
"context"
"fmt"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
......@@ -68,9 +67,6 @@ func init() {
}
func createSecretHelmCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("secret name is required")
}
name := args[0]
labels, err := parseLabels()
......
......@@ -18,7 +18,6 @@ package main
import (
"context"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
......@@ -67,9 +66,6 @@ func init() {
}
func createSecretTLSCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("secret name is required")
}
name := args[0]
labels, err := parseLabels()
......
......@@ -93,9 +93,6 @@ func NewSourceBucketFlags() sourceBucketFlags {
}
func createSourceBucketCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("Bucket source name is required")
}
name := args[0]
if sourceBucketArgs.name == "" {
......
......@@ -150,9 +150,6 @@ func newSourceGitFlags() sourceGitFlags {
}
func createSourceGitCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("GitRepository source name is required")
}
name := args[0]
if sourceGitArgs.url == "" {
......
......@@ -91,9 +91,6 @@ func init() {
}
func createSourceHelmCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("HelmRepository source name is required")
}
name := args[0]
if sourceHelmArgs.url == "" {
......
......@@ -70,9 +70,6 @@ func init() {
}
func createTenantCmdRun(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("tenant name is required")
}
tenant := args[0]
if err := validation.IsQualifiedName(tenant); len(err) > 0 {
return fmt.Errorf("invalid tenant name '%s': %v", tenant, err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment