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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f12f2c1c07f95df09af969b4f7aaeeacf0da830
4
- data.tar.gz: ebcbe5062d9fbd3bd755ddd75e6f73885874dac4
3
+ metadata.gz: c67cf46dbb682016e74030421afcb3805d0c4fe3
4
+ data.tar.gz: 00f6e3fbdcf07d4b50f2d3a3efe465853b75322d
5
5
  SHA512:
6
- metadata.gz: 60f2a33e6d305cb7a912d546a8711622aae3cfc09477cbdc5c8ec7e1c293be937d41aa38f8e3353e29701cedb5a235bf00938f2eab6393ca772627c426dfa8be
7
- data.tar.gz: 96787afb83ef25a03084092d44a8443ad996ab338846fcafa9c17c968df1462a33c4327b52a466cd14e68bfb2b975212f5b33acc687903f047d32d6c0ad4d8b2
6
+ metadata.gz: 00c4918005e5887197bc936f4be68e13ccff8dbe6f6bb49f98c024fc31ae1affeb31a15ae71e4ab21285350c579073a9d7e94aaa2ddef82bc38250cfef0934bd
7
+ data.tar.gz: 684deb839c19d6fc1d5b8cf5f7c2c413a9045507e54f1f098601e161e6708dc95baa9d43e5234c2e37c6859c7237af25c1a5a4ad47a9d8a50d17e3d5f22780fc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gce-metadata (0.2.2)
4
+ gce-metadata (0.2.3)
5
5
  awesome_print
6
6
  ec2-metadata (~> 0.2, >= 0.2.2)
7
7
 
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
@@ -105,12 +105,14 @@ module GCEMetadata
105
105
  end
106
106
 
107
107
  def to_hash
108
- keys.inject({}) do |dest, key|
109
- value = get(key)
110
- key = key.sub(/\/$/, '')
111
- dest[key] = value.respond_to?(:to_hash) ? value.to_hash : value
112
- dest
113
- end
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("get(#{path.inspect})") do
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
@@ -1,4 +1,4 @@
1
1
  module GCEMetadata
2
2
  # gce-metadata version
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gce-metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christo De Lange