ec2-metadata 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/VERSION +1 -1
- data/ec2-metadata.gemspec +45 -46
- data/lib/ec2_metadata/base.rb +10 -1
- data/lib/ec2_metadata/dummy.rb +2 -2
- data/spec/ec2_metadata/base_spec.rb +12 -1
- metadata +10 -7
- data/.gitignore +0 -22
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.2-head@ec2-metadata
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/ec2-metadata.gemspec
CHANGED
@@ -1,79 +1,78 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ec2-metadata}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Takeshi AKIMA"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-03-03}
|
13
13
|
s.default_executable = %q{ec2-metadata}
|
14
14
|
s.description = %q{ec2-metadata provides to access metadata, and you can use in outside of ec2 like in ec2}
|
15
15
|
s.email = %q{akm2000@gmail.com}
|
16
16
|
s.executables = ["ec2-metadata"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
|
19
|
+
"README.rdoc"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
23
|
+
".rvmrc",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/ec2-metadata",
|
29
|
+
"ec2-metadata.gemspec",
|
30
|
+
"lib/ec2_metadata.rb",
|
31
|
+
"lib/ec2_metadata/base.rb",
|
32
|
+
"lib/ec2_metadata/command.rb",
|
33
|
+
"lib/ec2_metadata/dummy.rb",
|
34
|
+
"lib/ec2_metadata/dummy.yml",
|
35
|
+
"lib/ec2_metadata/http_client.rb",
|
36
|
+
"lib/ec2_metadata/revision.rb",
|
37
|
+
"lib/ec2_metadata/root.rb",
|
38
|
+
"lib/hash_key_orderable.rb",
|
39
|
+
"spec/ec2_metadata/base_spec.rb",
|
40
|
+
"spec/ec2_metadata/command_spec.rb",
|
41
|
+
"spec/ec2_metadata/dummy_spec.rb",
|
42
|
+
"spec/ec2_metadata/http_client_spec.rb",
|
43
|
+
"spec/ec2_metadata/revision_spec.rb",
|
44
|
+
"spec/ec2_metadata/root_spec.rb",
|
45
|
+
"spec/ec2_metadata_spec.rb",
|
46
|
+
"spec/hash_key_orderable_spec.rb",
|
47
|
+
"spec/introduction_spec.rb",
|
48
|
+
"spec/rcov.opts",
|
49
|
+
"spec/spec.opts",
|
50
|
+
"spec/spec_helper.rb",
|
51
|
+
"spec/to_hash_spec.rb"
|
52
52
|
]
|
53
53
|
s.homepage = %q{http://github.com/akm/ec2-metadata}
|
54
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
55
54
|
s.require_paths = ["lib"]
|
56
|
-
s.rubygems_version = %q{1.3.
|
55
|
+
s.rubygems_version = %q{1.3.7}
|
57
56
|
s.summary = %q{ec2-metadata provides to access metadata}
|
58
57
|
s.test_files = [
|
59
58
|
"spec/ec2_metadata/base_spec.rb",
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
59
|
+
"spec/ec2_metadata/command_spec.rb",
|
60
|
+
"spec/ec2_metadata/dummy_spec.rb",
|
61
|
+
"spec/ec2_metadata/http_client_spec.rb",
|
62
|
+
"spec/ec2_metadata/revision_spec.rb",
|
63
|
+
"spec/ec2_metadata/root_spec.rb",
|
64
|
+
"spec/ec2_metadata_spec.rb",
|
65
|
+
"spec/hash_key_orderable_spec.rb",
|
66
|
+
"spec/introduction_spec.rb",
|
67
|
+
"spec/spec_helper.rb",
|
68
|
+
"spec/to_hash_spec.rb"
|
70
69
|
]
|
71
70
|
|
72
71
|
if s.respond_to? :specification_version then
|
73
72
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
74
73
|
s.specification_version = 3
|
75
74
|
|
76
|
-
if Gem::Version.new(Gem::
|
75
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
77
76
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
78
77
|
else
|
79
78
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
data/lib/ec2_metadata/base.rb
CHANGED
@@ -45,6 +45,7 @@ module Ec2Metadata
|
|
45
45
|
new_child(child_key) :
|
46
46
|
Ec2Metadata.get("#{path}#{child_key}")
|
47
47
|
else
|
48
|
+
raise NotFoundError, "#{path}#{child_key} not found as default key" if @getting_default_child
|
48
49
|
raise NotFoundError, "#{path}#{child_key} not found" unless default_child
|
49
50
|
result = default_child.get(child_key)
|
50
51
|
end
|
@@ -80,8 +81,16 @@ module Ec2Metadata
|
|
80
81
|
alias_method :[], :get
|
81
82
|
|
82
83
|
def default_child
|
84
|
+
return @default_child if @default_child
|
83
85
|
logging("default_child") do
|
84
|
-
|
86
|
+
if default_child_key
|
87
|
+
@getting_default_child = true
|
88
|
+
begin
|
89
|
+
@default_child = get(default_child_key)
|
90
|
+
ensure
|
91
|
+
@getting_default_child = false
|
92
|
+
end
|
93
|
+
end
|
85
94
|
end
|
86
95
|
end
|
87
96
|
|
data/lib/ec2_metadata/dummy.rb
CHANGED
@@ -21,7 +21,7 @@ module Ec2Metadata
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def search_and_load_yaml
|
24
|
-
paths = Dir.glob(yaml_paths.map{|path| File.expand_path(path)})
|
24
|
+
paths = Dir.glob(yaml_paths.map{|path| File.expand_path(path) rescue nil}.compact)
|
25
25
|
load_yaml(paths.first) unless paths.empty?
|
26
26
|
end
|
27
27
|
|
@@ -32,7 +32,7 @@ module Ec2Metadata
|
|
32
32
|
Ec2Metadata.from_hash(YAML.load(text))
|
33
33
|
@loaded_yaml_path = path
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def loaded_yaml_path
|
37
37
|
@loaded_yaml_path
|
38
38
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
|
2
3
|
|
3
4
|
describe Ec2Metadata::Base do
|
@@ -59,8 +60,18 @@ describe Ec2Metadata::Base do
|
|
59
60
|
|
60
61
|
end
|
61
62
|
end
|
63
|
+
end
|
62
64
|
|
63
|
-
|
65
|
+
describe :default_child do
|
66
|
+
it "stack level too deep" do
|
67
|
+
Ec2Metadata.should_receive(:get).with("/latest/").once.and_return(DATA_TYPES.join("\n"))
|
68
|
+
# 0.2.1で発生しうる、SystemStackError: stack level too deep を無理に発生させている
|
69
|
+
latest = Ec2Metadata["latest"]
|
70
|
+
latest.instance_variable_set(:@default_child_key, 'unexist-meta-data')
|
71
|
+
lambda{
|
72
|
+
latest["instance_id"].should == nil
|
73
|
+
}.should raise_error(Ec2Metadata::NotFoundError)
|
74
|
+
end
|
64
75
|
end
|
65
76
|
|
66
77
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Takeshi AKIMA
|
@@ -14,13 +14,14 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-03-03 00:00:00 +09:00
|
18
18
|
default_executable: ec2-metadata
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
@@ -42,7 +43,7 @@ extra_rdoc_files:
|
|
42
43
|
- README.rdoc
|
43
44
|
files:
|
44
45
|
- .document
|
45
|
-
- .
|
46
|
+
- .rvmrc
|
46
47
|
- LICENSE
|
47
48
|
- README.rdoc
|
48
49
|
- Rakefile
|
@@ -76,11 +77,12 @@ homepage: http://github.com/akm/ec2-metadata
|
|
76
77
|
licenses: []
|
77
78
|
|
78
79
|
post_install_message:
|
79
|
-
rdoc_options:
|
80
|
-
|
80
|
+
rdoc_options: []
|
81
|
+
|
81
82
|
require_paths:
|
82
83
|
- lib
|
83
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
84
86
|
requirements:
|
85
87
|
- - ">="
|
86
88
|
- !ruby/object:Gem::Version
|
@@ -88,6 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
90
|
- 0
|
89
91
|
version: "0"
|
90
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
91
94
|
requirements:
|
92
95
|
- - ">="
|
93
96
|
- !ruby/object:Gem::Version
|
@@ -97,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
100
|
requirements: []
|
98
101
|
|
99
102
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.3.
|
103
|
+
rubygems_version: 1.3.7
|
101
104
|
signing_key:
|
102
105
|
specification_version: 3
|
103
106
|
summary: ec2-metadata provides to access metadata
|
data/.gitignore
DELETED