chore(variable): change UserName to Username

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2019-03-06 11:00:09 +08:00
parent 0b241dd368
commit 89fce5b1d3
3 changed files with 21 additions and 21 deletions

View File

@ -195,7 +195,7 @@ func run(c *cli.Context) error {
Config: Config{ Config: Config{
Key: c.String("ssh-key"), Key: c.String("ssh-key"),
KeyPath: c.String("key-path"), KeyPath: c.String("key-path"),
UserName: c.String("user"), Username: c.String("user"),
Password: c.String("password"), Password: c.String("password"),
Host: c.StringSlice("host"), Host: c.StringSlice("host"),
Port: c.Int("port"), Port: c.Int("port"),

View File

@ -25,7 +25,7 @@ type (
Config struct { Config struct {
Key string Key string
KeyPath string KeyPath string
UserName string Username string
Password string Password string
Host []string Host []string
Port int Port int
@ -55,7 +55,7 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
// Create MakeConfig instance with remote username, server address and path to private key. // Create MakeConfig instance with remote username, server address and path to private key.
ssh := &easyssh.MakeConfig{ ssh := &easyssh.MakeConfig{
Server: host, Server: host,
User: p.Config.UserName, User: p.Config.Username,
Password: p.Config.Password, Password: p.Config.Password,
Port: strconv.Itoa(p.Config.Port), Port: strconv.Itoa(p.Config.Port),
Key: p.Config.Key, Key: p.Config.Key,

View File

@ -23,7 +23,7 @@ func TestMissingKeyOrPassword(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config{ Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "ubuntu", Username: "ubuntu",
}, },
os.Stdout, os.Stdout,
} }
@ -38,7 +38,7 @@ func TestSetPasswordAndKey(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config{ Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "ubuntu", Username: "ubuntu",
Password: "1234", Password: "1234",
Key: "1234", Key: "1234",
}, },
@ -55,7 +55,7 @@ func TestIncorrectPassword(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
Password: "123456", Password: "123456",
Script: []string{"whoami"}, Script: []string{"whoami"},
@ -71,7 +71,7 @@ func TestSSHScriptFromRawKey(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
CommandTimeout: 60, CommandTimeout: 60,
Key: `-----BEGIN RSA PRIVATE KEY----- Key: `-----BEGIN RSA PRIVATE KEY-----
@ -114,7 +114,7 @@ func TestSSHScriptFromKeyFile(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost", "127.0.0.1"}, Host: []string{"localhost", "127.0.0.1"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"whoami", "ls -al"}, Script: []string{"whoami", "ls -al"},
@ -130,7 +130,7 @@ func TestStreamFromSSHCommand(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost", "127.0.0.1"}, Host: []string{"localhost", "127.0.0.1"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"whoami", "for i in {1..5}; do echo ${i}; sleep 1; done", "echo 'done'"}, Script: []string{"whoami", "for i in {1..5}; do echo ${i}; sleep 1; done", "echo 'done'"},
@ -146,7 +146,7 @@ func TestSSHScriptWithError(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost", "127.0.0.1"}, Host: []string{"localhost", "127.0.0.1"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"exit 1"}, Script: []string{"exit 1"},
@ -163,7 +163,7 @@ func TestSSHCommandTimeOut(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"sleep 5"}, Script: []string{"sleep 5"},
@ -179,7 +179,7 @@ func TestProxyCommand(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"whoami"}, Script: []string{"whoami"},
@ -201,7 +201,7 @@ func TestSSHCommandError(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"mkdir a", "mkdir a"}, Script: []string{"mkdir a", "mkdir a"},
@ -217,7 +217,7 @@ func TestSSHCommandExitCodeError(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{ Script: []string{
@ -240,7 +240,7 @@ func TestSetENV(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Secrets: []string{"FOO"}, Secrets: []string{"FOO"},
@ -267,7 +267,7 @@ func TestSetExistingENV(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Secrets: []string{"FOO"}, Secrets: []string{"FOO"},
@ -292,7 +292,7 @@ func TestSyncMode(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost", "127.0.0.1"}, Host: []string{"localhost", "127.0.0.1"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{"whoami", "for i in {1..3}; do echo ${i}; sleep 1; done", "echo 'done'"}, Script: []string{"whoami", "for i in {1..3}; do echo ${i}; sleep 1; done", "echo 'done'"},
@ -363,7 +363,7 @@ func TestCommandOutput(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost", "127.0.0.1"}, Host: []string{"localhost", "127.0.0.1"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{ Script: []string{
@ -398,7 +398,7 @@ func TestScriptStop(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{ Script: []string{
@ -433,7 +433,7 @@ func TestNoneScriptStop(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Script: []string{ Script: []string{
@ -494,7 +494,7 @@ func TestEnvOutput(t *testing.T) {
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},
UserName: "drone-scp", Username: "drone-scp",
Port: 22, Port: 22,
KeyPath: "./tests/.ssh/id_rsa", KeyPath: "./tests/.ssh/id_rsa",
Envs: []string{"env_1", "env_2", "env_3", "env_4", "env_5", "env_6", "env_7"}, Envs: []string{"env_1", "env_2", "env_3", "env_4", "env_5", "env_6", "env_7"},