Skip to content

Commit

Permalink
Bypass bash -c and run kando directly in the pod (kanisterio#798)
Browse files Browse the repository at this point in the history
* Enclose kando --password into single quote

If we use the password as it is in the case of kand
location command and the password has some special char
for ex &, the operation fails.
This change tries to resolve that by replacing ' in the
password with \' and then enclosing the resultant into '.

* Enclose the command within " instead of ' and add
escape character before " and `

* Fix CI

* Address review comment

* Make kando command []string, remove enclosePassword

If we remove `bash -c` from the kando command the
command was string and thats why we faced problem
executing that.
When we remove bash -c and make the cmd []string
we are successfully able to run the thing withougt
the help of enclose password.

Co-authored-by: Pavan Navarathna <pavan@kasten.io>
  • Loading branch information
viveksinghggits and pavannd1 authored Oct 23, 2020
1 parent 6d34279 commit c528fe3
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pkg/kando/stream_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package kando

import (
"context"
"strings"

"github.com/spf13/cobra"

Expand Down Expand Up @@ -85,13 +84,5 @@ func GenerateStreamPushCommand(configFile, dirPath, filePath, password, sourceEn
sourceEndpoint,
)

return []string{
"bash",
"-o",
"errexit",
"-o",
"pipefail",
"-c",
strings.Join(kandoCmd, " "),
}
return kandoCmd
}

0 comments on commit c528fe3

Please sign in to comment.