From commits-return-70373-archive-asf-public=cust-asf.ponee.io@camel.apache.org Sun Mar 3 14:05:29 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1936F180630 for ; Sun, 3 Mar 2019 15:05:28 +0100 (CET) Received: (qmail 64736 invoked by uid 500); 3 Mar 2019 14:05:28 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 64726 invoked by uid 99); 3 Mar 2019 14:05:28 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Mar 2019 14:05:28 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id A83B087752; Sun, 3 Mar 2019 14:05:27 +0000 (UTC) Date: Sun, 03 Mar 2019 14:05:27 +0000 To: "commits@camel.apache.org" Subject: [camel-k] branch master updated: Fixes #515 Allow file names as delete cmd argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155162192749.3964.10832859101142409930@gitbox.apache.org> From: acosentino@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: camel-k X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 56cad33cfb8249a56f4e7b41ba79e868a14e10c1 X-Git-Newrev: efffb00a3da4e95d4a39facda58d8baabc854140 X-Git-Rev: efffb00a3da4e95d4a39facda58d8baabc854140 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git The following commit(s) were added to refs/heads/master by this push: new efffb00 Fixes #515 Allow file names as delete cmd argument new d530b04 Merge pull request #522 from christophd/fix/515/allow-filename-argument efffb00 is described below commit efffb00a3da4e95d4a39facda58d8baabc854140 Author: Christoph Deppisch AuthorDate: Sun Mar 3 14:52:23 2019 +0100 Fixes #515 Allow file names as delete cmd argument --- pkg/cmd/delete.go | 9 +++++---- pkg/util/kubernetes/sanitize_test.go | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/delete.go b/pkg/cmd/delete.go index 560b91e..a56eaee 100644 --- a/pkg/cmd/delete.go +++ b/pkg/cmd/delete.go @@ -23,6 +23,7 @@ import ( "strconv" "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" + "github.com/apache/camel-k/pkg/util/kubernetes" "github.com/spf13/cobra" k8errors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -77,16 +78,16 @@ func (command *deleteCmdOptions) run(args []string) error { } if len(args) != 0 && !command.deleteAll { for _, arg := range args { - - err := DeleteIntegration(command.Context, c, arg, command.Namespace) + name := kubernetes.SanitizeName(arg) + err := DeleteIntegration(command.Context, c, name, command.Namespace) if err != nil { if k8errors.IsNotFound(err) { - fmt.Println("Integration " + arg + " not found. Skipped.") + fmt.Println("Integration " + name + " not found. Skipped.") } else { return err } } else { - fmt.Println("Integration " + arg + " deleted") + fmt.Println("Integration " + name + " deleted") } } } else if command.deleteAll { diff --git a/pkg/util/kubernetes/sanitize_test.go b/pkg/util/kubernetes/sanitize_test.go index 43078ae..608b612 100644 --- a/pkg/util/kubernetes/sanitize_test.go +++ b/pkg/util/kubernetes/sanitize_test.go @@ -27,6 +27,8 @@ func TestSanitizeName(t *testing.T) { {"input": "/path/to/abc.js", "expect": "abc"}, {"input": "abc.xml", "expect": "abc"}, {"input": "./path/to/abc.kts", "expect": "abc"}, + {"input": "fooToBar.groovy", "expect": "foo-to-bar"}, + {"input": "foo-to-bar", "expect": "foo-to-bar"}, } for _, c := range cases {