Skip to content

Commit

Permalink
Merge pull request #116 from moul/fix-102
Browse files Browse the repository at this point in the history
Fix: `Gateways` field is no longer ignored when the `HostName` field is present (#102)
  • Loading branch information
moul committed Feb 18, 2016
2 parents 6bcf9c5 + 3112b5e commit 85ef5e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ Get a released version on: https://github.com/moul/advanced-ssh-config/releases

### master (unreleased)

* Fix: `Gateways` field is no longer ignored when the `HostName` field is present ([#102](https://github.com/moul/advanced-ssh-config/issues/102))
* Ignore SIGHUP, close goroutines and export written bytes ([#112](https://github.com/moul/advanced-ssh-config/pull/112)) ([@QuentinPerez](https://github.com/QuentinPerez))
* Various documentation improvements ([@ashmatadeen](https://github.com/ashmatadeen), [@loliee](https://github.com/loliee), [@cerisier](https://github.com/cerisier))

Expand Down
12 changes: 6 additions & 6 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -863,48 +863,48 @@ func TestConfig_WriteSshConfig(t *testing.T) {
# host-based configuration
Host *.ddd
HostName 1.3.5.7
PasswordAuthentication yes
# HostName: 1.3.5.7
Host empty
Host nnn
HostName 5.5.5.5
PasswordAuthentication yes
Port 26
User mmmm
# ProxyCommand nc -v 4242
# HostName: 5.5.5.5
# Inherits: [mmm]
# Gateways: [titi, direct, 1.2.3.4]
Host tata
HostName 1.2.3.4
PasswordAuthentication yes
Port 22
User moul
# ProxyCommand nc -v 4242
# HostName: 1.2.3.4
# Inherits: [tutu, titi, toto, tutu]
# Gateways: [titi, direct, 1.2.3.4]
Host titi
HostName tata
Port 23
User moul
# ProxyCommand nc -v 4242
# HostName: tata
Host tonton
# ResolveNameservers: [a.com, 1.2.3.4]
Host toto
HostName 1.2.3.4
# HostName: 1.2.3.4
Host toutou
# ResolveCommand: dig -t %h
Host tutu
HostName 1.2.3.4
PasswordAuthentication yes
Port 22
# HostName: 1.2.3.4
# Inherits: [toto, tutu, *.ddd]
# Gateways: [titi, direct, 1.2.3.4]
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,6 @@ func (h *Host) WriteSshConfigTo(w io.Writer) error {
if h.HostKeyAlias != "" {
fmt.Fprintf(w, " HostKeyAlias %s\n", h.HostKeyAlias)
}
if h.HostName != "" {
fmt.Fprintf(w, " HostName %s\n", h.HostName)
}
if h.IdentitiesOnly != "" {
fmt.Fprintf(w, " IdentitiesOnly %s\n", h.IdentitiesOnly)
}
Expand Down Expand Up @@ -856,6 +853,9 @@ func (h *Host) WriteSshConfigTo(w io.Writer) error {
}

// assh fields
if h.HostName != "" {
fmt.Fprintf(w, " # HostName: %s\n", h.HostName)
}
if len(h.Inherits) > 0 {
fmt.Fprintf(w, " # Inherits: [%s]\n", strings.Join(h.Inherits, ", "))
}
Expand Down

0 comments on commit 85ef5e3

Please sign in to comment.