Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.

Commit 4d2b59d

Browse files
committed
Vmware-guestinfo: add variable to set DNS search domain
1 parent 80cab68 commit 4d2b59d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Documentation/vmware-guestinfo.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ property names are prefixed with `guestinfo.` in the VMX, e.g., `guestinfo.hostn
2121
| `interface.<n>.route.<l>.gateway` | `IP address` |
2222
| `interface.<n>.route.<l>.destination` | `CIDR IP address` |
2323
| `dns.server.<x>` | `IP address` |
24+
| `dns.domain.<y>` | `DNS search domain` |
2425
| `coreos.config.data` | `string` |
2526
| `coreos.config.data.encoding` | `{"", "base64", "gzip+base64"}` |
2627
| `coreos.config.url` | `URL` |
2728

28-
Note: "n", "m", "l", and "x" are 0-indexed, incrementing integers. The
29+
Note: "n", "m", "l", "x" and "y" are 0-indexed, incrementing integers. The
2930
identifier for an `interface` does not correspond to anything outside of this
3031
configuration; it serves only to distinguish between multiple `interface`s.
3132

datasource/vmware/vmware.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ func (v vmware) FetchMetadata() (metadata datasource.Metadata, err error) {
5858
}
5959
}
6060

61+
for i := 0; ; i++ {
62+
if domain := saveConfig("dns.domain.%d", i); domain == "" {
63+
break
64+
}
65+
}
66+
6167
found := true
6268
for i := 0; found; i++ {
6369
found = false

network/vmware_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ func TestProcessVMwareNetconf(t *testing.T) {
9898
config: map[string]string{
9999
"dns.server.0": "1.2.3.4",
100100
"dns.server.1": "5.6.7.8",
101+
"dns.domain.0": "coreos.com",
102+
"dns.domain.1": "example.com",
101103
"interface.0.mac": "00:11:22:33:44:55",
102104
"interface.0.ip.0.address": "10.0.0.100/24",
103105
"interface.0.ip.1.address": "10.0.0.101/24",
@@ -124,6 +126,7 @@ func TestProcessVMwareNetconf(t *testing.T) {
124126
gateway: net.ParseIP("10.0.0.1")},
125127
},
126128
nameservers: []net.IP{net.ParseIP("1.2.3.4"), net.ParseIP("5.6.7.8")},
129+
domains: []string{"coreos.com", "example.com"},
127130
},
128131
}},
129132
&physicalInterface{logicalInterface{
@@ -135,6 +138,7 @@ func TestProcessVMwareNetconf(t *testing.T) {
135138
gateway: net.ParseIP("10.0.1.1")},
136139
},
137140
nameservers: []net.IP{net.ParseIP("1.2.3.4"), net.ParseIP("5.6.7.8")},
141+
domains: []string{"coreos.com", "example.com"},
138142
},
139143
}},
140144
&physicalInterface{logicalInterface{

0 commit comments

Comments
 (0)