File tree Expand file tree Collapse file tree 2 files changed +1
-18
lines changed Expand file tree Collapse file tree 2 files changed +1
-18
lines changed Original file line number Diff line number Diff line change @@ -130,8 +130,6 @@ func run(ctx context.Context) {
130
130
opts .Writers = []io.Writer {& serialPort {"COM1" }}
131
131
}
132
132
133
- setMetadataURL ()
134
-
135
133
var err error
136
134
newMetadata , err = getMetadata (ctx , false )
137
135
if err == nil {
@@ -173,9 +171,6 @@ func run(ctx context.Context) {
173
171
// not to spam the log on network failures.
174
172
if webError == 1 {
175
173
if urlErr , ok := err .(* url.Error ); ok {
176
- if _ , ok := urlErr .Err .(* net.DNSError ); ok {
177
- logger .Errorf ("DNS error when requesting metadata, check DNS settings and ensure metadata.internal.google is setup in your hosts file." )
178
- }
179
174
if _ , ok := urlErr .Err .(* net.OpError ); ok {
180
175
logger .Errorf ("Network error when requesting metadata, make sure your instance has an active network and can reach the metadata server." )
181
176
}
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import (
20
20
"encoding/json"
21
21
"fmt"
22
22
"io/ioutil"
23
- "net"
24
23
"net/http"
25
24
"strconv"
26
25
"strings"
@@ -32,24 +31,13 @@ import (
32
31
const defaultEtag = "NONE"
33
32
34
33
var (
35
- metadataURL = ""
36
- metadataHost = "metadata.google.internal"
37
- metadataFallback = "169.254.169.254"
38
- metadataPath = "/computeMetadata/v1/"
34
+ metadataURL = "http://169.254.169.254/computeMetadata/v1/"
39
35
metadataRecursive = "/?recursive=true&alt=json"
40
36
metadataHang = "&wait_for_change=true&timeout_sec=60"
41
37
defaultTimeout = 70 * time .Second
42
38
etag = defaultEtag
43
39
)
44
40
45
- func setMetadataURL () {
46
- host := metadataHost
47
- if _ , err := net .LookupIP (host ); err != nil {
48
- host = metadataFallback
49
- }
50
- metadataURL = "http://" + host + metadataPath
51
- }
52
-
53
41
type metadata struct {
54
42
Instance instance
55
43
Project project
You can’t perform that action at this time.
0 commit comments