-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to use complex ceph binary path (#22)
Add ability to pass complex `--ceph-binary` parameter like `ssh $hostname ceph` to run cephctl on any platform as a client accessing to ceph via SSH Signed-off-by: Igor Shishkin <[email protected]>
- Loading branch information
Showing
6 changed files
with
61 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ceph | ||
|
||
import ( | ||
"strings" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
func mkCommand(cephBinary string, args []string) (string, []string) { | ||
outCmd := shellCommand | ||
outArgs := []string{"-c", strings.Join(append([]string{cephBinary}, args...), " ")} | ||
|
||
log.Tracef("preparing command: `%s` `%#v`", outCmd, outArgs) | ||
|
||
return shellCommand, outArgs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ceph | ||
|
||
const ( | ||
shellCommand = "sh" | ||
shellArg = "-c" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ceph | ||
|
||
const ( | ||
shellCommand = "sh" | ||
shellArg = "-c" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package ceph | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestMkCommand(t *testing.T) { | ||
r := require.New(t) | ||
|
||
bin, args := mkCommand("testcmd", []string{"arg1", "arg2"}) | ||
r.Equal(shellCommand, bin) | ||
r.Equal([]string{ | ||
shellArg, "testcmd arg1 arg2", | ||
}, args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ceph | ||
|
||
const ( | ||
shellCommand = "cmd.exe" | ||
shellArg = "/C" | ||
) |