remove unused parameter from addHostAliasCommand
parent
59c235c569
commit
73280e474e
|
|
@ -359,19 +359,18 @@ func AddHostAlias(c command.Runner, name string, ip net.IP) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if _, err := c.RunCmd(addHostAliasCommand(name, ip, record, true, "/etc/hosts")); err != nil {
|
||||
if _, err := c.RunCmd(addHostAliasCommand(name, record, true, "/etc/hosts")); err != nil {
|
||||
return errors.Wrap(err, "hosts update")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func addHostAliasCommand(name string, ip net.IP, record string, sudo bool, path string) *exec.Cmd {
|
||||
func addHostAliasCommand(name string, record string, sudo bool, path string) *exec.Cmd {
|
||||
sudoCmd := "sudo"
|
||||
if !sudo { // for testing
|
||||
sudoCmd = ""
|
||||
}
|
||||
// bug introduced in https://github.com/kubernetes/minikube/pull/7247/files#diff-b417251c2aba7198bb6b5fa1ec5894bd5d89288dddccf9ea9d9da249dadbfc8dR257
|
||||
// missing $ before '\t%s$'; as it is \t matches nothing
|
||||
|
||||
script := fmt.Sprintf(
|
||||
`{ grep -v $'\t%s$' "%s"; echo "%s"; } > /tmp/h.$$; %s cp /tmp/h.$$ "%s"`,
|
||||
name,
|
||||
|
|
|
|||
|
|
@ -41,12 +41,7 @@ func TestAddHostAliasInner(t *testing.T) {
|
|||
hostsFileLine := fmt.Sprintf("%s\t%s", ip, hostname)
|
||||
|
||||
// Act
|
||||
cmd := addHostAliasCommand(
|
||||
hostname,
|
||||
ip,
|
||||
hostsFileLine,
|
||||
false,
|
||||
tempFilePath)
|
||||
cmd := addHostAliasCommand(hostname, hostsFileLine, false, tempFilePath)
|
||||
if err = cmd.Run(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue