tnargav-aws 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module AWS
3
+ VERSION = "0.2.2"
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require "pathname"
2
+
3
+ require "vagrant-aws/plugin"
4
+
5
+ module VagrantPlugins
6
+ module AWS
7
+ lib_path = Pathname.new(File.expand_path("../vagrant-aws", __FILE__))
8
+ autoload :Action, lib_path.join("action")
9
+ autoload :Errors, lib_path.join("errors")
10
+
11
+ # This returns the path to the source of this plugin.
12
+ #
13
+ # @return [Pathname]
14
+ def self.source_root
15
+ @source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
16
+ end
17
+ end
18
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,73 @@
1
+ en:
2
+ vagrant_aws:
3
+ already_created: |-
4
+ The machine is already created.
5
+ launching_instance: |-
6
+ Launching an instance with the following settings...
7
+ launch_no_keypair: |-
8
+ Warning! You didn't specify a keypair to launch your instance with.
9
+ This can sometimes result in not being able to access your instance.
10
+ launch_vpc_warning: |-
11
+ Warning! You're launching this instance into a VPC without an
12
+ elastic IP. Please verify you're properly connected to a VPN so
13
+ you can access this machine, otherwise Vagrant will not be able
14
+ to SSH into it.
15
+ not_created: |-
16
+ Instance is not created. Please run `vagrant up` first.
17
+ ready: |-
18
+ Machine is booted and ready for use!
19
+ rsync_folder: |-
20
+ Rsyncing folder: %{hostpath} => %{guestpath}
21
+ terminating: |-
22
+ Terminating the instance...
23
+ waiting_for_ready: |-
24
+ Waiting for instance to become "ready"...
25
+ waiting_for_ssh: |-
26
+ Waiting for SSH to become available...
27
+ warn_networks: |-
28
+ Warning! The AWS provider doesn't support any of the Vagrant
29
+ high-level network configurations (`config.vm.network`). They
30
+ will be silently ignored.
31
+
32
+ config:
33
+ access_key_id_required: |-
34
+ An access key ID must be specified via "access_key_id"
35
+ ami_required: |-
36
+ An AMI must be configured via "ami"
37
+ private_key_missing: |-
38
+ The specified private key for AWS could not be found
39
+ region_required: |-
40
+ A region must be specified via "region"
41
+ secret_access_key_required: |-
42
+ A secret access key is required via "secret_access_key"
43
+
44
+ errors:
45
+ fog_error: |-
46
+ There was an error talking to AWS. The error message is shown
47
+ below:
48
+
49
+ %{message}
50
+ instance_ready_timeout: |-
51
+ The instance never became "ready" in AWS. The timeout currently
52
+ set waiting for the instance to become ready is %{timeout} seconds.
53
+ Please verify that the machine properly boots. If you need more time
54
+ set the `instance_ready_timeout` configuration on the AWS provider.
55
+ rsync_error: |-
56
+ There was an error when attemping to rsync a share folder.
57
+ Please inspect the error message below for more info.
58
+
59
+ Host path: %{hostpath}
60
+ Guest path: %{guestpath}
61
+ Error: %{stderr}
62
+
63
+ states:
64
+ short_not_created: |-
65
+ not created
66
+ long_not_created: |-
67
+ The EC2 instance is not created. Run `vagrant up` to create it.
68
+
69
+ short_running: |-
70
+ running
71
+ long_running: |-
72
+ The EC2 instance is running. To stop this machine, you can run
73
+ `vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
@@ -0,0 +1,197 @@
1
+ require "vagrant-aws/config"
2
+
3
+ describe VagrantPlugins::AWS::Config do
4
+ let(:instance) { described_class.new }
5
+
6
+ # Ensure tests are not affected by AWS credential environment variables
7
+ before :each do
8
+ ENV.stub(:[] => nil)
9
+ end
10
+
11
+ describe "defaults" do
12
+ subject do
13
+ instance.tap do |o|
14
+ o.finalize!
15
+ end
16
+ end
17
+
18
+ its("access_key_id") { should be_nil }
19
+ its("ami") { should be_nil }
20
+ its("availability_zone") { should be_nil }
21
+ its("instance_ready_timeout") { should == 120 }
22
+ its("instance_type") { should == "m1.small" }
23
+ its("keypair_name") { should be_nil }
24
+ its("private_ip_address") { should be_nil }
25
+ its("region") { should == "us-east-1" }
26
+ its("secret_access_key") { should be_nil }
27
+ its("security_groups") { should == [] }
28
+ its("subnet_id") { should be_nil }
29
+ its("tags") { should == {} }
30
+ its("user_data") { should be_nil }
31
+ its("use_iam_profile") { should be_false }
32
+ end
33
+
34
+ describe "overriding defaults" do
35
+ # I typically don't meta-program in tests, but this is a very
36
+ # simple boilerplate test, so I cut corners here. It just sets
37
+ # each of these attributes to "foo" in isolation, and reads the value
38
+ # and asserts the proper result comes back out.
39
+ [:access_key_id, :ami, :availability_zone, :instance_ready_timeout,
40
+ :instance_type, :keypair_name,
41
+ :region, :secret_access_key, :security_groups,
42
+ :subnet_id, :tags,
43
+ :use_iam_profile, :user_data].each do |attribute|
44
+
45
+ it "should not default #{attribute} if overridden" do
46
+ instance.send("#{attribute}=".to_sym, "foo")
47
+ instance.finalize!
48
+ instance.send(attribute).should == "foo"
49
+ end
50
+ end
51
+ end
52
+
53
+ describe "getting credentials from environment" do
54
+ context "without EC2 credential environment variables" do
55
+ subject do
56
+ instance.tap do |o|
57
+ o.finalize!
58
+ end
59
+ end
60
+
61
+ its("access_key_id") { should be_nil }
62
+ its("secret_access_key") { should be_nil }
63
+ end
64
+
65
+ context "with EC2 credential environment variables" do
66
+ before :each do
67
+ ENV.stub(:[]).with("AWS_ACCESS_KEY").and_return("access_key")
68
+ ENV.stub(:[]).with("AWS_SECRET_KEY").and_return("secret_key")
69
+ end
70
+
71
+ subject do
72
+ instance.tap do |o|
73
+ o.finalize!
74
+ end
75
+ end
76
+
77
+ its("access_key_id") { should == "access_key" }
78
+ its("secret_access_key") { should == "secret_key" }
79
+ end
80
+ end
81
+
82
+ describe "region config" do
83
+ let(:config_access_key_id) { "foo" }
84
+ let(:config_ami) { "foo" }
85
+ let(:config_instance_type) { "foo" }
86
+ let(:config_keypair_name) { "foo" }
87
+ let(:config_region) { "foo" }
88
+ let(:config_secret_access_key) { "foo" }
89
+
90
+ def set_test_values(instance)
91
+ instance.access_key_id = config_access_key_id
92
+ instance.ami = config_ami
93
+ instance.instance_type = config_instance_type
94
+ instance.keypair_name = config_keypair_name
95
+ instance.region = config_region
96
+ instance.secret_access_key = config_secret_access_key
97
+ end
98
+
99
+ it "should raise an exception if not finalized" do
100
+ expect { instance.get_region_config("us-east-1") }.
101
+ to raise_error
102
+ end
103
+
104
+ context "with no specific config set" do
105
+ subject do
106
+ # Set the values on the top-level object
107
+ set_test_values(instance)
108
+
109
+ # Finalize so we can get the region config
110
+ instance.finalize!
111
+
112
+ # Get a lower level region
113
+ instance.get_region_config("us-east-1")
114
+ end
115
+
116
+ its("access_key_id") { should == config_access_key_id }
117
+ its("ami") { should == config_ami }
118
+ its("instance_type") { should == config_instance_type }
119
+ its("keypair_name") { should == config_keypair_name }
120
+ its("region") { should == config_region }
121
+ its("secret_access_key") { should == config_secret_access_key }
122
+ end
123
+
124
+ context "with a specific config set" do
125
+ let(:region_name) { "hashi-region" }
126
+
127
+ subject do
128
+ # Set the values on a specific region
129
+ instance.region_config region_name do |config|
130
+ set_test_values(config)
131
+ end
132
+
133
+ # Finalize so we can get the region config
134
+ instance.finalize!
135
+
136
+ # Get the region
137
+ instance.get_region_config(region_name)
138
+ end
139
+
140
+ its("access_key_id") { should == config_access_key_id }
141
+ its("ami") { should == config_ami }
142
+ its("instance_type") { should == config_instance_type }
143
+ its("keypair_name") { should == config_keypair_name }
144
+ its("region") { should == region_name }
145
+ its("secret_access_key") { should == config_secret_access_key }
146
+ end
147
+
148
+ describe "inheritance of parent config" do
149
+ let(:region_name) { "hashi-region" }
150
+
151
+ subject do
152
+ # Set the values on a specific region
153
+ instance.region_config region_name do |config|
154
+ config.ami = "child"
155
+ end
156
+
157
+ # Set some top-level values
158
+ instance.access_key_id = "parent"
159
+ instance.ami = "parent"
160
+
161
+ # Finalize and get the region
162
+ instance.finalize!
163
+ instance.get_region_config(region_name)
164
+ end
165
+
166
+ its("access_key_id") { should == "parent" }
167
+ its("ami") { should == "child" }
168
+ end
169
+
170
+ describe "shortcut configuration" do
171
+ subject do
172
+ # Use the shortcut configuration to set some values
173
+ instance.region_config "us-east-1", :ami => "child"
174
+ instance.finalize!
175
+ instance.get_region_config("us-east-1")
176
+ end
177
+
178
+ its("ami") { should == "child" }
179
+ end
180
+
181
+ describe "merging" do
182
+ let(:first) { described_class.new }
183
+ let(:second) { described_class.new }
184
+
185
+ it "should merge the tags" do
186
+ first.tags["one"] = "one"
187
+ second.tags["two"] = "two"
188
+
189
+ third = first.merge(second)
190
+ third.tags.should == {
191
+ "one" => "one",
192
+ "two" => "two"
193
+ }
194
+ end
195
+ end
196
+ end
197
+ end
@@ -0,0 +1,58 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+ require "vagrant-aws/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "tnargav-aws"
6
+ s.version = VagrantPlugins::AWS::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = "Mitchell Hashimoto"
9
+ s.email = "mitchell@hashicorp.com"
10
+ s.homepage = "http://www.vagrantup.com"
11
+ s.summary = "Enables Vagrant to manage machines in EC2 and VPC."
12
+ s.description = "Enables Vagrant to manage machines in EC2 and VPC."
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.rubyforge_project = "vagrant-aws"
16
+
17
+ s.add_runtime_dependency "fog", "~> 1.10.0"
18
+
19
+ s.add_development_dependency "rake"
20
+ s.add_development_dependency "rspec-core", "~> 2.12.2"
21
+ s.add_development_dependency "rspec-expectations", "~> 2.12.1"
22
+ s.add_development_dependency "rspec-mocks", "~> 2.12.1"
23
+
24
+ # The following block of code determines the files that should be included
25
+ # in the gem. It does this by reading all the files in the directory where
26
+ # this gemspec is, and parsing out the ignored files from the gitignore.
27
+ # Note that the entire gitignore(5) syntax is not supported, specifically
28
+ # the "!" syntax, but it should mostly work correctly.
29
+ root_path = File.dirname(__FILE__)
30
+ all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
31
+ all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
32
+ gitignore_path = File.join(root_path, ".gitignore")
33
+ gitignore = File.readlines(gitignore_path)
34
+ gitignore.map! { |line| line.chomp.strip }
35
+ gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
36
+
37
+ unignored_files = all_files.reject do |file|
38
+ # Ignore any directories, the gemspec only cares about files
39
+ next true if File.directory?(file)
40
+
41
+ # Ignore any paths that match anything in the gitignore. We do
42
+ # two tests here:
43
+ #
44
+ # - First, test to see if the entire path matches the gitignore.
45
+ # - Second, match if the basename does, this makes it so that things
46
+ # like '.DS_Store' will match sub-directories too (same behavior
47
+ # as git).
48
+ #
49
+ gitignore.any? do |ignore|
50
+ File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
51
+ File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
52
+ end
53
+ end
54
+
55
+ s.files = unignored_files
56
+ s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
57
+ s.require_path = 'lib'
58
+ end
@@ -0,0 +1,58 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+ require "vagrant-aws/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "vagrant-aws"
6
+ s.version = VagrantPlugins::AWS::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = "Mitchell Hashimoto"
9
+ s.email = "mitchell@hashicorp.com"
10
+ s.homepage = "http://www.vagrantup.com"
11
+ s.summary = "Enables Vagrant to manage machines in EC2 and VPC."
12
+ s.description = "Enables Vagrant to manage machines in EC2 and VPC."
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.rubyforge_project = "vagrant-aws"
16
+
17
+ s.add_runtime_dependency "fog", "~> 1.10.0"
18
+
19
+ s.add_development_dependency "rake"
20
+ s.add_development_dependency "rspec-core", "~> 2.12.2"
21
+ s.add_development_dependency "rspec-expectations", "~> 2.12.1"
22
+ s.add_development_dependency "rspec-mocks", "~> 2.12.1"
23
+
24
+ # The following block of code determines the files that should be included
25
+ # in the gem. It does this by reading all the files in the directory where
26
+ # this gemspec is, and parsing out the ignored files from the gitignore.
27
+ # Note that the entire gitignore(5) syntax is not supported, specifically
28
+ # the "!" syntax, but it should mostly work correctly.
29
+ root_path = File.dirname(__FILE__)
30
+ all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
31
+ all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
32
+ gitignore_path = File.join(root_path, ".gitignore")
33
+ gitignore = File.readlines(gitignore_path)
34
+ gitignore.map! { |line| line.chomp.strip }
35
+ gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
36
+
37
+ unignored_files = all_files.reject do |file|
38
+ # Ignore any directories, the gemspec only cares about files
39
+ next true if File.directory?(file)
40
+
41
+ # Ignore any paths that match anything in the gitignore. We do
42
+ # two tests here:
43
+ #
44
+ # - First, test to see if the entire path matches the gitignore.
45
+ # - Second, match if the basename does, this makes it so that things
46
+ # like '.DS_Store' will match sub-directories too (same behavior
47
+ # as git).
48
+ #
49
+ gitignore.any? do |ignore|
50
+ File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
51
+ File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
52
+ end
53
+ end
54
+
55
+ s.files = unignored_files
56
+ s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
57
+ s.require_path = 'lib'
58
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tnargav-aws
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mitchell Hashimoto
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: fog
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.10.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.10.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec-core
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.12.2
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.12.2
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec-expectations
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.12.1
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.12.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec-mocks
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 2.12.1
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.12.1
94
+ description: Enables Vagrant to manage machines in EC2 and VPC.
95
+ email: mitchell@hashicorp.com
96
+ executables: []
97
+ extensions: []
98
+ extra_rdoc_files: []
99
+ files:
100
+ - CHANGELOG.md
101
+ - dummy.box
102
+ - example_box/metadata.json
103
+ - example_box/README.md
104
+ - Gemfile
105
+ - lib/vagrant-aws/action/connect_aws.rb
106
+ - lib/vagrant-aws/action/is_created.rb
107
+ - lib/vagrant-aws/action/message_already_created.rb
108
+ - lib/vagrant-aws/action/message_not_created.rb
109
+ - lib/vagrant-aws/action/read_ssh_info.rb
110
+ - lib/vagrant-aws/action/read_state.rb
111
+ - lib/vagrant-aws/action/run_instance.rb
112
+ - lib/vagrant-aws/action/sync_folders.rb
113
+ - lib/vagrant-aws/action/terminate_instance.rb
114
+ - lib/vagrant-aws/action/timed_provision.rb
115
+ - lib/vagrant-aws/action/warn_networks.rb
116
+ - lib/vagrant-aws/action.rb
117
+ - lib/vagrant-aws/config.rb
118
+ - lib/vagrant-aws/errors.rb
119
+ - lib/vagrant-aws/plugin.rb
120
+ - lib/vagrant-aws/provider.rb
121
+ - lib/vagrant-aws/util/timer.rb
122
+ - lib/vagrant-aws/version.rb
123
+ - lib/vagrant-aws.rb
124
+ - LICENSE
125
+ - locales/en.yml
126
+ - Rakefile
127
+ - README.md
128
+ - spec/vagrant-aws/config_spec.rb
129
+ - tnargav-aws.gemspec
130
+ - vagrant-aws.gemspec
131
+ - .gitignore
132
+ - .gitsetup.yml
133
+ homepage: http://www.vagrantup.com
134
+ licenses: []
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ! '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ! '>='
149
+ - !ruby/object:Gem::Version
150
+ version: 1.3.6
151
+ requirements: []
152
+ rubyforge_project: vagrant-aws
153
+ rubygems_version: 1.8.25
154
+ signing_key:
155
+ specification_version: 3
156
+ summary: Enables Vagrant to manage machines in EC2 and VPC.
157
+ test_files: []