From 73b8a26850058782b305c94358d8858edf307124 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Fri, 12 Feb 2021 15:51:05 +0100 Subject: [PATCH] Validate if only 1 image policy selector is given Signed-off-by: Hidde Beydals --- cmd/flux/create_image_policy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/flux/create_image_policy.go b/cmd/flux/create_image_policy.go index 13fd35d0..fdb1b42d 100644 --- a/cmd/flux/create_image_policy.go +++ b/cmd/flux/create_image_policy.go @@ -102,7 +102,9 @@ func createImagePolicyRun(cmd *cobra.Command, args []string) error { switch { case imagePolicyArgs.semver != "" && imagePolicyArgs.alpha != "": - return fmt.Errorf("policy cannot be specified with both --select-semver and --select-alpha") + case imagePolicyArgs.semver != "" && imagePolicyArgs.numeric != "": + case imagePolicyArgs.alpha != "" && imagePolicyArgs.numeric != "": + return fmt.Errorf("only one of --select-semver, --select-alpha or --select-numeric can be specified") case imagePolicyArgs.semver != "": policy.Spec.Policy.SemVer = &imagev1.SemVerPolicy{ Range: imagePolicyArgs.semver,