vagrant-cloudstack 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f71a9d5b05706c2e193708960acdcf57c0ac719
4
- data.tar.gz: 9551a14cae770c185ccec397d44bdf28e6267122
3
+ metadata.gz: d8a5fb6d4705653f7d21a743fefd04d85835221b
4
+ data.tar.gz: 11f800be47556f82ee523d4f2b8d922ff43282f7
5
5
  SHA512:
6
- metadata.gz: f7179025213a3050fa790e881e675c697df1db2e0529f7bed0acb3b65ffbc071c7f5ef3d9f4ebcbb7c4817b9e1bcccc59e12f0a9f6daf69e1fb295a4832f76f7
7
- data.tar.gz: d25a50cfdc056d833b71a89a59eb13e5da47355b7def7cb43567595309749ec56545e896a5b15a3d03d7c283f308b79b9caf2db9413ab60e76cef9d8028dfee8
6
+ metadata.gz: aa716e9e7f67ecf57162a41b4bf22618059a5434fc6150c9774c3123a505b7cc99cfe24202e3a92bab295737120c265b0a42de0a6e221e4bd3ed70ac56ab9117
7
+ data.tar.gz: ac00112e1d8d52bbe1869e2357e306c33657095612b7db86362cefaaa8cae62e204313d4ca4274952d9d5f44efe8aa517b4866a34e70587af89fcc0db92d117a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # 0.5.0 (Apr 29, 2014)
2
+
3
+ * Use latest version of upstream fog which contains some much needed
4
+ improvements to the Cloudstack support. Closes #10 for example.
5
+
6
+ # 0.4.3 (Apr 15, 2014)
7
+
8
+ * Update README to reflect Vagrant version needed
9
+
10
+ # 0.4.2 (Apr 15, 2014)
11
+
12
+ * Add support for userdata
13
+
14
+ # 0.4.1 (Apr 14, 2014)
15
+
16
+ * Add support for cygwin paths
17
+
1
18
  # 0.4.0 (Mar 30, 2014)
2
19
 
3
20
  * Fix for Vagrant > =1.5 [GH-29]
data/Gemfile CHANGED
@@ -8,3 +8,6 @@ group :development do
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
9
  gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
10
10
  end
11
+
12
+ gem 'coveralls', require: false
13
+
data/README.md CHANGED
@@ -3,13 +3,15 @@
3
3
  [![Build Status](https://travis-ci.org/klarna/vagrant-cloudstack.png?branch=master)](https://travis-ci.org/klarna/vagrant-cloudstack)
4
4
  [![Gem Version](https://badge.fury.io/rb/vagrant-cloudstack.png)](http://badge.fury.io/rb/vagrant-cloudstack)
5
5
  [![Dependency Status](https://gemnasium.com/klarna/vagrant-cloudstack.png)](https://gemnasium.com/klarna/vagrant-cloudstack)
6
+ [![Code climate](https://codeclimate.com/github/klarna/vagrant-cloudstack.png)](https://codeclimate.com/github/klarna/vagrant-cloudstac)
7
+ [![Coverage Status](https://coveralls.io/repos/klarna/vagrant-cloudstack/badge.png)](https://coveralls.io/r/klarna/vagrant-cloudstack)
6
8
 
7
9
  This is a fork of [mitchellh AWS Provider](https://github.com/mitchellh/vagrant-aws/).
8
10
 
9
11
  This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [Cloudstack](http://cloudstack.apache.org)
10
12
  provider to Vagrant.
11
13
 
12
- **NOTE:** This plugin requires Vagrant 1.2+,
14
+ **NOTE:** This plugin requires Vagrant 1.5+, since v0.4.0.
13
15
 
14
16
  ## Features
15
17
 
@@ -178,6 +180,26 @@ the remote machine over SSH.
178
180
  This is good enough for all built-in Vagrant provisioners (shell,
179
181
  chef, and puppet) to work!
180
182
 
183
+ ### User data
184
+
185
+ You can specify user data for the instance being booted.
186
+
187
+ ```ruby
188
+ Vagrant.configure("2") do |config|
189
+ # ... other stuff
190
+
191
+ config.vm.provider :cloudstack do |cloudstack|
192
+ # Option 1: a single string
193
+ cloudstack.user_data = "#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"
194
+
195
+ # Option 2: use a file
196
+ cloudstack.user_data = File.read("user_data.txt")
197
+ end
198
+ end
199
+ ```
200
+
201
+ The maximum length of user_data is around 1500 bytes with Cloudstack API < 4.2 ( base64 encoded user_data must be < 2048 bytes)
202
+
181
203
  ## Development
182
204
 
183
205
  To work on the `vagrant-cloudstack` plugin, clone this repository out, and use
data/build_rpm.sh CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
- VERSION=0.4.0
2
+ VERSION=0.5.0
3
3
  mkdir -p /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION
4
4
  cp -r . /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION/
5
5
  tar -C /tmp/vagrant-cloudstack-build_rpm.$$/ -czf ~/rpmbuild/SOURCES/vagrant-cloudstack-$VERSION.tar.gz vagrant-cloudstack-$VERSION
@@ -42,6 +42,7 @@ module VagrantPlugins
42
42
  security_group_ids = domain_config.security_group_ids
43
43
  security_group_names = domain_config.security_group_names
44
44
  security_groups = domain_config.security_groups
45
+ user_data = domain_config.user_data
45
46
 
46
47
  # If there is no keypair then warn the user
47
48
  if !keypair
@@ -85,6 +86,7 @@ module VagrantPlugins
85
86
  env[:ui].info(" -- Zone UUID: #{zone_id}")
86
87
  env[:ui].info(" -- Network UUID: #{network_id}") if network_id
87
88
  env[:ui].info(" -- Keypair: #{keypair}") if keypair
89
+ env[:ui].info(" -- User Data: Yes") if user_data
88
90
  if !security_group_ids.nil?
89
91
  security_group_ids.each do |security_group_id|
90
92
  env[:ui].info(" -- Security Group ID: #{security_group_id}")
@@ -175,6 +177,14 @@ module VagrantPlugins
175
177
  options['project_id'] = project_id if project_id != nil
176
178
  options['key_name'] = keypair if keypair != nil
177
179
 
180
+ if user_data != nil
181
+ options['user_data'] = Base64.encode64(user_data)
182
+ if options['user_data'].length > 2048
183
+ raise Errors::UserdataError,
184
+ :userdataLength => options['user_data'].length
185
+ end
186
+ end
187
+
178
188
  server = env[:cloudstack_compute].servers.create(options)
179
189
  rescue Fog::Compute::Cloudstack::NotFound => e
180
190
  # Invalid subnet doesn't have its own error so we catch and
@@ -123,6 +123,12 @@ module VagrantPlugins
123
123
  # @return [String]
124
124
  attr_accessor :group
125
125
 
126
+ # The user data string
127
+ #
128
+ # @return [String]
129
+ attr_accessor :user_data
130
+
131
+
126
132
  def initialize(domain_specific=false)
127
133
  @host = UNSET_VALUE
128
134
  @path = UNSET_VALUE
@@ -147,6 +153,8 @@ module VagrantPlugins
147
153
  @group = UNSET_VALUE
148
154
  @security_group_names = UNSET_VALUE
149
155
  @security_groups = UNSET_VALUE
156
+ @user_data = UNSET_VALUE
157
+
150
158
 
151
159
  # Internal state (prefix with __ so they aren't automatically
152
160
  # merged)
@@ -286,6 +294,9 @@ module VagrantPlugins
286
294
  # Group must be nil, since we can't default that
287
295
  @group = nil if @group == UNSET_VALUE
288
296
 
297
+ # User Data is nil by default
298
+ @user_data = nil if @user_data == UNSET_VALUE
299
+
289
300
  # Compile our domain specific configurations only within
290
301
  # NON-DOMAIN-SPECIFIC configurations.
291
302
  if !@__domain_specific
@@ -18,6 +18,10 @@ module VagrantPlugins
18
18
  class RsyncError < VagrantCloudstackError
19
19
  error_key(:rsync_error)
20
20
  end
21
+
22
+ class UserdataError < VagrantCloudstackError
23
+ error_key(:user_data_error)
24
+ end
21
25
  end
22
26
  end
23
27
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Cloudstack
3
- VERSION = "0.4.1"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -69,6 +69,8 @@ en:
69
69
  Host path: %{hostpath}
70
70
  Guest path: %{guestpath}
71
71
  Error: %{stderr}
72
+ user_data_error: |-
73
+ The base64 encoded user data length (%{userdataLength}) is greater than 2048.
72
74
 
73
75
  states:
74
76
  short_not_created: |-
@@ -1,5 +1,8 @@
1
1
  require "vagrant-cloudstack/config"
2
2
 
3
+ require 'coveralls'
4
+ Coveralls.wear!
5
+
3
6
  describe VagrantPlugins::Cloudstack::Config do
4
7
  let(:instance) { described_class.new }
5
8
 
@@ -37,6 +40,7 @@ describe VagrantPlugins::Cloudstack::Config do
37
40
  its("group") { should be_nil }
38
41
  its("security_group_names") { should be_nil }
39
42
  its("security_groups") { should be_nil }
43
+ its("user_data") { should be_nil }
40
44
  end
41
45
 
42
46
  describe "overriding defaults" do
@@ -46,7 +50,7 @@ describe VagrantPlugins::Cloudstack::Config do
46
50
  # and asserts the proper result comes back out.
47
51
  [:api_key, :template_id, :zone_id, :instance_ready_timeout,
48
52
  :service_offering_id, :api_key,
49
- :secret_key, :network_id].each do |attribute|
53
+ :secret_key, :network_id, :user_data].each do |attribute|
50
54
 
51
55
  it "should not default #{attribute} if overridden" do
52
56
  instance.send("#{attribute}=".to_sym, "foo")
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.required_rubygems_version = ">= 1.3.6"
16
16
  s.rubyforge_project = "vagrant-cloudstack"
17
17
 
18
- s.add_runtime_dependency "fog", "~> 1.20.0"
18
+ s.add_runtime_dependency "fog", "~> 1.22.0"
19
19
 
20
20
  s.add_development_dependency "rake"
21
21
  s.add_development_dependency "rspec-core", "~> 2.14.7"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-cloudstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2014-04-14 00:00:00.000000000 Z
21
+ date: 2014-04-29 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: fog
@@ -26,14 +26,14 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.20.0
29
+ version: 1.22.0
30
30
  type: :runtime
31
31
  prerelease: false
32
32
  version_requirements: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - ~>
35
35
  - !ruby/object:Gem::Version
36
- version: 1.20.0
36
+ version: 1.22.0
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rake
39
39
  requirement: !ruby/object:Gem::Requirement