vagrant-conoha 0.1.5 → 0.1.6
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 +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -1
- data/Vagrantfile +3 -0
- data/functional_tests/Vagrantfile +1 -1
- data/lib/vagrant-conoha/action.rb +23 -4
- data/lib/vagrant-conoha/action/create_stack.rb +8 -0
- data/lib/vagrant-conoha/action/delete_stack.rb +1 -1
- data/lib/vagrant-conoha/action/provision.rb +1 -1
- data/lib/vagrant-conoha/action/sync_folders.rb +10 -1
- data/lib/vagrant-conoha/command/flavor_list.rb +1 -1
- data/lib/vagrant-conoha/command/floatingip_list.rb +32 -0
- data/lib/vagrant-conoha/command/image_list.rb +1 -1
- data/lib/vagrant-conoha/command/subnet_list.rb +1 -1
- data/lib/vagrant-conoha/command/utils.rb +1 -1
- data/lib/vagrant-conoha/command/volume_list.rb +1 -1
- data/lib/vagrant-conoha/config.rb +12 -4
- data/lib/vagrant-conoha/provider.rb +2 -2
- data/lib/vagrant-conoha/version.rb +1 -1
- data/locales/en.yml +6 -2
- data/spec/vagrant-conoha/action/provision_spec.rb +4 -11
- data/spec/vagrant-conoha/action/sync_folders_spec.rb +1 -1
- data/spec/vagrant-conoha/command/flavor_list_spec.rb +1 -1
- data/spec/vagrant-conoha/command/floatingip_list_spec.rb +74 -0
- data/spec/vagrant-conoha/command/image_list_spec.rb +2 -2
- data/spec/vagrant-conoha/command/network_list_spec.rb +2 -2
- data/spec/vagrant-conoha/command/subnet_list_spec.rb +1 -1
- data/spec/vagrant-conoha/command/volume_list_spec.rb +1 -1
- data/vagrant-conoha.gemspec +5 -5
- metadata +17 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f9e567b352ad7363774274cbea6550bbf01c1dc
|
4
|
+
data.tar.gz: 8c691159e46f9782317a64153f4b48f58e0bd3c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5fd61edd482dca4ca1df193b44791ef3b65eb8ab9741c2edad453eda19761a9e313746e286e0d9577a6150f98301032313fe819e65053c5570e9288f264a8d6
|
7
|
+
data.tar.gz: 4c81e34573458debc06ea34d77325717a272b83bad161bf63a736c9bde6b1c53907e132cdc4091057ef485dbb4a15f4da1694e0b367d50c4fc48cdf31dfcb1f2
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.
|
6
|
+
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.8.1'
|
7
7
|
gem 'appraisal', '1.0.0'
|
8
8
|
gem 'rubocop', '0.29.0', require: false
|
9
9
|
gem 'coveralls', require: false
|
data/Vagrantfile
CHANGED
@@ -20,6 +20,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
20
20
|
# vagrantがSSH接続する際のユーザ名を指定します。
|
21
21
|
config.ssh.username = 'root'
|
22
22
|
|
23
|
+
# CentOS系など/etc/sudoersにrequirettyが書いてある場合に必要になります。
|
24
|
+
config.ssh.pty = true
|
25
|
+
|
23
26
|
config.vm.provider :conoha do |conoha|
|
24
27
|
|
25
28
|
# IdentityEndpointを指定します
|
@@ -4,6 +4,7 @@ Vagrant.configure('2') do |config|
|
|
4
4
|
|
5
5
|
config.vm.box = 'openstack'
|
6
6
|
config.vm.box_url = 'https://github.com/ggiamarchi/vagrant-openstack/raw/master/source/dummy.box'
|
7
|
+
config.vm.boot_timeout = ENV['OS_SSH_TIMEOUT'].to_i
|
7
8
|
|
8
9
|
config.ssh.private_key_path = ENV['OS_KEYPAIR_PRIVATE_KEY']
|
9
10
|
config.ssh.pty = true
|
@@ -16,7 +17,6 @@ Vagrant.configure('2') do |config|
|
|
16
17
|
os.openstack_compute_url = ENV['OS_COMPUTE_URL']
|
17
18
|
os.openstack_network_url = ENV['OS_NETWORK_URL']
|
18
19
|
os.tenant_name = ENV['OS_TENANT_NAME']
|
19
|
-
os.ssh_timeout = ENV['OS_SSH_TIMEOUT'].to_i
|
20
20
|
os.sync_method = ENV['OS_SYNC_METHOD']
|
21
21
|
os.flavor = ENV['OS_FLAVOR']
|
22
22
|
os.image = ENV['OS_IMAGE']
|
@@ -17,6 +17,7 @@ module VagrantPlugins
|
|
17
17
|
if env[:machine_state_id] == :not_created
|
18
18
|
b2.use Message, I18n.t('vagrant_openstack.not_created')
|
19
19
|
else
|
20
|
+
b2.use(ProvisionerCleanup, :before)
|
20
21
|
b2.use DeleteServer
|
21
22
|
b2.use DeleteStack
|
22
23
|
end
|
@@ -33,7 +34,11 @@ module VagrantPlugins
|
|
33
34
|
if env[:machine_state_id] == :not_created
|
34
35
|
b2.use Message, I18n.t('vagrant_openstack.not_created')
|
35
36
|
else
|
36
|
-
|
37
|
+
if env[:machine].provider_config.meta_args_support
|
38
|
+
b2.use ProvisionWrapper
|
39
|
+
else
|
40
|
+
b2.use Provision
|
41
|
+
end
|
37
42
|
b2.use SyncFolders
|
38
43
|
end
|
39
44
|
end
|
@@ -99,12 +104,27 @@ module VagrantPlugins
|
|
99
104
|
case env[:machine_state_id]
|
100
105
|
when :not_created
|
101
106
|
ssh_disabled = env[:machine].provider_config.ssh_disabled
|
102
|
-
|
107
|
+
unless ssh_disabled
|
108
|
+
if env[:machine].provider_config.meta_args_support
|
109
|
+
b2.use ProvisionWrapper
|
110
|
+
else
|
111
|
+
b2.use Provision
|
112
|
+
end
|
113
|
+
end
|
103
114
|
b2.use SyncFolders
|
104
115
|
b2.use CreateStack
|
105
116
|
b2.use CreateServer
|
106
117
|
b2.use Message, I18n.t('vagrant_openstack.ssh_disabled_provisioning') if ssh_disabled
|
107
|
-
|
118
|
+
unless ssh_disabled
|
119
|
+
# Handle legacy ssh_timeout option
|
120
|
+
timeout = env[:machine].provider_config.ssh_timeout
|
121
|
+
unless timeout.nil?
|
122
|
+
env[:machine].ui.warn I18n.t('vagrant_openstack.config.ssh_timeout_deprecated')
|
123
|
+
env[:machine].config.vm.boot_timeout = timeout
|
124
|
+
end
|
125
|
+
|
126
|
+
b2.use WaitForCommunicator
|
127
|
+
end
|
108
128
|
when :shutoff
|
109
129
|
b2.use StartServer
|
110
130
|
when :suspended
|
@@ -215,7 +235,6 @@ module VagrantPlugins
|
|
215
235
|
autoload :ProvisionWrapper, action_root.join('provision')
|
216
236
|
autoload :WaitForServerToStop, action_root.join('wait_stop')
|
217
237
|
autoload :WaitForServerToBeActive, action_root.join('wait_active')
|
218
|
-
autoload :WaitForServerToBeAccessible, action_root.join('wait_accessible')
|
219
238
|
|
220
239
|
private
|
221
240
|
|
@@ -13,12 +13,19 @@ module VagrantPlugins
|
|
13
13
|
module ConoHa
|
14
14
|
module Action
|
15
15
|
class CreateStack < AbstractAction
|
16
|
+
@@is_created = false
|
17
|
+
|
16
18
|
def initialize(app, _env)
|
17
19
|
@app = app
|
18
20
|
@logger = Log4r::Logger.new('vagrant_openstack::action::create_stack')
|
19
21
|
end
|
20
22
|
|
21
23
|
def execute(env)
|
24
|
+
if @@is_created
|
25
|
+
@app.call(env)
|
26
|
+
return
|
27
|
+
end
|
28
|
+
|
22
29
|
@logger.info 'Start create stacks action'
|
23
30
|
|
24
31
|
config = env[:machine].provider_config
|
@@ -43,6 +50,7 @@ module VagrantPlugins
|
|
43
50
|
waiting_for_stack_to_be_created(env, stack[:name], stack_id)
|
44
51
|
end unless config.stacks.nil?
|
45
52
|
|
53
|
+
@@is_created = true
|
46
54
|
@app.call(env)
|
47
55
|
end
|
48
56
|
|
@@ -26,7 +26,7 @@ module VagrantPlugins
|
|
26
26
|
list_stack_files(env).each do |stack|
|
27
27
|
env[:ui].info(I18n.t('vagrant_openstack.delete_stack'))
|
28
28
|
env[:ui].info(" -- Stack Name : #{stack[:name]}")
|
29
|
-
env[:ui].info(" -- Stack
|
29
|
+
env[:ui].info(" -- Stack ID : #{stack[:id]}")
|
30
30
|
|
31
31
|
heat.delete_stack(env, stack[:name], stack[:id])
|
32
32
|
|
@@ -31,7 +31,7 @@ module VagrantPlugins
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def run_provisioner(env)
|
34
|
-
if env[:provisioner].
|
34
|
+
if env[:provisioner].is_a?(Vagrant.plugin('2').manager.provisioners[:shell])
|
35
35
|
handle_shell_meta_args(env)
|
36
36
|
end
|
37
37
|
env[:provisioner].provision
|
@@ -83,6 +83,15 @@ module VagrantPlugins
|
|
83
83
|
incls << incl
|
84
84
|
end
|
85
85
|
|
86
|
+
# Create ssh params for rsync
|
87
|
+
# we need them as one string because rsync -e expects one string
|
88
|
+
ssh_params = [
|
89
|
+
"ssh -p #{ssh_info[:port]}",
|
90
|
+
'-o StrictHostKeyChecking=no',
|
91
|
+
'-o UserKnownHostsFile=/dev/null',
|
92
|
+
'-o IdentitiesOnly=yes',
|
93
|
+
"#{ssh_key_options(ssh_info)}"].join(' ')
|
94
|
+
|
86
95
|
# Rsync over to the guest path using the SSH info. add
|
87
96
|
# .hg/ and .git/ to exclude list as that isn't covered in
|
88
97
|
# --cvs-exclude
|
@@ -93,7 +102,7 @@ module VagrantPlugins
|
|
93
102
|
'--exclude', '.git/',
|
94
103
|
'--chmod', 'ugo=rwX',
|
95
104
|
*includes,
|
96
|
-
'-e',
|
105
|
+
'-e', ssh_params,
|
97
106
|
hostpath,
|
98
107
|
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
99
108
|
command.compact!
|
@@ -16,7 +16,7 @@ module VagrantPlugins
|
|
16
16
|
flavors.each do |f|
|
17
17
|
rows << [f.id, f.name, f.vcpus, f.ram, f.disk]
|
18
18
|
end
|
19
|
-
display_table(env, ['
|
19
|
+
display_table(env, ['ID', 'Name', 'vCPU', 'RAM (Mo)', 'Disk size (Go)'], rows)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'vagrant-conoha/command/openstack_command'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ConoHa
|
5
|
+
module Command
|
6
|
+
class FloatingIpList < OpenstackCommand
|
7
|
+
def self.synopsis
|
8
|
+
I18n.t('vagrant_openstack.command.flaotingip_list_synopsis')
|
9
|
+
end
|
10
|
+
|
11
|
+
def cmd(name, argv, env)
|
12
|
+
fail Errors::NoArgRequiredForCommand, cmd: name unless argv.size == 0
|
13
|
+
|
14
|
+
floating_ip_pools = env[:openstack_client].nova.get_floating_ip_pools(env)
|
15
|
+
floating_ips = env[:openstack_client].nova.get_floating_ips(env)
|
16
|
+
|
17
|
+
rows = []
|
18
|
+
floating_ip_pools.each do |floating_ip_pool|
|
19
|
+
rows << [floating_ip_pool['name']]
|
20
|
+
end
|
21
|
+
display_table(env, ['Floating IP pools'], rows)
|
22
|
+
|
23
|
+
rows = []
|
24
|
+
floating_ips.each do |floating_ip|
|
25
|
+
rows << [floating_ip['id'], floating_ip['ip'], floating_ip['pool'], floating_ip['instance_id']]
|
26
|
+
end
|
27
|
+
display_table(env, ['ID', 'IP', 'Pool', 'Instance ID'], rows)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -11,7 +11,7 @@ module VagrantPlugins
|
|
11
11
|
def cmd(name, argv, env)
|
12
12
|
fail Errors::NoArgRequiredForCommand, cmd: name unless argv.size == 0
|
13
13
|
rows = []
|
14
|
-
headers = %w(
|
14
|
+
headers = %w(ID Name)
|
15
15
|
if env[:openstack_client].session.endpoints.key? :image
|
16
16
|
images = env[:openstack_client].glance.get_all_images(env)
|
17
17
|
images.each { |i| rows << [i.id, i.name, i.visibility, i.size.to_i / 1024 / 1024, i.min_ram, i.min_disk] }
|
@@ -14,7 +14,7 @@ module VagrantPlugins
|
|
14
14
|
env[:openstack_client].neutron.get_subnets(env).each do |subnet|
|
15
15
|
rows << [subnet.id, subnet.name, subnet.cidr, subnet.enable_dhcp, subnet.network_id]
|
16
16
|
end
|
17
|
-
display_table(env, ['
|
17
|
+
display_table(env, ['ID', 'Name', 'CIDR', 'DHCP', 'Network ID'], rows)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -17,7 +17,7 @@ module VagrantPlugins
|
|
17
17
|
attachment = "#{v.instance_id} (#{v.device})" unless v.instance_id.nil?
|
18
18
|
rows << [v.id, v.name, v.size, v.status, attachment]
|
19
19
|
end
|
20
|
-
display_table(env, ['
|
20
|
+
display_table(env, ['ID', 'Name', 'Size (Go)', 'Status', 'Attachment (instance ID and device)'], rows)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -78,8 +78,9 @@ module VagrantPlugins
|
|
78
78
|
# @return [String]
|
79
79
|
attr_accessor :ssh_username
|
80
80
|
|
81
|
-
# The SSH timeout use after server creation.
|
82
|
-
#
|
81
|
+
# The SSH timeout use after server creation.
|
82
|
+
#
|
83
|
+
# Deprecated. Use config.vm.boot_timeout instead.
|
83
84
|
#
|
84
85
|
# @return [Integer]
|
85
86
|
attr_accessor :ssh_timeout
|
@@ -199,6 +200,10 @@ module VagrantPlugins
|
|
199
200
|
# @return [HttpConfig]
|
200
201
|
attr_accessor :http
|
201
202
|
|
203
|
+
#
|
204
|
+
# @return [Boolean]
|
205
|
+
attr_accessor :meta_args_support
|
206
|
+
|
202
207
|
def initialize
|
203
208
|
@password = UNSET_VALUE
|
204
209
|
@openstack_compute_url = UNSET_VALUE
|
@@ -241,6 +246,7 @@ module VagrantPlugins
|
|
241
246
|
@server_delete_timeout = UNSET_VALUE
|
242
247
|
@stack_create_timeout = UNSET_VALUE
|
243
248
|
@stack_delete_timeout = UNSET_VALUE
|
249
|
+
@meta_args_support = UNSET_VALUE
|
244
250
|
@http = HttpConfig.new
|
245
251
|
end
|
246
252
|
|
@@ -316,15 +322,17 @@ module VagrantPlugins
|
|
316
322
|
@ssh_disabled = false if @ssh_disabled == UNSET_VALUE
|
317
323
|
|
318
324
|
# The SSH values by default are nil, and the top-level config
|
319
|
-
# `config.ssh` values are used.
|
325
|
+
# `config.ssh` and `config.vm.boot_timeout` values are used.
|
320
326
|
@ssh_username = nil if @ssh_username == UNSET_VALUE
|
321
|
-
@ssh_timeout =
|
327
|
+
@ssh_timeout = nil if @ssh_timeout == UNSET_VALUE
|
328
|
+
|
322
329
|
@server_create_timeout = 200 if @server_create_timeout == UNSET_VALUE
|
323
330
|
@server_active_timeout = 200 if @server_active_timeout == UNSET_VALUE
|
324
331
|
@server_stop_timeout = 200 if @server_stop_timeout == UNSET_VALUE
|
325
332
|
@server_delete_timeout = 200 if @server_delete_timeout == UNSET_VALUE
|
326
333
|
@stack_create_timeout = 200 if @stack_create_timeout == UNSET_VALUE
|
327
334
|
@stack_delete_timeout = 200 if @stack_delete_timeout == UNSET_VALUE
|
335
|
+
@meta_args_support = false if @meta_args_support == UNSET_VALUE
|
328
336
|
@networks = nil if @networks.empty?
|
329
337
|
@volumes = nil if @volumes.empty?
|
330
338
|
@stacks = nil if @stacks.empty?
|
@@ -22,7 +22,7 @@ module VagrantPlugins
|
|
22
22
|
# Run a custom action called "read_ssh_info" which does what it
|
23
23
|
# says and puts the resulting SSH info into the `:machine_ssh_info`
|
24
24
|
# key in the environment.
|
25
|
-
env = @machine.action('read_ssh_info')
|
25
|
+
env = @machine.action('read_ssh_info', lock: false)
|
26
26
|
env[:machine_ssh_info]
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ module VagrantPlugins
|
|
30
30
|
# Run a custom action we define called "read_state" which does
|
31
31
|
# what it says. It puts the state in the `:machine_state_id`
|
32
32
|
# key in the environment.
|
33
|
-
env = @machine.action('read_state')
|
33
|
+
env = @machine.action('read_state', lock: false)
|
34
34
|
|
35
35
|
state_id = env[:machine_state_id]
|
36
36
|
|
data/locales/en.yml
CHANGED
@@ -134,6 +134,10 @@ en:
|
|
134
134
|
standard vagrant configuration option `config.ssh.username` instead
|
135
135
|
ssh_username_required: |-
|
136
136
|
vagrant standard configuration option `ssh.username` is required
|
137
|
+
ssh_timeout_deprecated: |-
|
138
|
+
ssh_timeout provider config is deprecated for vagrant-openstack provider.
|
139
|
+
If you are using it, it will continue to work but we recommend switching
|
140
|
+
to the standard vagrant configuration option `config.vm.boot_timeout`.
|
137
141
|
invalid_value_for_parameter: |-
|
138
142
|
Invalid value '%{value}' for parameter '%{parameter}'
|
139
143
|
invalid_admin_pass: |-
|
@@ -177,14 +181,14 @@ en:
|
|
177
181
|
sync_method_error: |-
|
178
182
|
Value '%{sync_method_value}' is not allowed for 'sync_method' configuration parameter. Valid values are 'rsync' and 'none'
|
179
183
|
rsync_error: |-
|
180
|
-
There was an error when
|
184
|
+
There was an error when attempting to rsync a share folder.
|
181
185
|
Please inspect the error message below for more info.
|
182
186
|
|
183
187
|
Host path: %{hostpath}
|
184
188
|
Guest path: %{guestpath}
|
185
189
|
Error: %{stderr}
|
186
190
|
ssh_unavailble: |-
|
187
|
-
SSH server
|
191
|
+
SSH server unavailable on instance %{host}. You should maybe increase the timeout value which currently is %{timeout} second(s).
|
188
192
|
no_arg_required_for_command: |-
|
189
193
|
Command '%{cmd}' does not required any argument.
|
190
194
|
unrecognized_arg_for_command: |-
|
@@ -17,17 +17,6 @@ class FakeShellProvisioner < FakeProvisioner
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
#
|
21
|
-
# Monkeypatch the VagrantPlugins::Shell module
|
22
|
-
# to enabled using an FakeShellProvisioner in
|
23
|
-
# place of a the real shell provisioner class
|
24
|
-
#
|
25
|
-
module VagrantPlugins
|
26
|
-
module Shell
|
27
|
-
Provisioner = FakeShellProvisioner
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
20
|
describe VagrantPlugins::ConoHa::Action::ProvisionWrapper do
|
32
21
|
let(:app) do
|
33
22
|
double
|
@@ -38,6 +27,8 @@ describe VagrantPlugins::ConoHa::Action::ProvisionWrapper do
|
|
38
27
|
end
|
39
28
|
|
40
29
|
before :each do
|
30
|
+
# Stub lookup for provisioners and return a hash containing the test mock.
|
31
|
+
allow(Vagrant.plugin('2').manager).to receive(:provisioners).and_return(shell: FakeShellProvisioner)
|
41
32
|
@action = ProvisionWrapper.new(app, nil)
|
42
33
|
end
|
43
34
|
|
@@ -57,6 +48,8 @@ describe VagrantPlugins::ConoHa::Action::InternalProvisionWrapper do
|
|
57
48
|
end
|
58
49
|
|
59
50
|
before :each do
|
51
|
+
# Stub lookup for provisioners and return a hash containing the test mock.
|
52
|
+
allow(Vagrant.plugin('2').manager).to receive(:provisioners).and_return(shell: FakeShellProvisioner)
|
60
53
|
@action = InternalProvisionWrapper.new(nil, env)
|
61
54
|
end
|
62
55
|
|
@@ -111,7 +111,7 @@ describe VagrantPlugins::ConoHa::Action::SyncFolders do
|
|
111
111
|
'--chmod',
|
112
112
|
'ugo=rwX',
|
113
113
|
'-e',
|
114
|
-
"ssh -p 23 -o StrictHostKeyChecking=no -i '/tmp/key.pem' ",
|
114
|
+
"ssh -p 23 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -i '/tmp/key.pem' ",
|
115
115
|
'/home/john/vagrant/',
|
116
116
|
'user@1.2.3.4:/vagrant',
|
117
117
|
'--exclude-from',
|
@@ -31,7 +31,7 @@ describe VagrantPlugins::ConoHa::Command::FlavorList do
|
|
31
31
|
|
32
32
|
expect(env[:ui]).to receive(:info).with('
|
33
33
|
+-----+-------+------+----------+----------------+
|
34
|
-
|
|
34
|
+
| ID | Name | vCPU | RAM (Mo) | Disk size (Go) |
|
35
35
|
+-----+-------+------+----------+----------------+
|
36
36
|
| 001 | small | 1 | 1024 | 10 |
|
37
37
|
| 002 | large | 4 | 4096 | 100 |
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'vagrant-conoha/spec_helper'
|
2
|
+
|
3
|
+
describe VagrantPlugins::ConoHa::Command::FloatingIpList do
|
4
|
+
describe 'cmd' do
|
5
|
+
let(:nova) do
|
6
|
+
double('nova').tap do |nova|
|
7
|
+
nova.stub(:get_floating_ip_pools) do
|
8
|
+
[
|
9
|
+
{
|
10
|
+
'name' => 'pool1'
|
11
|
+
},
|
12
|
+
{
|
13
|
+
'name' => 'pool2'
|
14
|
+
}
|
15
|
+
]
|
16
|
+
end
|
17
|
+
nova.stub(:get_floating_ips) do
|
18
|
+
[
|
19
|
+
{
|
20
|
+
'fixed_ip' => nil,
|
21
|
+
'id' => 1,
|
22
|
+
'instance_id' => nil,
|
23
|
+
'ip' => '10.10.10.1',
|
24
|
+
'pool' => 'pool1'
|
25
|
+
},
|
26
|
+
{
|
27
|
+
'fixed_ip' => nil,
|
28
|
+
'id' => 2,
|
29
|
+
'instance_id' => 'inst001',
|
30
|
+
'ip' => '10.10.10.2',
|
31
|
+
'pool' => 'pool2'
|
32
|
+
}
|
33
|
+
]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
let(:env) do
|
39
|
+
{}.tap do |env|
|
40
|
+
env[:ui] = double('ui')
|
41
|
+
env[:ui].stub(:info).with(anything)
|
42
|
+
env[:openstack_client] = double
|
43
|
+
env[:openstack_client].stub(:nova) { nova }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
before :each do
|
48
|
+
@floating_ip_list_cmd = VagrantPlugins::ConoHa::Command::FloatingIpList.new(nil, env)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'prints floating ip and floating ip pool from server' do
|
52
|
+
nova.should_receive(:get_floating_ip_pools).with(env)
|
53
|
+
nova.should_receive(:get_floating_ips).with(env)
|
54
|
+
|
55
|
+
expect(env[:ui]).to receive(:info).with('
|
56
|
+
+-------------------+
|
57
|
+
| Floating IP pools |
|
58
|
+
+-------------------+
|
59
|
+
| pool1 |
|
60
|
+
| pool2 |
|
61
|
+
+-------------------+').ordered
|
62
|
+
|
63
|
+
expect(env[:ui]).to receive(:info).with('
|
64
|
+
+----+------------+-------+-------------+
|
65
|
+
| ID | IP | Pool | Instance ID |
|
66
|
+
+----+------------+-------+-------------+
|
67
|
+
| 1 | 10.10.10.1 | pool1 | |
|
68
|
+
| 2 | 10.10.10.2 | pool2 | inst001 |
|
69
|
+
+----+------------+-------+-------------+').ordered
|
70
|
+
|
71
|
+
@floating_ip_list_cmd.cmd('floatingip-list', [], env)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -54,7 +54,7 @@ describe VagrantPlugins::ConoHa::Command::ImageList do
|
|
54
54
|
|
55
55
|
expect(env[:ui]).to receive(:info).with('
|
56
56
|
+------+--------+
|
57
|
-
|
|
57
|
+
| ID | Name |
|
58
58
|
+------+--------+
|
59
59
|
| 0001 | ubuntu |
|
60
60
|
| 0002 | centos |
|
@@ -82,7 +82,7 @@ describe VagrantPlugins::ConoHa::Command::ImageList do
|
|
82
82
|
|
83
83
|
expect(env[:ui]).to receive(:info).with('
|
84
84
|
+------+--------+------------+-----------+--------------+---------------+
|
85
|
-
|
|
85
|
+
| ID | Name | Visibility | Size (Mo) | Min RAM (Go) | Min Disk (Go) |
|
86
86
|
+------+--------+------------+-----------+--------------+---------------+
|
87
87
|
| 0001 | ubuntu | public | 700 | 1 | 10 |
|
88
88
|
| 0002 | centos | private | 800 | 2 | 20 |
|
@@ -38,7 +38,7 @@ describe VagrantPlugins::ConoHa::Command::NetworkList do
|
|
38
38
|
|
39
39
|
expect(env[:ui]).to receive(:info).with('
|
40
40
|
+--------+----------+
|
41
|
-
|
|
41
|
+
| ID | Name |
|
42
42
|
+--------+----------+
|
43
43
|
| net-01 | internal |
|
44
44
|
| net-02 | external |
|
@@ -52,7 +52,7 @@ describe VagrantPlugins::ConoHa::Command::NetworkList do
|
|
52
52
|
|
53
53
|
expect(env[:ui]).to receive(:info).with('
|
54
54
|
+--------+----------+
|
55
|
-
|
|
55
|
+
| ID | Name |
|
56
56
|
+--------+----------+
|
57
57
|
| pub-01 | public |
|
58
58
|
| net-01 | internal |
|
@@ -32,7 +32,7 @@ describe VagrantPlugins::ConoHa::Command::SubnetList do
|
|
32
32
|
|
33
33
|
expect(env[:ui]).to receive(:info).with('
|
34
34
|
+-----------+----------+------------------+-------+------------+
|
35
|
-
|
|
35
|
+
| ID | Name | CIDR | DHCP | Network ID |
|
36
36
|
+-----------+----------+------------------+-------+------------+
|
37
37
|
| subnet-01 | Subnet 1 | 192.168.1.0/24 | true | net-01 |
|
38
38
|
| subnet-02 | Subnet 2 | 192.168.2.0/24 | false | net-01 |
|
@@ -28,7 +28,7 @@ describe VagrantPlugins::ConoHa::Command::VolumeList do
|
|
28
28
|
cinder.should_receive(:get_all_volumes).with(env)
|
29
29
|
expect(env[:ui]).to receive(:info).with('
|
30
30
|
+-----+--------+-----------+-----------+-------------------------------------+
|
31
|
-
|
|
31
|
+
| ID | Name | Size (Go) | Status | Attachment (instance ID and device) |
|
32
32
|
+-----+--------+-----------+-----------+-------------------------------------+
|
33
33
|
| 987 | vol-01 | 2 | available | |
|
34
34
|
| 654 | vol-02 | 4 | in-use | inst-01 (/dev/vdc) |
|
data/vagrant-conoha.gemspec
CHANGED
@@ -12,11 +12,11 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.homepage = 'https://github.com/hironobu-s/vagrant-conoha/'
|
13
13
|
gem.license = 'MIT'
|
14
14
|
|
15
|
-
gem.add_dependency 'json', '
|
16
|
-
gem.add_dependency 'rest-client', '
|
17
|
-
gem.add_dependency 'terminal-table', '1.5
|
18
|
-
gem.add_dependency 'sshkey', '1.
|
19
|
-
gem.add_dependency 'colorize', '0.7.
|
15
|
+
gem.add_dependency 'json', '1.8.3'
|
16
|
+
gem.add_dependency 'rest-client', '~> 1.6.0'
|
17
|
+
gem.add_dependency 'terminal-table', '1.4.5'
|
18
|
+
gem.add_dependency 'sshkey', '1.6.1'
|
19
|
+
gem.add_dependency 'colorize', '0.7.3'
|
20
20
|
|
21
21
|
gem.add_development_dependency 'rake'
|
22
22
|
gem.add_development_dependency 'rspec', '~> 3.1.0'
|
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-conoha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hironobu Saitoh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.8.3
|
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
26
|
version: 1.8.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rest-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.6.
|
33
|
+
version: 1.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.6.
|
40
|
+
version: 1.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: terminal-table
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.5
|
47
|
+
version: 1.4.5
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.5
|
54
|
+
version: 1.4.5
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sshkey
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.6.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.6.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: colorize
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.7.
|
75
|
+
version: 0.7.3
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.7.
|
82
|
+
version: 0.7.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- lib/vagrant-conoha/client/rest_utils.rb
|
220
220
|
- lib/vagrant-conoha/command/abstract_command.rb
|
221
221
|
- lib/vagrant-conoha/command/flavor_list.rb
|
222
|
+
- lib/vagrant-conoha/command/floatingip_list.rb
|
222
223
|
- lib/vagrant-conoha/command/image_list.rb
|
223
224
|
- lib/vagrant-conoha/command/main.rb
|
224
225
|
- lib/vagrant-conoha/command/network_list.rb
|
@@ -264,6 +265,7 @@ files:
|
|
264
265
|
- spec/vagrant-conoha/client/nova_spec.rb
|
265
266
|
- spec/vagrant-conoha/client/utils_spec.rb
|
266
267
|
- spec/vagrant-conoha/command/flavor_list_spec.rb
|
268
|
+
- spec/vagrant-conoha/command/floatingip_list_spec.rb
|
267
269
|
- spec/vagrant-conoha/command/image_list_spec.rb
|
268
270
|
- spec/vagrant-conoha/command/network_list_spec.rb
|
269
271
|
- spec/vagrant-conoha/command/reset_spec.rb
|
@@ -329,6 +331,7 @@ test_files:
|
|
329
331
|
- spec/vagrant-conoha/client/nova_spec.rb
|
330
332
|
- spec/vagrant-conoha/client/utils_spec.rb
|
331
333
|
- spec/vagrant-conoha/command/flavor_list_spec.rb
|
334
|
+
- spec/vagrant-conoha/command/floatingip_list_spec.rb
|
332
335
|
- spec/vagrant-conoha/command/image_list_spec.rb
|
333
336
|
- spec/vagrant-conoha/command/network_list_spec.rb
|
334
337
|
- spec/vagrant-conoha/command/reset_spec.rb
|