vagrant-openstack-provider 0.6.1 → 0.7.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -5
  3. data/CHANGELOG.md +18 -0
  4. data/Gemfile +3 -2
  5. data/{LICENSE.txt → LICENSE} +2 -1
  6. data/lib/vagrant-openstack-provider/action.rb +3 -2
  7. data/lib/vagrant-openstack-provider/action/provision.rb +60 -0
  8. data/lib/vagrant-openstack-provider/action/read_ssh_info.rb +4 -0
  9. data/lib/vagrant-openstack-provider/client/domain.rb +2 -2
  10. data/lib/vagrant-openstack-provider/client/keystone.rb +17 -6
  11. data/lib/vagrant-openstack-provider/client/nova.rb +14 -3
  12. data/lib/vagrant-openstack-provider/command/abstract_command.rb +1 -0
  13. data/lib/vagrant-openstack-provider/command/main.rb +1 -3
  14. data/lib/vagrant-openstack-provider/config.rb +3 -3
  15. data/lib/vagrant-openstack-provider/config_resolver.rb +46 -16
  16. data/lib/vagrant-openstack-provider/errors.rb +15 -0
  17. data/lib/vagrant-openstack-provider/plugin.rb +7 -1
  18. data/lib/vagrant-openstack-provider/version.rb +11 -1
  19. data/lib/vagrant-openstack-provider/version_checker.rb +76 -0
  20. data/locales/en.yml +21 -4
  21. data/spec/vagrant-openstack-provider/action/connect_openstack_spec.rb +17 -19
  22. data/spec/vagrant-openstack-provider/action/create_server_spec.rb +19 -18
  23. data/spec/vagrant-openstack-provider/action/create_stack_spec.rb +4 -6
  24. data/spec/vagrant-openstack-provider/action/delete_server_spec.rb +4 -6
  25. data/spec/vagrant-openstack-provider/action/delete_stack_spec.rb +1 -2
  26. data/spec/vagrant-openstack-provider/action/message_spec.rb +1 -2
  27. data/spec/vagrant-openstack-provider/action/provision_spec.rb +104 -0
  28. data/spec/vagrant-openstack-provider/action/read_ssh_info_spec.rb +1 -3
  29. data/spec/vagrant-openstack-provider/action/read_state_spec.rb +1 -2
  30. data/spec/vagrant-openstack-provider/action/resume_server_spec.rb +1 -2
  31. data/spec/vagrant-openstack-provider/action/start_server_spec.rb +1 -2
  32. data/spec/vagrant-openstack-provider/action/stop_server_spec.rb +1 -2
  33. data/spec/vagrant-openstack-provider/action/suspend_server_spec.rb +1 -2
  34. data/spec/vagrant-openstack-provider/action/sync_folders_spec.rb +1 -2
  35. data/spec/vagrant-openstack-provider/action/wait_accessible_spec.rb +1 -2
  36. data/spec/vagrant-openstack-provider/action/wait_active_spec.rb +3 -4
  37. data/spec/vagrant-openstack-provider/action/wait_stop_spec.rb +3 -4
  38. data/spec/vagrant-openstack-provider/action_spec.rb +0 -1
  39. data/spec/vagrant-openstack-provider/client/cinder_spec.rb +5 -8
  40. data/spec/vagrant-openstack-provider/client/glance_spec.rb +69 -70
  41. data/spec/vagrant-openstack-provider/client/heat_spec.rb +24 -28
  42. data/spec/vagrant-openstack-provider/client/keystone_spec.rb +34 -16
  43. data/spec/vagrant-openstack-provider/client/neutron_spec.rb +76 -80
  44. data/spec/vagrant-openstack-provider/client/nova_spec.rb +198 -168
  45. data/spec/vagrant-openstack-provider/client/utils_spec.rb +1 -3
  46. data/spec/vagrant-openstack-provider/command/flavor_list_spec.rb +1 -2
  47. data/spec/vagrant-openstack-provider/command/floatingip_list_spec.rb +1 -2
  48. data/spec/vagrant-openstack-provider/command/image_list_spec.rb +1 -6
  49. data/spec/vagrant-openstack-provider/command/network_list_spec.rb +1 -3
  50. data/spec/vagrant-openstack-provider/command/reset_spec.rb +1 -2
  51. data/spec/vagrant-openstack-provider/command/subnet_list_spec.rb +1 -2
  52. data/spec/vagrant-openstack-provider/command/volume_list_spec.rb +1 -2
  53. data/spec/vagrant-openstack-provider/config_resolver_spec.rb +100 -6
  54. data/spec/vagrant-openstack-provider/config_spec.rb +2 -6
  55. data/spec/vagrant-openstack-provider/e2e_spec.rb.save +27 -0
  56. data/spec/vagrant-openstack-provider/spec_helper.rb +1 -0
  57. data/spec/vagrant-openstack-provider/utils_spec.rb +1 -2
  58. data/spec/vagrant-openstack-provider/version_checker_spec.rb +39 -0
  59. data/vagrant-openstack-provider.gemspec +4 -2
  60. metadata +29 -9
  61. data/gemfiles/latest_stable.gemfile +0 -10
  62. data/gemfiles/minimal_release.gemfile +0 -10
  63. data/gemfiles/previous_release.gemfile +0 -10
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::DeleteStack do
4
-
5
4
  let(:heat) do
6
5
  double('heat').tap do |app|
7
6
  app.stub(:delete_stack)
@@ -15,7 +14,7 @@ describe VagrantPlugins::Openstack::Action::DeleteStack do
15
14
  end
16
15
 
17
16
  let(:env) do
18
- Hash.new.tap do |env|
17
+ {}.tap do |env|
19
18
  env[:ui] = double('ui')
20
19
  env[:ui].stub(:info).with(anything)
21
20
  env[:ui].stub(:error).with(anything)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::Message do
4
-
5
4
  let(:ui) do
6
5
  double('ui').tap do |ui|
7
6
  ui.stub(:info).with(anything)
@@ -10,7 +9,7 @@ describe VagrantPlugins::Openstack::Action::Message do
10
9
  end
11
10
 
12
11
  let(:env) do
13
- Hash.new.tap do |env|
12
+ {}.tap do |env|
14
13
  env[:ui] = ui
15
14
  end
16
15
  end
@@ -0,0 +1,104 @@
1
+ require 'vagrant-openstack-provider/spec_helper'
2
+
3
+ #
4
+ # Stubing all the interactions using the real
5
+ # provisioner classes is somehow complicated...
6
+ #
7
+ class FakeProvisioner
8
+ def provision
9
+ end
10
+ end
11
+
12
+ class FakeShellProvisioner < FakeProvisioner
13
+ attr_accessor :config
14
+
15
+ def initialize(config)
16
+ @config = config
17
+ end
18
+ end
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
+ describe VagrantPlugins::Openstack::Action::ProvisionWrapper do
32
+ let(:app) do
33
+ double
34
+ end
35
+
36
+ let(:internal_provision_wrapper) do
37
+ double
38
+ end
39
+
40
+ before :each do
41
+ @action = ProvisionWrapper.new(app, nil)
42
+ end
43
+
44
+ describe 'execute' do
45
+ it 'call InternalProvisionWrapper and conitnue the middleware chain' do
46
+ expect(internal_provision_wrapper).to receive(:call)
47
+ InternalProvisionWrapper.stub(:new) { internal_provision_wrapper }
48
+ app.stub(:call) {}
49
+ @action.execute nil
50
+ end
51
+ end
52
+ end
53
+
54
+ describe VagrantPlugins::Openstack::Action::InternalProvisionWrapper do
55
+ let(:env) do
56
+ {}
57
+ end
58
+
59
+ before :each do
60
+ @action = InternalProvisionWrapper.new(nil, env)
61
+ end
62
+
63
+ describe 'run_provisioner' do
64
+ context 'when running a shell provisioner' do
65
+ context 'without meta-arg' do
66
+ it 'does not change the provisioner config' do
67
+ env[:provisioner] = FakeShellProvisioner.new(OpenStruct.new.tap do |c|
68
+ c.args = %w(arg1 arg2)
69
+ end)
70
+
71
+ expect(env[:provisioner]).to receive(:provision)
72
+ expect(@action).to receive(:handle_shell_meta_args)
73
+
74
+ @action.run_provisioner(env)
75
+ expect(env[:provisioner].config.args).to eq(%w(arg1 arg2))
76
+ end
77
+ end
78
+
79
+ context 'with @@ssh_ip@@ meta-arg' do
80
+ it 'replace the meta-args in the provisioner config' do
81
+ env[:provisioner] = FakeShellProvisioner.new(OpenStruct.new.tap do |c|
82
+ c.args = ['arg1', '@@ssh_ip@@', 'arg3']
83
+ end)
84
+
85
+ VagrantPlugins::Openstack::Action.stub(:get_ssh_info).and_return host: '192.168.0.1'
86
+ expect(env[:provisioner]).to receive(:provision)
87
+
88
+ @action.run_provisioner(env)
89
+ expect(env[:provisioner].config.args).to eq(%w(arg1 192.168.0.1 arg3))
90
+ end
91
+ end
92
+ end
93
+
94
+ context 'when running a provisioner other that the shell provisioner' do
95
+ it 'does not call handle_shell_meta_args' do
96
+ env[:provisioner] = FakeProvisioner.new
97
+ expect(@action).should_not_receive(:handle_shell_meta_args)
98
+ expect(env[:provisioner]).to receive(:provision)
99
+
100
+ @action.run_provisioner(env)
101
+ end
102
+ end
103
+ end
104
+ end
@@ -5,7 +5,6 @@ include VagrantPlugins::Openstack::HttpUtils
5
5
  include VagrantPlugins::Openstack::Domain
6
6
 
7
7
  describe VagrantPlugins::Openstack::Action::ReadSSHInfo do
8
-
9
8
  let(:config) do
10
9
  double('config').tap do |config|
11
10
  config.stub(:openstack_auth_url) { 'http://keystoneAuthV2' }
@@ -54,7 +53,7 @@ describe VagrantPlugins::Openstack::Action::ReadSSHInfo do
54
53
  end
55
54
 
56
55
  let(:env) do
57
- Hash.new.tap do |env|
56
+ {}.tap do |env|
58
57
  env[:ui] = double('ui')
59
58
  env[:ui].stub(:info).with(anything)
60
59
  env[:machine] = double('machine')
@@ -188,5 +187,4 @@ describe VagrantPlugins::Openstack::Action::ReadSSHInfo do
188
187
  end
189
188
  end
190
189
  end
191
-
192
190
  end
@@ -1,13 +1,12 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::ReadState do
4
-
5
4
  let(:nova) do
6
5
  double('nova')
7
6
  end
8
7
 
9
8
  let(:env) do
10
- Hash.new.tap do |env|
9
+ {}.tap do |env|
11
10
  env[:ui] = double('ui').tap do |ui|
12
11
  ui.stub(:info).with(anything)
13
12
  ui.stub(:error).with(anything)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::Resume do
4
-
5
4
  let(:nova) do
6
5
  double('nova').tap do |nova|
7
6
  nova.stub(:resume_server)
@@ -9,7 +8,7 @@ describe VagrantPlugins::Openstack::Action::Resume do
9
8
  end
10
9
 
11
10
  let(:env) do
12
- Hash.new.tap do |env|
11
+ {}.tap do |env|
13
12
  env[:ui] = double('ui').tap do |ui|
14
13
  ui.stub(:info).with(anything)
15
14
  ui.stub(:error).with(anything)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::StartServer do
4
-
5
4
  let(:nova) do
6
5
  double('nova').tap do |nova|
7
6
  nova.stub(:start_server)
@@ -9,7 +8,7 @@ describe VagrantPlugins::Openstack::Action::StartServer do
9
8
  end
10
9
 
11
10
  let(:env) do
12
- Hash.new.tap do |env|
11
+ {}.tap do |env|
13
12
  env[:ui] = double('ui').tap do |ui|
14
13
  ui.stub(:info).with(anything)
15
14
  ui.stub(:error).with(anything)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::StopServer do
4
-
5
4
  let(:nova) do
6
5
  double('nova').tap do |nova|
7
6
  nova.stub(:stop_server)
@@ -9,7 +8,7 @@ describe VagrantPlugins::Openstack::Action::StopServer do
9
8
  end
10
9
 
11
10
  let(:env) do
12
- Hash.new.tap do |env|
11
+ {}.tap do |env|
13
12
  env[:ui] = double('ui').tap do |ui|
14
13
  ui.stub(:info).with(anything)
15
14
  ui.stub(:error).with(anything)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::Suspend do
4
-
5
4
  let(:nova) do
6
5
  double('nova').tap do |nova|
7
6
  nova.stub(:suspend_server)
@@ -9,7 +8,7 @@ describe VagrantPlugins::Openstack::Action::Suspend do
9
8
  end
10
9
 
11
10
  let(:env) do
12
- Hash.new.tap do |env|
11
+ {}.tap do |env|
13
12
  env[:ui] = double('ui').tap do |ui|
14
13
  ui.stub(:info).with(anything)
15
14
  ui.stub(:error).with(anything)
@@ -6,7 +6,6 @@ require 'vagrant/util/subprocess'
6
6
  include VagrantPlugins::Openstack::Action
7
7
 
8
8
  describe VagrantPlugins::Openstack::Action::SyncFolders do
9
-
10
9
  let(:app) do
11
10
  double('app').tap do |app|
12
11
  app.stub(:call).with(anything)
@@ -34,7 +33,7 @@ describe VagrantPlugins::Openstack::Action::SyncFolders do
34
33
  end
35
34
 
36
35
  let(:env) do
37
- Hash.new.tap do |env|
36
+ {}.tap do |env|
38
37
  env[:ui] = double('ui').tap do |ui|
39
38
  ui.stub(:info).with(anything)
40
39
  ui.stub(:error).with(anything)
@@ -1,13 +1,12 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::WaitForServerToBeAccessible do
4
-
5
4
  let(:config) do
6
5
  double('config')
7
6
  end
8
7
 
9
8
  let(:env) do
10
- Hash.new.tap do |env|
9
+ {}.tap do |env|
11
10
  env[:ui] = double('ui')
12
11
  env[:ui].stub(:info).with(anything)
13
12
  env[:ui].stub(:error).with(anything)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::WaitForServerToBeActive do
4
-
5
4
  let(:nova) do
6
5
  double('nova')
7
6
  end
@@ -11,7 +10,7 @@ describe VagrantPlugins::Openstack::Action::WaitForServerToBeActive do
11
10
  end
12
11
 
13
12
  let(:env) do
14
- Hash.new.tap do |env|
13
+ {}.tap do |env|
15
14
  env[:ui] = double('ui').tap do |ui|
16
15
  ui.stub(:info).with(anything)
17
16
  ui.stub(:error).with(anything)
@@ -35,7 +34,7 @@ describe VagrantPlugins::Openstack::Action::WaitForServerToBeActive do
35
34
  describe 'call' do
36
35
  context 'when server is not yet active' do
37
36
  it 'become active after one retry' do
38
- nova.stub(:get_server_details).and_return({ 'status' => 'BUILD' }, { 'status' => 'ACTIVE' })
37
+ nova.stub(:get_server_details).and_return({ 'status' => 'BUILD' }, 'status' => 'ACTIVE')
39
38
  expect(nova).to receive(:get_server_details).with(env, 'server_id').exactly(2).times
40
39
  expect(app).to receive(:call)
41
40
  config.stub(:server_active_timeout) { 5 }
@@ -43,7 +42,7 @@ describe VagrantPlugins::Openstack::Action::WaitForServerToBeActive do
43
42
  @action.call(env)
44
43
  end
45
44
  it 'timeout after one retry' do
46
- nova.stub(:get_server_details).and_return({ 'status' => 'BUILD' }, { 'status' => 'BUILD' })
45
+ nova.stub(:get_server_details).and_return({ 'status' => 'BUILD' }, 'status' => 'BUILD')
47
46
  expect(nova).to receive(:get_server_details).with(env, 'server_id').at_least(2).times
48
47
  config.stub(:server_active_timeout) { 2 }
49
48
  @action = WaitForServerToBeActive.new(app, nil, 1)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action::WaitForServerToStop do
4
-
5
4
  let(:nova) do
6
5
  double('nova')
7
6
  end
@@ -11,7 +10,7 @@ describe VagrantPlugins::Openstack::Action::WaitForServerToStop do
11
10
  end
12
11
 
13
12
  let(:env) do
14
- Hash.new.tap do |env|
13
+ {}.tap do |env|
15
14
  env[:ui] = double('ui').tap do |ui|
16
15
  ui.stub(:info).with(anything)
17
16
  ui.stub(:error).with(anything)
@@ -35,7 +34,7 @@ describe VagrantPlugins::Openstack::Action::WaitForServerToStop do
35
34
  describe 'call' do
36
35
  context 'when server is active' do
37
36
  it 'become shutoff after one retry' do
38
- nova.stub(:get_server_details).and_return({ 'status' => 'ACTIVE' }, { 'status' => 'SHUTOFF' })
37
+ nova.stub(:get_server_details).and_return({ 'status' => 'ACTIVE' }, 'status' => 'SHUTOFF')
39
38
  expect(nova).to receive(:get_server_details).with(env, 'server_id').exactly(2).times
40
39
  expect(app).to receive(:call)
41
40
  config.stub(:server_stop_timeout) { 5 }
@@ -43,7 +42,7 @@ describe VagrantPlugins::Openstack::Action::WaitForServerToStop do
43
42
  @action.call(env)
44
43
  end
45
44
  it 'timeout after one retry' do
46
- nova.stub(:get_server_details).and_return({ 'status' => 'ACTIVE' }, { 'status' => 'ACTIVE' })
45
+ nova.stub(:get_server_details).and_return({ 'status' => 'ACTIVE' }, 'status' => 'ACTIVE')
47
46
  expect(nova).to receive(:get_server_details).with(env, 'server_id').at_least(2).times
48
47
  config.stub(:server_stop_timeout) { 2 }
49
48
  @action = WaitForServerToStop.new(app, nil, 1)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::Action do
4
-
5
4
  let(:builder) do
6
5
  double('builder').tap do |builder|
7
6
  builder.stub(:use)
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::CinderClient do
4
-
5
4
  let(:http) do
6
5
  double('http').tap do |http|
7
6
  http.stub(:read_timeout) { 42 }
@@ -16,7 +15,7 @@ describe VagrantPlugins::Openstack::CinderClient do
16
15
  end
17
16
 
18
17
  let(:env) do
19
- Hash.new.tap do |env|
18
+ {}.tap do |env|
20
19
  env[:machine] = double('machine')
21
20
  env[:machine].stub(:provider_config) { config }
22
21
  end
@@ -36,15 +35,14 @@ describe VagrantPlugins::Openstack::CinderClient do
36
35
  describe 'get_all_volumes' do
37
36
  context 'on api v1' do
38
37
  it 'returns volumes with details' do
39
-
40
38
  stub_request(:get, 'http://cinder/volumes/detail')
41
- .with(
39
+ .with(
42
40
  headers:
43
41
  {
44
42
  'Accept' => 'application/json',
45
43
  'X-Auth-Token' => '123456'
46
44
  })
47
- .to_return(
45
+ .to_return(
48
46
  status: 200,
49
47
  body: '
50
48
  {
@@ -83,15 +81,14 @@ describe VagrantPlugins::Openstack::CinderClient do
83
81
 
84
82
  context 'on api v2' do
85
83
  it 'returns volumes with details' do
86
-
87
84
  stub_request(:get, 'http://cinder/volumes/detail')
88
- .with(
85
+ .with(
89
86
  headers:
90
87
  {
91
88
  'Accept' => 'application/json',
92
89
  'X-Auth-Token' => '123456'
93
90
  })
94
- .to_return(
91
+ .to_return(
95
92
  status: 200,
96
93
  body: '
97
94
  {
@@ -1,7 +1,6 @@
1
1
  require 'vagrant-openstack-provider/spec_helper'
2
2
 
3
3
  describe VagrantPlugins::Openstack::GlanceClient do
4
-
5
4
  let(:http) do
6
5
  double('http').tap do |http|
7
6
  http.stub(:read_timeout) { 42 }
@@ -16,7 +15,7 @@ describe VagrantPlugins::Openstack::GlanceClient do
16
15
  end
17
16
 
18
17
  let(:env) do
19
- Hash.new.tap do |env|
18
+ {}.tap do |env|
20
19
  env[:machine] = double('machine')
21
20
  env[:machine].stub(:provider_config) { config }
22
21
  end
@@ -38,21 +37,21 @@ describe VagrantPlugins::Openstack::GlanceClient do
38
37
  context 'and api version is v2' do
39
38
  it 'returns all images with details' do
40
39
  stub_request(:get, 'http://glance/images')
41
- .with(
42
- headers:
40
+ .with(
41
+ headers:
42
+ {
43
+ 'Accept' => 'application/json',
44
+ 'X-Auth-Token' => '123456'
45
+ })
46
+ .to_return(
47
+ status: 200,
48
+ body: '
43
49
  {
44
- 'Accept' => 'application/json',
45
- 'X-Auth-Token' => '123456'
46
- })
47
- .to_return(
48
- status: 200,
49
- body: '
50
- {
51
- "images": [
52
- { "id": "i1", "name": "image1", "visibility": "public", "size": "1024", "min_ram": "1", "min_disk": "10" },
53
- { "id": "i2", "name": "image2", "visibility": "private", "size": "2048", "min_ram": "2", "min_disk": "20" }
54
- ]
55
- }')
50
+ "images": [
51
+ { "id": "i1", "name": "image1", "visibility": "public", "size": "1024", "min_ram": "1", "min_disk": "10" },
52
+ { "id": "i2", "name": "image2", "visibility": "private", "size": "2048", "min_ram": "2", "min_disk": "20" }
53
+ ]
54
+ }')
56
55
 
57
56
  images = @glance_client.get_all_images(env)
58
57
 
@@ -64,38 +63,38 @@ describe VagrantPlugins::Openstack::GlanceClient do
64
63
  context 'and api version is v1' do
65
64
  it 'returns all images with details' do
66
65
  stub_request(:get, 'http://glance/images')
67
- .with(
68
- headers:
66
+ .with(
67
+ headers:
68
+ {
69
+ 'Accept' => 'application/json',
70
+ 'X-Auth-Token' => '123456'
71
+ })
72
+ .to_return(
73
+ status: 200,
74
+ body: '
69
75
  {
70
- 'Accept' => 'application/json',
71
- 'X-Auth-Token' => '123456'
72
- })
73
- .to_return(
74
- status: 200,
75
- body: '
76
- {
77
- "images": [
78
- { "id": "i1", "name": "image1", "is_public": true },
79
- { "id": "i2", "name": "image2", "is_public": false }
80
- ]
81
- }')
76
+ "images": [
77
+ { "id": "i1", "name": "image1", "is_public": true },
78
+ { "id": "i2", "name": "image2", "is_public": false }
79
+ ]
80
+ }')
82
81
 
83
82
  stub_request(:get, 'http://glance/images/detail')
84
- .with(
85
- headers:
83
+ .with(
84
+ headers:
85
+ {
86
+ 'Accept' => 'application/json',
87
+ 'X-Auth-Token' => '123456'
88
+ })
89
+ .to_return(
90
+ status: 200,
91
+ body: '
86
92
  {
87
- 'Accept' => 'application/json',
88
- 'X-Auth-Token' => '123456'
89
- })
90
- .to_return(
91
- status: 200,
92
- body: '
93
- {
94
- "images": [
95
- { "id": "i1", "name": "image1", "is_public": true, "size": "1024", "min_ram": "1", "min_disk": "10" },
96
- { "id": "i2", "name": "image2", "is_public": false, "size": "2048", "min_ram": "2", "min_disk": "20" }
97
- ]
98
- }')
93
+ "images": [
94
+ { "id": "i1", "name": "image1", "is_public": true, "size": "1024", "min_ram": "1", "min_disk": "10" },
95
+ { "id": "i2", "name": "image2", "is_public": false, "size": "2048", "min_ram": "2", "min_disk": "20" }
96
+ ]
97
+ }')
99
98
 
100
99
  images = @glance_client.get_all_images(env)
101
100
 
@@ -109,32 +108,32 @@ describe VagrantPlugins::Openstack::GlanceClient do
109
108
  describe 'get_api_version_list' do
110
109
  it 'returns version list' do
111
110
  stub_request(:get, 'http://glance/')
112
- .with(header: { 'Accept' => 'application/json' })
113
- .to_return(
114
- status: 200,
115
- body: '{
116
- "versions": [
117
- {
118
- "status": "...",
119
- "id": "v1.0",
120
- "links": [
121
- {
122
- "href": "http://glance/v1.0",
123
- "rel": "self"
124
- }
125
- ]
126
- },
127
- {
128
- "status": "CURRENT",
129
- "id": "v2.0",
130
- "links": [
131
- {
132
- "href": "http://glance/v2.0",
133
- "rel": "self"
134
- }
135
- ]
136
- }
137
- ]}')
111
+ .with(header: { 'Accept' => 'application/json' })
112
+ .to_return(
113
+ status: 200,
114
+ body: '{
115
+ "versions": [
116
+ {
117
+ "status": "...",
118
+ "id": "v1.0",
119
+ "links": [
120
+ {
121
+ "href": "http://glance/v1.0",
122
+ "rel": "self"
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ "status": "CURRENT",
128
+ "id": "v2.0",
129
+ "links": [
130
+ {
131
+ "href": "http://glance/v2.0",
132
+ "rel": "self"
133
+ }
134
+ ]
135
+ }
136
+ ]}')
138
137
 
139
138
  versions = @glance_client.get_api_version_list(env)
140
139