litc 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +57 -0
- data/Rakefile +56 -0
- data/VERSION.yml +4 -0
- data/bin/litc +31 -0
- data/lib/litc.rb +76 -0
- data/litc.gemspec +77 -0
- data/test/fixtures/ami-id +11 -0
- data/test/fixtures/ami-launch-index +11 -0
- data/test/fixtures/ami-manifest-path +11 -0
- data/test/fixtures/block-device-mapping +14 -0
- data/test/fixtures/block-device-mapping_ami +11 -0
- data/test/fixtures/block-device-mapping_ephemeral0 +11 -0
- data/test/fixtures/block-device-mapping_root +11 -0
- data/test/fixtures/block-device-mapping_swap +11 -0
- data/test/fixtures/hostname +11 -0
- data/test/fixtures/instance-id +11 -0
- data/test/fixtures/instance-type +11 -0
- data/test/fixtures/local-hostname +11 -0
- data/test/fixtures/local-ipv4 +11 -0
- data/test/fixtures/placement +11 -0
- data/test/fixtures/placement_availability-zone +11 -0
- data/test/fixtures/public-hostname +11 -0
- data/test/fixtures/public-ipv4 +11 -0
- data/test/fixtures/public-keys +11 -0
- data/test/fixtures/reservation-id +11 -0
- data/test/fixtures/security-groups +11 -0
- data/test/fixtures/user-data +11 -0
- data/test/helper.rb +31 -0
- data/test/test_litc.rb +134 -0
- metadata +97 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Brian Kaney
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
= LITC
|
2
|
+
|
3
|
+
A tiny ruby module for Amazon EC2 intance metadata.
|
4
|
+
|
5
|
+
It is probably important to note this really doesn't do anything unless
|
6
|
+
it is run on an Amazon EC2 instance where metadata is available over the
|
7
|
+
link-local address http://169.254.169.254
|
8
|
+
|
9
|
+
== Install
|
10
|
+
|
11
|
+
$ git clone git://github.com/bkaney/litc.git
|
12
|
+
$ cd litc
|
13
|
+
$ rake build
|
14
|
+
$ rake install
|
15
|
+
|
16
|
+
== Usage
|
17
|
+
|
18
|
+
Gets all the metadata, change the "-" to an "_" for the
|
19
|
+
method-missing magic:
|
20
|
+
|
21
|
+
Litc.ami_id
|
22
|
+
Litc.hostname
|
23
|
+
Litc.user_data
|
24
|
+
|
25
|
+
Or via the get method, pass the key as a symbol
|
26
|
+
|
27
|
+
Litc.get(:hostname)
|
28
|
+
|
29
|
+
|
30
|
+
== Commandline
|
31
|
+
|
32
|
+
There's a command line tool too.
|
33
|
+
|
34
|
+
$ litc [meta-data]
|
35
|
+
$ litc ami-id
|
36
|
+
$ litc hostname
|
37
|
+
$ litc placement/availibity-zone
|
38
|
+
|
39
|
+
== Resources
|
40
|
+
|
41
|
+
* {Amazon EC2}[http://amazonaws.com]
|
42
|
+
* {Instance Metadata}[http://is.gd/3XjbF]
|
43
|
+
|
44
|
+
|
45
|
+
== Note on Patches/Pull Requests
|
46
|
+
|
47
|
+
* Fork the project.
|
48
|
+
* Make your feature addition or bug fix.
|
49
|
+
* Add tests for it. This is important so I don't break it in a
|
50
|
+
future version unintentionally.
|
51
|
+
* Commit, do not mess with rakefile, version, or history.
|
52
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
53
|
+
* Send me a pull request. Bonus points for topic branches.
|
54
|
+
|
55
|
+
== Copyright
|
56
|
+
|
57
|
+
Copyright (c) 2009 Brian Kaney. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "litc"
|
8
|
+
gem.summary = %Q{A tiny ruby module for Amazon EC2 intance metadata}
|
9
|
+
gem.description = %Q{A tiny ruby module for Amazon EC2 intance metadata}
|
10
|
+
gem.email = "brian@vermonster.com"
|
11
|
+
gem.homepage = "http://github.com/bkaney/litc"
|
12
|
+
gem.authors = ["Brian Kaney"]
|
13
|
+
gem.add_development_dependency "thoughtbot-shoulda"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
end
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rake/testtask'
|
21
|
+
Rake::TestTask.new(:test) do |test|
|
22
|
+
test.libs << 'lib' << 'test'
|
23
|
+
test.pattern = 'test/**/*_test.rb'
|
24
|
+
test.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
begin
|
28
|
+
require 'rcov/rcovtask'
|
29
|
+
Rcov::RcovTask.new do |test|
|
30
|
+
test.libs << 'test'
|
31
|
+
test.pattern = 'test/**/*_test.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
rescue LoadError
|
35
|
+
task :rcov do
|
36
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
task :test => :check_dependencies
|
41
|
+
|
42
|
+
task :default => :test
|
43
|
+
|
44
|
+
require 'rake/rdoctask'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
if File.exist?('VERSION')
|
47
|
+
version = File.read('VERSION')
|
48
|
+
else
|
49
|
+
version = ""
|
50
|
+
end
|
51
|
+
|
52
|
+
rdoc.rdoc_dir = 'rdoc'
|
53
|
+
rdoc.title = "litc #{version}"
|
54
|
+
rdoc.rdoc_files.include('README*')
|
55
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
+
end
|
data/VERSION.yml
ADDED
data/bin/litc
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
|
+
|
5
|
+
help = <<HELP
|
6
|
+
Simple command to obtain instance metadata:
|
7
|
+
|
8
|
+
litc [item]
|
9
|
+
litc ami-id
|
10
|
+
litc user-data
|
11
|
+
|
12
|
+
litc --help : This help message
|
13
|
+
litc --list : list of all available items
|
14
|
+
|
15
|
+
HELP
|
16
|
+
|
17
|
+
if ARGV.first =~ /\-help|\?/ or ARGV.empty?
|
18
|
+
puts help
|
19
|
+
exit 0
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'litc'
|
23
|
+
include Litc
|
24
|
+
|
25
|
+
if ARGV.first =~ /-list/
|
26
|
+
puts "Listing all available instance metadata items:"
|
27
|
+
Litc::ITEMS.each{|i| puts " #{i}" }
|
28
|
+
exit 0
|
29
|
+
end
|
30
|
+
|
31
|
+
puts Litc.get(ARGV.first.to_s) || "ERROR: Invalid Item `#{ARGV.first}'"
|
data/lib/litc.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module Litc
|
4
|
+
|
5
|
+
# These are the items (for method missing)...
|
6
|
+
#
|
7
|
+
# 'ami-id' => :ami_id
|
8
|
+
# 'block-device-mapping/ami' => :block_device_mapping_ami
|
9
|
+
#
|
10
|
+
ITEMS = %w(
|
11
|
+
ami-id
|
12
|
+
ami-launch-index
|
13
|
+
ami-manifest-path
|
14
|
+
block-device-mapping/
|
15
|
+
block-device-mapping/ami
|
16
|
+
block-device-mapping/ephemeral0
|
17
|
+
block-device-mapping/swap
|
18
|
+
block-device-mapping/root
|
19
|
+
hostname
|
20
|
+
instance-id
|
21
|
+
instance-type
|
22
|
+
local-hostname
|
23
|
+
local-ipv4
|
24
|
+
placement/
|
25
|
+
placement/availability-zone
|
26
|
+
public-hostname
|
27
|
+
public-ipv4
|
28
|
+
public-keys/
|
29
|
+
reservation-id
|
30
|
+
security-groups
|
31
|
+
user-data
|
32
|
+
)
|
33
|
+
|
34
|
+
# Version of the API to use, any one of:
|
35
|
+
# 1.0
|
36
|
+
# 2007-01-19
|
37
|
+
# 2007-03-01
|
38
|
+
# 2009-08-15
|
39
|
+
# latest
|
40
|
+
API_VERSION = "latest"
|
41
|
+
|
42
|
+
def urlize item
|
43
|
+
item = item.to_s.gsub(/_/, '-')
|
44
|
+
if item =~ /(placement).+/ or item =~ /(block-device-mapping).+/
|
45
|
+
item.gsub!(/(#{$1})-(.*)$/,'\\1/\\2')
|
46
|
+
end
|
47
|
+
if item =~ /block-device-mapping$/ or item =~ /placement$/ or item =~ /public-keys$/
|
48
|
+
item << "/"
|
49
|
+
end
|
50
|
+
item
|
51
|
+
end
|
52
|
+
|
53
|
+
def get(item)
|
54
|
+
item = urlize(item)
|
55
|
+
|
56
|
+
if item != 'user-data'
|
57
|
+
item = "meta-data/#{item}"
|
58
|
+
end
|
59
|
+
|
60
|
+
response = Net::HTTP.get_response(URI.parse("http://169.254.169.254/#{API_VERSION}/#{item}"))
|
61
|
+
|
62
|
+
case response
|
63
|
+
when Net::HTTPSuccess then response.body.strip
|
64
|
+
else nil
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def method_missing(meth, *args, &block)
|
69
|
+
if ITEMS.include?(urlize(meth))
|
70
|
+
get(meth)
|
71
|
+
else
|
72
|
+
raise(NoMethodError, "undefined method '#{meth}' for Litc")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
data/litc.gemspec
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{litc}
|
8
|
+
s.version = "1.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Brian Kaney"]
|
12
|
+
s.date = %q{2009-10-05}
|
13
|
+
s.default_executable = %q{litc}
|
14
|
+
s.description = %q{A tiny ruby module for Amazon EC2 intance metadata}
|
15
|
+
s.email = %q{brian@vermonster.com}
|
16
|
+
s.executables = ["litc"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION.yml",
|
28
|
+
"bin/litc",
|
29
|
+
"lib/litc.rb",
|
30
|
+
"litc.gemspec",
|
31
|
+
"test/fixtures/ami-id",
|
32
|
+
"test/fixtures/ami-launch-index",
|
33
|
+
"test/fixtures/ami-manifest-path",
|
34
|
+
"test/fixtures/block-device-mapping",
|
35
|
+
"test/fixtures/block-device-mapping_ami",
|
36
|
+
"test/fixtures/block-device-mapping_ephemeral0",
|
37
|
+
"test/fixtures/block-device-mapping_root",
|
38
|
+
"test/fixtures/block-device-mapping_swap",
|
39
|
+
"test/fixtures/hostname",
|
40
|
+
"test/fixtures/instance-id",
|
41
|
+
"test/fixtures/instance-type",
|
42
|
+
"test/fixtures/local-hostname",
|
43
|
+
"test/fixtures/local-ipv4",
|
44
|
+
"test/fixtures/placement",
|
45
|
+
"test/fixtures/placement_availability-zone",
|
46
|
+
"test/fixtures/public-hostname",
|
47
|
+
"test/fixtures/public-ipv4",
|
48
|
+
"test/fixtures/public-keys",
|
49
|
+
"test/fixtures/reservation-id",
|
50
|
+
"test/fixtures/security-groups",
|
51
|
+
"test/fixtures/user-data",
|
52
|
+
"test/helper.rb",
|
53
|
+
"test/test_litc.rb"
|
54
|
+
]
|
55
|
+
s.homepage = %q{http://github.com/bkaney/litc}
|
56
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
57
|
+
s.require_paths = ["lib"]
|
58
|
+
s.rubygems_version = %q{1.3.5}
|
59
|
+
s.summary = %q{A tiny ruby module for Amazon EC2 intance metadata}
|
60
|
+
s.test_files = [
|
61
|
+
"test/helper.rb",
|
62
|
+
"test/test_litc.rb"
|
63
|
+
]
|
64
|
+
|
65
|
+
if s.respond_to? :specification_version then
|
66
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
67
|
+
s.specification_version = 3
|
68
|
+
|
69
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
70
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
71
|
+
else
|
72
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
73
|
+
end
|
74
|
+
else
|
75
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
HTTP/1.0 200 OK
|
2
|
+
Connection: close
|
3
|
+
Content-Type: text/plain
|
4
|
+
Accept-Ranges: bytes
|
5
|
+
ETag: "1299856414"
|
6
|
+
Last-Modified: Thu, 26 Mar 2009 13:54:53 GMT
|
7
|
+
Content-Length: 55
|
8
|
+
Date: Mon, 05 Oct 2009 02:10:00 GMT
|
9
|
+
Server: EC2ws
|
10
|
+
|
11
|
+
test/amis/i386/image.manifest.xml
|
@@ -0,0 +1,14 @@
|
|
1
|
+
HTTP/1.0 200 OK
|
2
|
+
Connection: close
|
3
|
+
Content-Type: text/plain
|
4
|
+
Accept-Ranges: bytes
|
5
|
+
ETag: "1574910992"
|
6
|
+
Last-Modified: Thu, 26 Mar 2009 13:54:53 GMT
|
7
|
+
Content-Length: 24
|
8
|
+
Date: Mon, 05 Oct 2009 02:10:58 GMT
|
9
|
+
Server: EC2ws
|
10
|
+
|
11
|
+
ami
|
12
|
+
ephemeral0
|
13
|
+
root
|
14
|
+
swap
|
@@ -0,0 +1,11 @@
|
|
1
|
+
HTTP/1.0 200 OK
|
2
|
+
Connection: close
|
3
|
+
Content-Type: text/plain
|
4
|
+
Accept-Ranges: bytes
|
5
|
+
ETag: "-1921371120"
|
6
|
+
Last-Modified: Thu, 26 Mar 2009 13:54:53 GMT
|
7
|
+
Content-Length: 29
|
8
|
+
Date: Mon, 05 Oct 2009 02:13:37 GMT
|
9
|
+
Server: EC2ws
|
10
|
+
|
11
|
+
ip-10-0-0-1.ec2.internal
|
@@ -0,0 +1,11 @@
|
|
1
|
+
HTTP/1.0 200 OK
|
2
|
+
Connection: close
|
3
|
+
Content-Type: text/plain
|
4
|
+
Accept-Ranges: bytes
|
5
|
+
ETag: "-1921289200"
|
6
|
+
Last-Modified: Thu, 26 Mar 2009 13:54:53 GMT
|
7
|
+
Content-Length: 29
|
8
|
+
Date: Mon, 05 Oct 2009 02:15:20 GMT
|
9
|
+
Server: EC2ws
|
10
|
+
|
11
|
+
ip-10-0-0-1.ec2.internal
|
@@ -0,0 +1,11 @@
|
|
1
|
+
HTTP/1.0 200 OK
|
2
|
+
Connection: close
|
3
|
+
Content-Type: text/plain
|
4
|
+
Accept-Ranges: bytes
|
5
|
+
ETag: "-1951666365"
|
6
|
+
Last-Modified: Sat, 16 May 2009 04:39:03 GMT
|
7
|
+
Content-Length: 39
|
8
|
+
Date: Mon, 05 Oct 2009 02:17:28 GMT
|
9
|
+
Server: EC2ws
|
10
|
+
|
11
|
+
ec2-67-1-1-1.compute-1.amazonaws.com
|
@@ -0,0 +1,11 @@
|
|
1
|
+
HTTP/1.0 200 OK
|
2
|
+
Connection: close
|
3
|
+
Content-Type: application/octet-stream
|
4
|
+
Accept-Ranges: bytes
|
5
|
+
ETag: "1836735518"
|
6
|
+
Last-Modified: Thu, 26 Mar 2009 13:54:53 GMT
|
7
|
+
Content-Length: 57
|
8
|
+
Date: Mon, 05 Oct 2009 02:20:47 GMT
|
9
|
+
Server: EC2ws
|
10
|
+
|
11
|
+
{ "roles": [ "app", "search", "job" ] }
|
data/test/helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), *%w[.. lib litc])
|
4
|
+
require 'test/unit'
|
5
|
+
require 'shoulda'
|
6
|
+
require 'fakeweb'
|
7
|
+
require 'ruby-debug'
|
8
|
+
|
9
|
+
include Litc
|
10
|
+
|
11
|
+
class Test::Unit::TestCase
|
12
|
+
|
13
|
+
def response_for(item)
|
14
|
+
item = Litc.urlize(item)
|
15
|
+
File.read(fixture_path_for(item)).gsub(/.*\n\n/m,'').strip
|
16
|
+
end
|
17
|
+
|
18
|
+
def fixture_path_for(item)
|
19
|
+
File.dirname(__FILE__) + "/fixtures/#{item.gsub(/\/(.+)$/, '_\\1').gsub(/\/$/,'')}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def setup
|
23
|
+
Litc::ITEMS.each do |item|
|
24
|
+
uri = "http://169.254.169.254/latest/"
|
25
|
+
uri << "meta-data/" unless item == 'user-data'
|
26
|
+
uri << item
|
27
|
+
FakeWeb.register_uri(:get, uri, :response => File.read(fixture_path_for(item)))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/test/test_litc.rb
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TestLitc < Test::Unit::TestCase
|
4
|
+
|
5
|
+
|
6
|
+
context "urlize helper" do
|
7
|
+
|
8
|
+
should "urlize, general case" do
|
9
|
+
assert_equal "hello-world", Litc.urlize(:hello_world)
|
10
|
+
end
|
11
|
+
|
12
|
+
should "urlize, special cases" do
|
13
|
+
assert_equal "block-device-mapping/", Litc.urlize(:block_device_mapping)
|
14
|
+
assert_equal "block-device-mapping/foo", Litc.urlize(:block_device_mapping_foo)
|
15
|
+
assert_equal "block-device-mapping/swap", Litc.urlize(:block_device_mapping_swap)
|
16
|
+
|
17
|
+
assert_equal "placement/", Litc.urlize(:placement)
|
18
|
+
assert_equal "placement/availability-zone", Litc.urlize(:placement_availability_zone)
|
19
|
+
|
20
|
+
assert_equal "public-keys/", Litc.urlize(:public_keys)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
context "instance metadata" do
|
26
|
+
|
27
|
+
should "get ami_id" do
|
28
|
+
assert_equal response_for(:ami_id), Litc.get(:ami_id)
|
29
|
+
assert_equal response_for(:ami_id), Litc.ami_id
|
30
|
+
end
|
31
|
+
|
32
|
+
should "get ami_launch_index" do
|
33
|
+
assert_equal response_for(:ami_launch_index), Litc.get(:ami_launch_index)
|
34
|
+
assert_equal response_for(:ami_launch_index), Litc.ami_launch_index
|
35
|
+
end
|
36
|
+
|
37
|
+
should "get ami_manifest_path" do
|
38
|
+
assert_equal response_for(:ami_manifest_path), Litc.get(:ami_manifest_path)
|
39
|
+
assert_equal response_for(:ami_manifest_path), Litc.ami_manifest_path
|
40
|
+
end
|
41
|
+
|
42
|
+
should "get block-device-mapping" do
|
43
|
+
assert_equal response_for(:block_device_mapping), Litc.get(:block_device_mapping)
|
44
|
+
assert_equal response_for(:block_device_mapping), Litc.block_device_mapping
|
45
|
+
end
|
46
|
+
|
47
|
+
should "get block-device-mapping-ami" do
|
48
|
+
assert_equal response_for(:block_device_mapping_ami), Litc.get(:block_device_mapping_ami)
|
49
|
+
assert_equal response_for(:block_device_mapping_ami), Litc.block_device_mapping_ami
|
50
|
+
end
|
51
|
+
|
52
|
+
should "get block-device-mapping-ephemeral0" do
|
53
|
+
assert_equal response_for(:block_device_mapping_ephemeral0), Litc.get(:block_device_mapping_ephemeral0)
|
54
|
+
assert_equal response_for(:block_device_mapping_ephemeral0), Litc.block_device_mapping_ephemeral0
|
55
|
+
end
|
56
|
+
|
57
|
+
should "get block-device-mapping-root" do
|
58
|
+
assert_equal response_for(:block_device_mapping_root), Litc.get(:block_device_mapping_root)
|
59
|
+
assert_equal response_for(:block_device_mapping_root), Litc.block_device_mapping_root
|
60
|
+
end
|
61
|
+
|
62
|
+
should "get block-device-mapping-swap" do
|
63
|
+
assert_equal response_for(:block_device_mapping_swap), Litc.get(:block_device_mapping_swap)
|
64
|
+
assert_equal response_for(:block_device_mapping_swap), Litc.block_device_mapping_swap
|
65
|
+
end
|
66
|
+
|
67
|
+
should "get hostname" do
|
68
|
+
assert_equal response_for(:hostname), Litc.get(:hostname)
|
69
|
+
assert_equal response_for(:hostname), Litc.hostname
|
70
|
+
end
|
71
|
+
|
72
|
+
should "get instance-id" do
|
73
|
+
assert_equal response_for(:instance_id), Litc.get(:instance_id)
|
74
|
+
assert_equal response_for(:instance_id), Litc.instance_id
|
75
|
+
end
|
76
|
+
|
77
|
+
should "get instance-type" do
|
78
|
+
assert_equal response_for(:instance_type), Litc.get(:instance_type)
|
79
|
+
assert_equal response_for(:instance_type), Litc.instance_type
|
80
|
+
end
|
81
|
+
|
82
|
+
should "get local-hostname" do
|
83
|
+
assert_equal response_for(:local_hostname), Litc.get(:local_hostname)
|
84
|
+
assert_equal response_for(:local_hostname), Litc.local_hostname
|
85
|
+
end
|
86
|
+
|
87
|
+
should "get local-ipv4" do
|
88
|
+
assert_equal response_for(:local_ipv4), Litc.get(:local_ipv4)
|
89
|
+
assert_equal response_for(:local_ipv4), Litc.local_ipv4
|
90
|
+
end
|
91
|
+
|
92
|
+
should "get placement" do
|
93
|
+
assert_equal response_for(:placement), Litc.get(:placement)
|
94
|
+
assert_equal response_for(:placement), Litc.placement
|
95
|
+
end
|
96
|
+
|
97
|
+
should "get placement-availability-zone" do
|
98
|
+
assert_equal response_for(:placement_availability_zone), Litc.get(:placement_availability_zone)
|
99
|
+
assert_equal response_for(:placement_availability_zone), Litc.placement_availability_zone
|
100
|
+
end
|
101
|
+
|
102
|
+
should "get public-hostname" do
|
103
|
+
assert_equal response_for(:public_hostname), Litc.get(:public_hostname)
|
104
|
+
assert_equal response_for(:public_hostname), Litc.public_hostname
|
105
|
+
end
|
106
|
+
|
107
|
+
should "get public-ipv4" do
|
108
|
+
assert_equal response_for(:public_ipv4), Litc.get(:public_ipv4)
|
109
|
+
assert_equal response_for(:public_ipv4), Litc.public_ipv4
|
110
|
+
end
|
111
|
+
|
112
|
+
should "get public-keys" do
|
113
|
+
assert_equal response_for(:public_keys), Litc.get(:public_keys)
|
114
|
+
assert_equal response_for(:public_keys), Litc.public_keys
|
115
|
+
end
|
116
|
+
|
117
|
+
should "get reservation-id" do
|
118
|
+
assert_equal response_for(:reservation_id), Litc.get(:reservation_id)
|
119
|
+
assert_equal response_for(:reservation_id), Litc.reservation_id
|
120
|
+
end
|
121
|
+
|
122
|
+
should "get security-groups" do
|
123
|
+
assert_equal response_for(:security_groups), Litc.get(:security_groups)
|
124
|
+
assert_equal response_for(:security_groups), Litc.security_groups
|
125
|
+
end
|
126
|
+
|
127
|
+
should "get user-data" do
|
128
|
+
assert_equal response_for(:user_data), Litc.get(:user_data)
|
129
|
+
assert_equal response_for(:user_data), Litc.user_data
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: litc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Kaney
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-05 00:00:00 -04:00
|
13
|
+
default_executable: litc
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: thoughtbot-shoulda
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: A tiny ruby module for Amazon EC2 intance metadata
|
26
|
+
email: brian@vermonster.com
|
27
|
+
executables:
|
28
|
+
- litc
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- .document
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION.yml
|
41
|
+
- bin/litc
|
42
|
+
- lib/litc.rb
|
43
|
+
- litc.gemspec
|
44
|
+
- test/fixtures/ami-id
|
45
|
+
- test/fixtures/ami-launch-index
|
46
|
+
- test/fixtures/ami-manifest-path
|
47
|
+
- test/fixtures/block-device-mapping
|
48
|
+
- test/fixtures/block-device-mapping_ami
|
49
|
+
- test/fixtures/block-device-mapping_ephemeral0
|
50
|
+
- test/fixtures/block-device-mapping_root
|
51
|
+
- test/fixtures/block-device-mapping_swap
|
52
|
+
- test/fixtures/hostname
|
53
|
+
- test/fixtures/instance-id
|
54
|
+
- test/fixtures/instance-type
|
55
|
+
- test/fixtures/local-hostname
|
56
|
+
- test/fixtures/local-ipv4
|
57
|
+
- test/fixtures/placement
|
58
|
+
- test/fixtures/placement_availability-zone
|
59
|
+
- test/fixtures/public-hostname
|
60
|
+
- test/fixtures/public-ipv4
|
61
|
+
- test/fixtures/public-keys
|
62
|
+
- test/fixtures/reservation-id
|
63
|
+
- test/fixtures/security-groups
|
64
|
+
- test/fixtures/user-data
|
65
|
+
- test/helper.rb
|
66
|
+
- test/test_litc.rb
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: http://github.com/bkaney/litc
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options:
|
73
|
+
- --charset=UTF-8
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
81
|
+
version:
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: "0"
|
87
|
+
version:
|
88
|
+
requirements: []
|
89
|
+
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 1.3.5
|
92
|
+
signing_key:
|
93
|
+
specification_version: 3
|
94
|
+
summary: A tiny ruby module for Amazon EC2 intance metadata
|
95
|
+
test_files:
|
96
|
+
- test/helper.rb
|
97
|
+
- test/test_litc.rb
|