vagrant-rackspace 0.1.2 → 0.1.3
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 +8 -8
- data/CHANGELOG.md +8 -0
- data/README.md +5 -2
- data/lib/vagrant-rackspace/action/connect_rackspace.rb +16 -18
- data/lib/vagrant-rackspace/action/create_server.rb +2 -0
- data/lib/vagrant-rackspace/config.rb +41 -3
- data/lib/vagrant-rackspace/version.rb +1 -1
- data/spec/vagrant-rackspace/config_spec.rb +54 -0
- data/vagrant-rackspace.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzA0YzJmYjA0ZTg4OTU4YmJjOWU3ZjMwNTU1YzNkYWM4NDA2OTI3MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjE5MDEyNGQ3NmZiZjg2NTVjYWVhOGI3MGE4YTkzODFjMjJjODE0MA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmJiZTg2MDJkNTBlNjRjMDc2NjE3ZjZiOTg0N2MwZTUwN2VhYWZjYzY0M2Fl
|
10
|
+
ODQxNzRkNjNjOWZkOTNhOTVlNzM1NmJmNzFlOTUzZTAxNzhhZTMwMTQ4YjE2
|
11
|
+
OTc0YWViN2EyODc1NjcyMDBjOTIyOWM5ZDMzNTNlZWFkYjliMDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2FiMjc4OGQ1YTA3YzY3NTQ4M2Y4ZTc3N2YyOTA4ODFmYTRjY2ZlMDkxN2M4
|
14
|
+
OGNiZmY1ZTQ2ODZjYjYxODQzNmQyMWQzMmNkMjg2YmI1MDQwMDNhMmI0Yzhl
|
15
|
+
NjMwZTM4ODRmYmYwMmQ5MTk2ZmY4OTRjMTVkNzFmYzQ4MjJmNjg=
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -91,9 +91,11 @@ This provider exposes quite a few provider-specific configuration options:
|
|
91
91
|
exact ID or name of the image, or this can be a regular expression to
|
92
92
|
partially match some image.
|
93
93
|
* `rackspace_region` - The region to hit. By default this is :dfw. Valid options are:
|
94
|
-
:dfw, :ord, :lon.
|
94
|
+
:dfw, :ord, :lon, :iad, :syd. Users should preference using this setting over `rackspace_compute_url` setting.
|
95
95
|
* `rackspace_compute_url` - The compute_url to hit. This is good for custom endpoints.
|
96
|
-
|
96
|
+
* `rackspace_auth_url` - The endpoint to authentication against. By default, vagrant will use the global
|
97
|
+
rackspace authentication endpoint for all regions with the exception of :lon. IF :lon region is specified
|
98
|
+
vagrant will authenticate against the UK authentication endpoint.
|
97
99
|
* `public_key_path` - The path to a public key to initialize with the remote
|
98
100
|
server. This should be the matching pair for the private key configured
|
99
101
|
with `config.ssh.private_key_path` on Vagrant.
|
@@ -101,6 +103,7 @@ Use this OR rackspace_region.
|
|
101
103
|
defaults to the name of the Vagrant machine (via `config.vm.define`), but
|
102
104
|
can be overridden with this.
|
103
105
|
* `username` - The username with which to access Rackspace.
|
106
|
+
* `disk_config` - Disk Configuration 'AUTO' or 'MANUAL'
|
104
107
|
|
105
108
|
These can be set like typical provider-specific configuration:
|
106
109
|
|
@@ -19,25 +19,23 @@ module VagrantPlugins
|
|
19
19
|
api_key = config.api_key
|
20
20
|
username = config.username
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
params = {
|
23
|
+
:provider => :rackspace,
|
24
|
+
:version => :v2,
|
25
|
+
:rackspace_api_key => api_key,
|
26
|
+
:rackspace_username => username,
|
27
|
+
:rackspace_auth_url => config.rackspace_auth_url
|
28
|
+
}
|
29
|
+
|
30
|
+
if config.rackspace_compute_url
|
31
|
+
@logger.info("Connecting to Rackspace compute_url...")
|
32
|
+
params[:rackspace_compute_url] = config.rackspace_compute_url
|
31
33
|
else
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
:rackspace_compute_url => config.rackspace_compute_url,
|
38
|
-
:rackspace_username => username
|
39
|
-
})
|
40
|
-
end
|
34
|
+
@logger.info("Connecting to Rackspace region...")
|
35
|
+
params[:rackspace_region] = config.rackspace_region
|
36
|
+
end
|
37
|
+
|
38
|
+
env[:rackspace_compute] = Fog::Compute.new params
|
41
39
|
|
42
40
|
@app.call(env)
|
43
41
|
end
|
@@ -44,6 +44,7 @@ module VagrantPlugins
|
|
44
44
|
env[:ui].info(I18n.t("vagrant_rackspace.launching_server"))
|
45
45
|
env[:ui].info(" -- Flavor: #{flavor.name}")
|
46
46
|
env[:ui].info(" -- Image: #{image.name}")
|
47
|
+
env[:ui].info(" -- Disk Config: #{config.disk_config}") if config.disk_config
|
47
48
|
env[:ui].info(" -- Name: #{server_name}")
|
48
49
|
|
49
50
|
# Build the options for launching...
|
@@ -58,6 +59,7 @@ module VagrantPlugins
|
|
58
59
|
}
|
59
60
|
]
|
60
61
|
}
|
62
|
+
options[:disk_config] = config.disk_config if config.disk_config
|
61
63
|
|
62
64
|
# Create the server
|
63
65
|
server = env[:rackspace_compute].servers.create(options)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "vagrant"
|
2
|
+
require "fog"
|
2
3
|
|
3
4
|
module VagrantPlugins
|
4
5
|
module Rackspace
|
@@ -14,7 +15,7 @@ module VagrantPlugins
|
|
14
15
|
#
|
15
16
|
# expected to be a symbol - :dfw (default), :ord, :lon
|
16
17
|
#
|
17
|
-
#
|
18
|
+
# Users should preference the rackspace_region setting over rackspace_compute_url
|
18
19
|
attr_accessor :rackspace_region
|
19
20
|
|
20
21
|
# The compute_url to access RackSpace. If nil, it will default
|
@@ -31,9 +32,14 @@ module VagrantPlugins
|
|
31
32
|
# Fog::Compute::RackspaceV2::ORD_ENDPOINT
|
32
33
|
# Fog::Compute::RackspaceV2::LON_ENDPOINT
|
33
34
|
#
|
34
|
-
#
|
35
|
+
# Users should preference the rackspace_region setting over rackspace_compute_url
|
35
36
|
attr_accessor :rackspace_compute_url
|
36
37
|
|
38
|
+
# The authenication endpoint. This defaults to Rackspace's global authentication endpoint.
|
39
|
+
# Users of the London data center should specify the following:
|
40
|
+
# https://lon.identity.api.rackspacecloud.com/v2.0
|
41
|
+
attr_writer :rackspace_auth_url
|
42
|
+
|
37
43
|
# The flavor of server to launch, either the ID or name. This
|
38
44
|
# can also be a regular expression to partially match a name.
|
39
45
|
attr_accessor :flavor
|
@@ -63,33 +69,59 @@ module VagrantPlugins
|
|
63
69
|
# @return [String]
|
64
70
|
attr_accessor :username
|
65
71
|
|
72
|
+
# The disk configuration value.
|
73
|
+
# * AUTO - The server is built with a single partition the size of the target flavor disk. The file system is automatically adjusted to fit the entire partition.
|
74
|
+
# This keeps things simple and automated. AUTO is valid only for images and servers with a single partition that use the EXT3 file system.
|
75
|
+
# This is the default setting for applicable Rackspace base images.
|
76
|
+
#
|
77
|
+
# * MANUAL - The server is built using whatever partition scheme and file system is in the source image. If the target flavor disk is larger,
|
78
|
+
# the remaining disk space is left unpartitioned. This enables images to have non-EXT3 file systems, multiple partitions,
|
79
|
+
# and so on, and enables you to manage the disk configuration.
|
80
|
+
#
|
81
|
+
# This defaults to MANUAL
|
82
|
+
attr_accessor :disk_config
|
83
|
+
|
66
84
|
def initialize
|
67
85
|
@api_key = UNSET_VALUE
|
68
86
|
@rackspace_region = UNSET_VALUE
|
69
87
|
@rackspace_compute_url = UNSET_VALUE
|
88
|
+
@rackspace_auth_url = UNSET_VALUE
|
70
89
|
@flavor = UNSET_VALUE
|
71
90
|
@image = UNSET_VALUE
|
72
91
|
@public_key_path = UNSET_VALUE
|
73
92
|
@rackconnect = UNSET_VALUE
|
74
93
|
@server_name = UNSET_VALUE
|
75
94
|
@username = UNSET_VALUE
|
95
|
+
@disk_config = UNSET_VALUE
|
76
96
|
end
|
77
97
|
|
78
98
|
def finalize!
|
79
99
|
@api_key = nil if @api_key == UNSET_VALUE
|
80
100
|
@rackspace_region = nil if @rackspace_region == UNSET_VALUE
|
81
101
|
@rackspace_compute_url = nil if @rackspace_compute_url == UNSET_VALUE
|
102
|
+
@rackspace_auth_url = nil if @rackspace_auth_url == UNSET_VALUE
|
82
103
|
@flavor = /512MB/ if @flavor == UNSET_VALUE
|
83
104
|
@image = /Ubuntu/ if @image == UNSET_VALUE
|
84
|
-
@rackconnect =
|
105
|
+
@rackconnect = nil if @rackconnect == UNSET_VALUE
|
85
106
|
@server_name = nil if @server_name == UNSET_VALUE
|
86
107
|
@username = nil if @username == UNSET_VALUE
|
108
|
+
@disk_config = nil if @disk_config == UNSET_VALUE
|
87
109
|
|
88
110
|
if @public_key_path == UNSET_VALUE
|
89
111
|
@public_key_path = Vagrant.source_root.join("keys/vagrant.pub")
|
90
112
|
end
|
91
113
|
end
|
92
114
|
|
115
|
+
# @note Currently, you must authenticate against the UK authenication endpoint to access the London Data center.
|
116
|
+
# Hopefully this method makes the experience more seemless for users of the UK cloud.
|
117
|
+
def rackspace_auth_url
|
118
|
+
if (@rackspace_auth_url.nil? || @rackspace_auth_url == UNSET_VALUE) && lon_region?
|
119
|
+
Fog::Rackspace::UK_AUTH_ENDPOINT
|
120
|
+
else
|
121
|
+
@rackspace_auth_url
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
93
125
|
def validate(machine)
|
94
126
|
errors = []
|
95
127
|
|
@@ -103,6 +135,12 @@ module VagrantPlugins
|
|
103
135
|
|
104
136
|
{ "RackSpace Provider" => errors }
|
105
137
|
end
|
138
|
+
|
139
|
+
private
|
140
|
+
|
141
|
+
def lon_region?
|
142
|
+
rackspace_region && rackspace_region != UNSET_VALUE && rackspace_region.to_sym == :lon
|
143
|
+
end
|
106
144
|
end
|
107
145
|
end
|
108
146
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "vagrant-rackspace/config"
|
2
|
+
require 'fog'
|
2
3
|
|
3
4
|
describe VagrantPlugins::Rackspace::Config do
|
4
5
|
describe "defaults" do
|
@@ -13,23 +14,27 @@ describe VagrantPlugins::Rackspace::Config do
|
|
13
14
|
its(:api_key) { should be_nil }
|
14
15
|
its(:rackspace_region) { should be_nil }
|
15
16
|
its(:rackspace_compute_url) { should be_nil }
|
17
|
+
its(:rackspace_auth_url) { should be_nil }
|
16
18
|
its(:flavor) { should eq(/512MB/) }
|
17
19
|
its(:image) { should eq(/Ubuntu/) }
|
18
20
|
its(:public_key_path) { should eql(vagrant_public_key) }
|
19
21
|
its(:rackconnect) { should be_nil }
|
20
22
|
its(:server_name) { should be_nil }
|
21
23
|
its(:username) { should be_nil }
|
24
|
+
its(:disk_config) { should be_nil }
|
22
25
|
end
|
23
26
|
|
24
27
|
describe "overriding defaults" do
|
25
28
|
[:api_key,
|
26
29
|
:rackspace_region,
|
27
30
|
:rackspace_compute_url,
|
31
|
+
:rackspace_auth_url,
|
28
32
|
:flavor,
|
29
33
|
:image,
|
30
34
|
:public_key_path,
|
31
35
|
:rackconnect,
|
32
36
|
:server_name,
|
37
|
+
:disk_config,
|
33
38
|
:username].each do |attribute|
|
34
39
|
it "should not default #{attribute} if overridden" do
|
35
40
|
subject.send("#{attribute}=".to_sym, "foo")
|
@@ -66,4 +71,53 @@ describe VagrantPlugins::Rackspace::Config do
|
|
66
71
|
it "should error if not given"
|
67
72
|
end
|
68
73
|
end
|
74
|
+
|
75
|
+
describe "rackspace_auth_url" do
|
76
|
+
it "should return UNSET_VALUE if rackspace_auth_url and rackspace_region are UNSET" do
|
77
|
+
subject.rackspace_auth_url.should == VagrantPlugins::Rackspace::Config::UNSET_VALUE
|
78
|
+
end
|
79
|
+
it "should return UNSET_VALUE if rackspace_auth_url is UNSET and rackspace_region is :ord" do
|
80
|
+
subject.rackspace_region = :ord
|
81
|
+
subject.rackspace_auth_url.should == VagrantPlugins::Rackspace::Config::UNSET_VALUE
|
82
|
+
end
|
83
|
+
it "should return UK Authentication endpoint if rackspace_auth_url is UNSET and rackspace_region is :lon" do
|
84
|
+
subject.rackspace_region = :lon
|
85
|
+
subject.rackspace_auth_url.should == Fog::Rackspace::UK_AUTH_ENDPOINT
|
86
|
+
end
|
87
|
+
it "should return custom endpoint if supplied and rackspace_region is :lon" do
|
88
|
+
my_endpoint = 'http://custom-endpoint.com'
|
89
|
+
subject.rackspace_region = :lon
|
90
|
+
subject.rackspace_auth_url = my_endpoint
|
91
|
+
subject.rackspace_auth_url.should == my_endpoint
|
92
|
+
end
|
93
|
+
it "should return custom endpoint if supplied and rackspace_region is UNSET" do
|
94
|
+
my_endpoint = 'http://custom-endpoint.com'
|
95
|
+
subject.rackspace_auth_url = my_endpoint
|
96
|
+
subject.rackspace_auth_url.should == my_endpoint
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
describe "lon_region?" do
|
102
|
+
it "should return false if rackspace_region is UNSET_VALUE" do
|
103
|
+
subject.rackspace_region = VagrantPlugins::Rackspace::Config::UNSET_VALUE
|
104
|
+
subject.send(:lon_region?).should be_false
|
105
|
+
end
|
106
|
+
it "should return false if rackspace_region is nil" do
|
107
|
+
subject.rackspace_region = nil
|
108
|
+
subject.send(:lon_region?).should be_false
|
109
|
+
end
|
110
|
+
it "should return false if rackspace_region is :ord" do
|
111
|
+
subject.rackspace_region = :ord
|
112
|
+
subject.send(:lon_region?).should be_false
|
113
|
+
end
|
114
|
+
it "should return true if rackspace_region is 'lon'" do
|
115
|
+
subject.rackspace_region = 'lon'
|
116
|
+
subject.send(:lon_region?).should be_true
|
117
|
+
end
|
118
|
+
it "should return true if rackspace_Region is :lon" do
|
119
|
+
subject.rackspace_region = :lon
|
120
|
+
subject.send(:lon_region?).should be_true
|
121
|
+
end
|
122
|
+
end
|
69
123
|
end
|
data/vagrant-rackspace.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.summary = "Enables Vagrant to manage machines in RackSpace Cloud."
|
13
13
|
gem.homepage = "http://www.vagrantup.com"
|
14
14
|
|
15
|
-
gem.add_runtime_dependency "fog", "~> 1.
|
15
|
+
gem.add_runtime_dependency "fog", "~> 1.15.0"
|
16
16
|
|
17
17
|
gem.add_development_dependency "rake"
|
18
18
|
gem.add_development_dependency "rspec", "~> 2.13.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchell Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.15.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|