vagrant-openstack-plugin 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -1
- data/lib/vagrant-openstack-plugin/action/create_server.rb +9 -2
- data/lib/vagrant-openstack-plugin/action/read_ssh_info.rb +1 -1
- data/lib/vagrant-openstack-plugin/config.rb +19 -1
- data/lib/vagrant-openstack-plugin/version.rb +1 -1
- data/spec/vagrant-openstack-plugin/config_spec.rb +2 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -64,9 +64,12 @@ Vagrant.configure("2") do |config|
|
|
64
64
|
os.endpoint = "KEYSTONE AUTH URL" # "#{ENV['OS_AUTH_URL']}/tokens"
|
65
65
|
os.keypair_name = "YOUR KEYPAIR NAME"
|
66
66
|
os.ssh_username = "SSH USERNAME"
|
67
|
-
|
68
67
|
os.metadata = {"key" => "value"} # Optional
|
69
68
|
os.network = "YOUR NETWORK_NAME" # Optional
|
69
|
+
os.address_id = "YOUR ADDRESS ID" # Optional (`network` above has higher precedence)
|
70
|
+
os.scheduler_hints = {
|
71
|
+
:cell => 'australia'
|
72
|
+
} # Optional
|
70
73
|
os.security_groups = ['ssh', 'http'] # Optional
|
71
74
|
os.tenant = "YOUR TENANT_NAME" # Optional
|
72
75
|
|
@@ -119,6 +122,9 @@ This provider exposes quite a few provider-specific configuration options:
|
|
119
122
|
* `network` - A name or id that will be used to fetch network configuration
|
120
123
|
data when configuring the instance. NOTE: This is not compliant with the
|
121
124
|
vagrant network configurations.
|
125
|
+
* `address_id` - A specific address identifier to use when connecting to the
|
126
|
+
instance. `network` has higher precedence.
|
127
|
+
* `scheduler_hints` - Pass hints to the open stack scheduler, see `--hint` flag in [OpenStack filters doc](http://docs.openstack.org/trunk/openstack-compute/admin/content/scheduler-filters.html)
|
122
128
|
* `security_groups` - List of security groups to be applied to the machine.
|
123
129
|
* `tenant` - Tenant name. You only need to specify this if your OpenStack user has access to multiple tenants.
|
124
130
|
|
@@ -39,8 +39,9 @@ module VagrantPlugins
|
|
39
39
|
:name => server_name,
|
40
40
|
:key_name => config.keypair_name,
|
41
41
|
:metadata => config.metadata,
|
42
|
-
:
|
43
|
-
:security_groups => config.security_groups
|
42
|
+
:user_data => config.user_data,
|
43
|
+
:security_groups => config.security_groups,
|
44
|
+
:os_scheduler_hints => config.scheduler_hints
|
44
45
|
}
|
45
46
|
|
46
47
|
# Find a network if provided
|
@@ -81,6 +82,12 @@ module VagrantPlugins
|
|
81
82
|
# Wait for the server to be ready
|
82
83
|
begin
|
83
84
|
server.wait_for(5) { ready? }
|
85
|
+
# Once the server is up and running assign a floating IP if we have one
|
86
|
+
if config.floating_ip
|
87
|
+
env[:ui].info( "Using floating IP #{config.floating_ip}")
|
88
|
+
floater = env[:openstack_compute].addresses.find { |thisone| thisone.ip.eql? config.floating_ip }
|
89
|
+
floater.server = server
|
90
|
+
end
|
84
91
|
rescue RuntimeError => e
|
85
92
|
# If we don't have an error about a state transition, then
|
86
93
|
# we just move on.
|
@@ -34,7 +34,7 @@ module VagrantPlugins
|
|
34
34
|
if config.network
|
35
35
|
host = server.addresses[config.network].last['addr'] rescue nil
|
36
36
|
else
|
37
|
-
host = server.addresses[
|
37
|
+
host = server.addresses[config.address_id].last['addr'] rescue nil
|
38
38
|
end
|
39
39
|
# Read the DNS info
|
40
40
|
return {
|
@@ -42,6 +42,14 @@ module VagrantPlugins
|
|
42
42
|
# @return [String]
|
43
43
|
attr_accessor :network
|
44
44
|
|
45
|
+
# A specific address identifier to use when connecting.
|
46
|
+
# Overrides `network` above if both are set.
|
47
|
+
#
|
48
|
+
attr_accessor :address_id
|
49
|
+
|
50
|
+
# Pass hints to the OpenStack scheduler, e.g. { "cell": "some cell name" }
|
51
|
+
attr_accessor :scheduler_hints
|
52
|
+
|
45
53
|
# List of strings representing the security groups to apply.
|
46
54
|
# e.g. ['ssh', 'http']
|
47
55
|
#
|
@@ -69,7 +77,11 @@ module VagrantPlugins
|
|
69
77
|
#
|
70
78
|
# @return [String]
|
71
79
|
attr_accessor :user_data
|
72
|
-
|
80
|
+
|
81
|
+
# The floating IP address from the IP pool which will be assigned to the instance.
|
82
|
+
#
|
83
|
+
# @return [String]
|
84
|
+
attr_accessor :floating_ip
|
73
85
|
def initialize
|
74
86
|
@api_key = UNSET_VALUE
|
75
87
|
@endpoint = UNSET_VALUE
|
@@ -80,10 +92,13 @@ module VagrantPlugins
|
|
80
92
|
@username = UNSET_VALUE
|
81
93
|
@keypair_name = UNSET_VALUE
|
82
94
|
@network = UNSET_VALUE
|
95
|
+
@address_id = UNSET_VALUE
|
96
|
+
@scheduler_hints = UNSET_VALUE
|
83
97
|
@security_groups = UNSET_VALUE
|
84
98
|
@ssh_username = UNSET_VALUE
|
85
99
|
@tenant = UNSET_VALUE
|
86
100
|
@user_data = UNSET_VALUE
|
101
|
+
@floating_ip = UNSET_VALUE
|
87
102
|
end
|
88
103
|
|
89
104
|
def finalize!
|
@@ -95,10 +110,12 @@ module VagrantPlugins
|
|
95
110
|
@metadata = nil if @metadata == UNSET_VALUE
|
96
111
|
@username = nil if @username == UNSET_VALUE
|
97
112
|
@network = nil if @network == UNSET_VALUE
|
113
|
+
@address_id = 'public' if @address_id == UNSET_VALUE
|
98
114
|
|
99
115
|
# Keypair defaults to nil
|
100
116
|
@keypair_name = nil if @keypair_name == UNSET_VALUE
|
101
117
|
|
118
|
+
@scheduler_hints = nil if @scheduler_hints == UNSET_VALUE
|
102
119
|
@security_groups = nil if @security_groups == UNSET_VALUE
|
103
120
|
|
104
121
|
# The SSH values by default are nil, and the top-level config
|
@@ -107,6 +124,7 @@ module VagrantPlugins
|
|
107
124
|
|
108
125
|
@tenant = nil if @tenant == UNSET_VALUE
|
109
126
|
@user_data = "" if @user_data == UNSET_VALUE
|
127
|
+
@floating_ip = nil if @floating_ip == UNSET_VALUE
|
110
128
|
end
|
111
129
|
|
112
130
|
def validate(machine)
|
@@ -20,6 +20,7 @@ describe VagrantPlugins::OpenStack::Config do
|
|
20
20
|
its(:ssh_username) { should be_nil }
|
21
21
|
its(:network) { should be_nil }
|
22
22
|
its(:security_groups) { should be_nil }
|
23
|
+
its(:scheduler_hints) { should be_nil }
|
23
24
|
its(:tenant) { should be_nil }
|
24
25
|
end
|
25
26
|
|
@@ -34,6 +35,7 @@ describe VagrantPlugins::OpenStack::Config do
|
|
34
35
|
:network,
|
35
36
|
:ssh_username,
|
36
37
|
:security_groups,
|
38
|
+
:scheduler_hints,
|
37
39
|
:tenant].each do |attribute|
|
38
40
|
it "should not default #{attribute} if overridden" do
|
39
41
|
subject.send("#{attribute}=".to_sym, "foo")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-openstack-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-05-
|
13
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fog
|
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
segments:
|
113
113
|
- 0
|
114
|
-
hash:
|
114
|
+
hash: 515236456888934213
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
segments:
|
122
122
|
- 0
|
123
|
-
hash:
|
123
|
+
hash: 515236456888934213
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
126
|
rubygems_version: 1.8.24
|