gce-metadata 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gce_metadata.rb +4 -3
- data/lib/gce_metadata/base.rb +8 -6
- data/lib/gce_metadata/http_client.rb +1 -1
- data/lib/gce_metadata/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c67cf46dbb682016e74030421afcb3805d0c4fe3
|
4
|
+
data.tar.gz: 00f6e3fbdcf07d4b50f2d3a3efe465853b75322d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c4918005e5887197bc936f4be68e13ccff8dbe6f6bb49f98c024fc31ae1affeb31a15ae71e4ab21285350c579073a9d7e94aaa2ddef82bc38250cfef0934bd
|
7
|
+
data.tar.gz: 684deb839c19d6fc1d5b8cf5f7c2c413a9045507e54f1f098601e161e6708dc95baa9d43e5234c2e37c6859c7237af25c1a5a4ad47a9d8a50d17e3d5f22780fc
|
data/Gemfile.lock
CHANGED
data/lib/gce_metadata.rb
CHANGED
@@ -53,15 +53,16 @@ module GCEMetadata
|
|
53
53
|
|
54
54
|
def logging(msg)
|
55
55
|
@indent ||= 0
|
56
|
-
disp = (" " * @indent) << msg
|
57
|
-
puts(disp) if @debug
|
58
56
|
@indent += 2
|
57
|
+
disp = (" " * @indent) << msg
|
58
|
+
#puts(disp) if @debug
|
59
59
|
begin
|
60
60
|
result = yield
|
61
|
+
puts "#{disp} => #{result.inspect}" if @debug
|
62
|
+
#puts "#{(" " * @indent)} #{result.inspect}" if @debug
|
61
63
|
ensure
|
62
64
|
@indent -= 2
|
63
65
|
end
|
64
|
-
puts "#{disp} => #{result.inspect}" if @debug
|
65
66
|
result
|
66
67
|
end
|
67
68
|
end
|
data/lib/gce_metadata/base.rb
CHANGED
@@ -105,12 +105,14 @@ module GCEMetadata
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def to_hash
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
logging("#{class_name}.to_hash(#{@path})") do
|
109
|
+
keys.inject({}) do |dest, key|
|
110
|
+
value = get(key)
|
111
|
+
key = key.sub(/\/$/, '')
|
112
|
+
dest[key] = value.respond_to?(:to_hash) ? value.to_hash : value
|
113
|
+
dest
|
114
|
+
end
|
115
|
+
end
|
114
116
|
end
|
115
117
|
|
116
118
|
def from_hash(hash)
|
@@ -14,7 +14,7 @@ module GCEMetadata
|
|
14
14
|
attr_accessor :read_timeout_sec
|
15
15
|
|
16
16
|
def get(path)
|
17
|
-
logging("
|
17
|
+
logging("http_get(#{path.inspect})") do
|
18
18
|
http = Net::HTTP.new(DEFAULT_HOST)
|
19
19
|
http.open_timeout = self.open_timeout_sec
|
20
20
|
http.read_timeout = self.read_timeout_sec
|
data/lib/gce_metadata/version.rb
CHANGED