vagrant-cloudstack 0.0.5

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 Cloudstack
3
+ VERSION = "0.0.5"
4
+ end
5
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,72 @@
1
+ en:
2
+ vagrant_cloudstack:
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_not_found_warning: |-
20
+ Warning! Folder sync disabled because the rsync binary is missing.
21
+ Make sure rsync is installed and the binary can be found in the PATH.
22
+ rsync_folder: |-
23
+ Rsyncing folder: %{hostpath} => %{guestpath}
24
+ terminating: |-
25
+ Terminating the instance...
26
+ waiting_for_ready: |-
27
+ Waiting for instance to become "ready"...
28
+ waiting_for_ssh: |-
29
+ Waiting for SSH to become available...
30
+ warn_networks: |-
31
+ Warning! The Cloudstack provider doesn't support any of the Vagrant
32
+ high-level network configurations (`config.vm.network`). They
33
+ will be silently ignored.
34
+
35
+ config:
36
+ api_key_required: |-
37
+ An access key ID must be specified via "api_key"
38
+ template_id_required: |-
39
+ A template_id must be configured via "template_id"
40
+ secret_key_missing: |-
41
+ The specified secret key for Cloudstack could not be found
42
+
43
+ errors:
44
+ fog_error: |-
45
+ There was an error talking to Cloudstack. The error message is shown
46
+ below:
47
+
48
+ %{message}
49
+ instance_ready_timeout: |-
50
+ The instance never became "ready" in Cloudstack. The timeout currently
51
+ set waiting for the instance to become ready is %{timeout} seconds.
52
+ Please verify that the machine properly boots. If you need more time
53
+ set the `instance_ready_timeout` configuration on the Cloudstack provider.
54
+ rsync_error: |-
55
+ There was an error when attemping to rsync a share folder.
56
+ Please inspect the error message below for more info.
57
+
58
+ Host path: %{hostpath}
59
+ Guest path: %{guestpath}
60
+ Error: %{stderr}
61
+
62
+ states:
63
+ short_not_created: |-
64
+ not created
65
+ long_not_created: |-
66
+ The instance is not created. Run `vagrant up` to create it.
67
+
68
+ short_Running: |-
69
+ running
70
+ long_Running: |-
71
+ The instance is running. To stop this machine, you can run
72
+ `vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
@@ -0,0 +1,191 @@
1
+ require "vagrant-cloudstack/config"
2
+
3
+ describe VagrantPlugins::Cloudstack::Config do
4
+ let(:instance) { described_class.new }
5
+
6
+ # Ensure tests are not affected by Cloudstack 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("host") { should be_nil }
19
+ its("path") { should be_nil }
20
+ its("port") { should be_nil }
21
+ its("scheme") { should == "http" }
22
+ its("api_key") { should be_nil }
23
+ its("secret_key") { should be_nil }
24
+ its("instance_ready_timeout") { should == 120 }
25
+ its("domain_id") { should be_nil }
26
+ its("network_id") { should be_nil }
27
+ its("project_id") { should be_nil }
28
+ its("service_offering_id") { should be_nil }
29
+ its("template_id") { should be_nil }
30
+ its("zone_id") { should be_nil }
31
+ end
32
+
33
+ describe "overriding defaults" do
34
+ # I typically don't meta-program in tests, but this is a very
35
+ # simple boilerplate test, so I cut corners here. It just sets
36
+ # each of these attributes to "foo" in isolation, and reads the value
37
+ # and asserts the proper result comes back out.
38
+ [:api_key, :template_id, :zone_id, :instance_ready_timeout,
39
+ :service_offering_id, :api_key,
40
+ :secret_key, :network_id].each do |attribute|
41
+
42
+ it "should not default #{attribute} if overridden" do
43
+ instance.send("#{attribute}=".to_sym, "foo")
44
+ instance.finalize!
45
+ instance.send(attribute).should == "foo"
46
+ end
47
+ end
48
+ end
49
+
50
+ describe "getting credentials from environment" do
51
+ context "without Cloudstack credential environment variables" do
52
+ subject do
53
+ instance.tap do |o|
54
+ o.finalize!
55
+ end
56
+ end
57
+
58
+ its("api_key") { should be_nil }
59
+ its("secret_key") { should be_nil }
60
+ end
61
+
62
+ end
63
+
64
+ describe "domain config" do
65
+ let(:config_host) { "foo" }
66
+ let(:config_path) { "foo" }
67
+ let(:config_port) { "foo" }
68
+ let(:config_scheme) { "foo" }
69
+ let(:config_api_key) { "foo" }
70
+ let(:config_secret_key) { "foo" }
71
+ let(:config_instance_ready_timeout) { 11111 }
72
+ let(:config_domain_id) { "foo" }
73
+ let(:config_network_id) { "foo" }
74
+ let(:config_project_id) { "foo" }
75
+ let(:config_service_offering_id) { "foo" }
76
+ let(:config_template_id) { "foo" }
77
+ let(:config_zone_id) { "foo" }
78
+
79
+ def set_test_values(instance)
80
+ instance.host = config_host
81
+ instance.path = config_path
82
+ instance.port = config_port
83
+ instance.scheme = config_scheme
84
+ instance.api_key = config_api_key
85
+ instance.secret_key = config_secret_key
86
+ instance.instance_ready_timeout = config_instance_ready_timeout
87
+ instance.domain_id = config_domain_id
88
+ instance.network_id = config_network_id
89
+ instance.project_id = config_project_id
90
+ instance.service_offering_id = config_service_offering_id
91
+ instance.template_id = config_template_id
92
+ instance.zone_id = config_zone_id
93
+ end
94
+
95
+ it "should raise an exception if not finalized" do
96
+ expect { instance.get_domain_config("default") }.
97
+ to raise_error
98
+ end
99
+
100
+ context "with no specific config set" do
101
+ subject do
102
+ # Set the values on the top-level object
103
+ set_test_values(instance)
104
+
105
+ # Finalize so we can get the domain config
106
+ instance.finalize!
107
+
108
+ # Get a lower level domain
109
+ instance.get_domain_config("default")
110
+ end
111
+
112
+ its("host") { should == config_host }
113
+ its("path") { should == config_path }
114
+ its("port") { should == config_port }
115
+ its("scheme") { should == config_scheme }
116
+ its("api_key") { should == config_api_key }
117
+ its("secret_key") { should == config_secret_key }
118
+ its("instance_ready_timeout") { should == config_instance_ready_timeout }
119
+ its("domain_id") { should == config_domain_id }
120
+ its("network_id") { should == config_network_id }
121
+ its("project_id") { should == config_project_id }
122
+ its("service_offering_id") { should == config_service_offering_id }
123
+ its("template_id") { should == config_template_id }
124
+ its("zone_id") { should == config_zone_id }
125
+ end
126
+
127
+ context "with a specific config set" do
128
+ let(:domain_name) { "hashi-domain" }
129
+
130
+ subject do
131
+ # Set the values on a specific domain
132
+ instance.domain_config domain_name do |config|
133
+ set_test_values(config)
134
+ end
135
+
136
+ # Finalize so we can get the domain config
137
+ instance.finalize!
138
+
139
+ # Get the domain
140
+ instance.get_domain_config(domain_name)
141
+ end
142
+
143
+ its("host") { should == config_host }
144
+ its("path") { should == config_path }
145
+ its("port") { should == config_port }
146
+ its("scheme") { should == config_scheme }
147
+ its("api_key") { should == config_api_key }
148
+ its("secret_key") { should == config_secret_key }
149
+ its("instance_ready_timeout") { should == config_instance_ready_timeout }
150
+ its("domain_id") { should == config_domain_id }
151
+ its("network_id") { should == config_network_id }
152
+ its("project_id") { should == config_project_id }
153
+ its("service_offering_id") { should == config_service_offering_id }
154
+ its("template_id") { should == config_template_id }
155
+ its("zone_id") { should == config_zone_id }
156
+ end
157
+
158
+ describe "inheritance of parent config" do
159
+ let(:domain_name) { "hashi-domain" }
160
+
161
+ subject do
162
+ # Set the values on a specific domain
163
+ instance.domain_config domain_name do |config|
164
+ config.template_id = "child"
165
+ end
166
+
167
+ # Set some top-level values
168
+ instance.api_key = "parent"
169
+ instance.template_id = "parent"
170
+
171
+ # Finalize and get the domain
172
+ instance.finalize!
173
+ instance.get_domain_config(domain_name)
174
+ end
175
+
176
+ its("api_key") { should == "parent" }
177
+ its("template_id") { should == "child" }
178
+ end
179
+
180
+ describe "shortcut configuration" do
181
+ subject do
182
+ # Use the shortcut configuration to set some values
183
+ instance.domain_config "Domain1", :template_id => "child"
184
+ instance.finalize!
185
+ instance.get_domain_config("Domain1")
186
+ end
187
+
188
+ its("template_id") { should == "child" }
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,58 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+ require "vagrant-cloudstack/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "vagrant-cloudstack"
6
+ s.version = VagrantPlugins::Cloudstack::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Mitchell Hashimoto", "Carl Loa Odin", "Tor-Åke Fransson", "Roeland Kuipers", "atsaki"]
9
+ s.email = "carlodin@gmail.com"
10
+ s.homepage = "https://github.com/klarna/vagrant-cloudstack/"
11
+ s.summary = "Enables Vagrant to manage machines in Cloudstack."
12
+ s.description = "Enables Vagrant to manage machines in Cloudstack."
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.rubyforge_project = "vagrant-cloudstack"
16
+
17
+ s.add_runtime_dependency "fog", "~> 1.15.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,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-cloudstack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ platform: ruby
6
+ authors:
7
+ - Mitchell Hashimoto
8
+ - Carl Loa Odin
9
+ - Tor-Åke Fransson
10
+ - Roeland Kuipers
11
+ - atsaki
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2013-10-28 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: fog
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.15.0
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 1.15.0
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
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
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ - !ruby/object:Gem::Dependency
46
+ name: rspec-core
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ~>
50
+ - !ruby/object:Gem::Version
51
+ version: 2.12.2
52
+ type: :development
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ version: 2.12.2
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec-expectations
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 2.12.1
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: 2.12.1
73
+ - !ruby/object:Gem::Dependency
74
+ name: rspec-mocks
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: 2.12.1
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: 2.12.1
87
+ description: Enables Vagrant to manage machines in Cloudstack.
88
+ email: carlodin@gmail.com
89
+ executables: []
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - CHANGELOG.md
94
+ - dummy.box
95
+ - example_box/metadata.json
96
+ - example_box/README.md
97
+ - Gemfile
98
+ - lib/vagrant-cloudstack/action/connect_cloudstack.rb
99
+ - lib/vagrant-cloudstack/action/is_created.rb
100
+ - lib/vagrant-cloudstack/action/message_already_created.rb
101
+ - lib/vagrant-cloudstack/action/message_not_created.rb
102
+ - lib/vagrant-cloudstack/action/read_ssh_info.rb
103
+ - lib/vagrant-cloudstack/action/read_state.rb
104
+ - lib/vagrant-cloudstack/action/run_instance.rb
105
+ - lib/vagrant-cloudstack/action/sync_folders.rb
106
+ - lib/vagrant-cloudstack/action/terminate_instance.rb
107
+ - lib/vagrant-cloudstack/action/timed_provision.rb
108
+ - lib/vagrant-cloudstack/action/warn_networks.rb
109
+ - lib/vagrant-cloudstack/action.rb
110
+ - lib/vagrant-cloudstack/config.rb
111
+ - lib/vagrant-cloudstack/errors.rb
112
+ - lib/vagrant-cloudstack/plugin.rb
113
+ - lib/vagrant-cloudstack/provider.rb
114
+ - lib/vagrant-cloudstack/util/timer.rb
115
+ - lib/vagrant-cloudstack/version.rb
116
+ - lib/vagrant-cloudstack.rb
117
+ - LICENSE
118
+ - locales/en.yml
119
+ - Rakefile
120
+ - README.md
121
+ - spec/vagrant-cloudstack/config_spec.rb
122
+ - vagrant-cloudstack.gemspec
123
+ - .gitignore
124
+ - .travis.yml
125
+ homepage: https://github.com/klarna/vagrant-cloudstack/
126
+ licenses: []
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 1.3.6
142
+ requirements: []
143
+ rubyforge_project: vagrant-cloudstack
144
+ rubygems_version: 2.0.3
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Enables Vagrant to manage machines in Cloudstack.
148
+ test_files: []