vagrant-rimu 0.0.4 → 0.0.5
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/.gitignore +2 -0
- data/README.md +12 -3
- data/Vagrantfile +15 -10
- data/lib/vagrant-rimu/actions/connect_to_rimu.rb +7 -3
- data/lib/vagrant-rimu/actions/create.rb +7 -1
- data/lib/vagrant-rimu/actions/is_created.rb +18 -18
- data/lib/vagrant-rimu/actions/is_stopped.rb +1 -1
- data/lib/vagrant-rimu/actions/message_action_not_supported.rb +19 -0
- data/lib/vagrant-rimu/actions/message_will_not_stop.rb +19 -0
- data/lib/vagrant-rimu/actions/modify_provision_path.rb +1 -1
- data/lib/vagrant-rimu/actions/move.rb +1 -1
- data/lib/vagrant-rimu/actions/read_ssh_info.rb +4 -3
- data/lib/vagrant-rimu/actions/read_state.rb +1 -1
- data/lib/vagrant-rimu/actions/rebuild.rb +21 -2
- data/lib/vagrant-rimu/actions/setup_user.rb +22 -19
- data/lib/vagrant-rimu/actions/ssh_utils.rb +44 -0
- data/lib/vagrant-rimu/actions/stop_instance.rb +6 -2
- data/lib/vagrant-rimu/actions/terminate_instance.rb +6 -2
- data/lib/vagrant-rimu/actions.rb +99 -85
- data/lib/vagrant-rimu/commands/abstract_command.rb +1 -1
- data/lib/vagrant-rimu/commands/rebuild.rb +6 -7
- data/lib/vagrant-rimu/commands/root.rb +1 -1
- data/lib/vagrant-rimu/config.rb +2 -2
- data/lib/vagrant-rimu/plugin.rb +1 -1
- data/lib/vagrant-rimu/provider.rb +1 -1
- data/lib/vagrant-rimu/version.rb +1 -1
- data/locales/en.yml +26 -8
- data/spec/spec_helper.rb +1 -1
- data/spec/vagrant-rimu/actions/connect_to_rimu_spec.rb +2 -1
- data/spec/vagrant-rimu/actions/create_spec.rb +4 -1
- data/spec/vagrant-rimu/actions/is_created_spec.rb +1 -1
- data/spec/vagrant-rimu/actions/is_stopped_spec.rb +2 -2
- data/spec/vagrant-rimu/actions/message_action_not_supported_spec.rb +30 -0
- data/spec/vagrant-rimu/actions/message_already_created_spec.rb +1 -4
- data/spec/vagrant-rimu/actions/message_will_not_destroy_spec.rb +1 -2
- data/spec/vagrant-rimu/actions/message_will_not_stop_spec.rb +35 -0
- data/spec/vagrant-rimu/actions/read_ssh_info_spec.rb +8 -0
- data/spec/vagrant-rimu/actions/rebuild_spec.rb +7 -1
- data/spec/vagrant-rimu/actions/stop_instance_spec.rb +4 -4
- data/spec/vagrant-rimu/commands/rebuild_spec.rb +20 -17
- data/test/Vagrantfile +3 -1
- metadata +9 -2
data/lib/vagrant-rimu/actions.rb
CHANGED
@@ -11,19 +11,19 @@ module VagrantPlugins
|
|
11
11
|
# This action is called to terminate the remote machine.
|
12
12
|
def self.action_destroy
|
13
13
|
new_builder.tap do |b|
|
14
|
-
b.use Call, DestroyConfirm do |env,
|
14
|
+
b.use Call, DestroyConfirm do |env, b1|
|
15
15
|
if env[:result]
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
b1.use ConfigValidate
|
17
|
+
b1.use ConnectToRimu
|
18
|
+
b1.use Call, ReadState do |env1, b2|
|
19
|
+
if env1[:machine_state] == :not_created
|
20
|
+
b2.use MessageNotCreated
|
21
|
+
else
|
22
|
+
b2.use TerminateInstance
|
21
23
|
end
|
22
24
|
end
|
23
|
-
b2.use ConnectToRimu
|
24
|
-
b2.use TerminateInstance
|
25
25
|
else
|
26
|
-
|
26
|
+
b1.use MessageWillNotDestroy
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -41,7 +41,7 @@ module VagrantPlugins
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# This action is called to read the state of the machine. The
|
44
|
-
# resulting state is expected to be put into the `:
|
44
|
+
# resulting state is expected to be put into the `:machine_state`
|
45
45
|
# key.
|
46
46
|
def self.action_read_state
|
47
47
|
new_builder.tap do |b|
|
@@ -55,13 +55,13 @@ module VagrantPlugins
|
|
55
55
|
def self.action_ssh
|
56
56
|
new_builder.tap do |b|
|
57
57
|
b.use ConfigValidate
|
58
|
-
b.use
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
b.use ConnectToRimu
|
59
|
+
b.use Call, ReadState do |env, b1|
|
60
|
+
if env[:machine_state] == :not_created
|
61
|
+
b1.use MessageNotCreated
|
62
|
+
else
|
63
|
+
b1.use SSHExec
|
62
64
|
end
|
63
|
-
|
64
|
-
b2.use SSHExec
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -69,53 +69,53 @@ module VagrantPlugins
|
|
69
69
|
def self.action_ssh_run
|
70
70
|
new_builder.tap do |b|
|
71
71
|
b.use ConfigValidate
|
72
|
-
b.use
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
b.use ConnectToRimu
|
73
|
+
b.use Call, ReadState do |env, b1|
|
74
|
+
if env[:machine_state] == :not_created
|
75
|
+
b1.use MessageNotCreated
|
76
|
+
else
|
77
|
+
b1.use SSHRun
|
76
78
|
end
|
77
|
-
|
78
|
-
b2.use SSHRun
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
# This action is called when `vagrant provision` is called.
|
84
84
|
def self.action_provision
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
new_builder.tap do |b|
|
86
|
+
b.use ConfigValidate
|
87
|
+
b.use ConnectToRimu
|
88
|
+
b.use Call, ReadState do |env, b1|
|
89
89
|
case env[:machine_state]
|
90
90
|
when :active
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
b1.use Provision
|
92
|
+
b1.use ModifyProvisionPath
|
93
|
+
b1.use SyncedFolders
|
94
94
|
when :off
|
95
95
|
env[:ui].info I18n.t('vagrant_rimu.off')
|
96
96
|
when :not_created
|
97
|
-
|
97
|
+
b1.use MessageNotCreated
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
def self.action_up
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
104
|
+
new_builder.tap do |b|
|
105
|
+
b.use ConfigValidate
|
106
|
+
b.use ConnectToRimu
|
107
|
+
b.use Call, ReadState do |env, b1|
|
108
108
|
case env[:machine_state]
|
109
|
-
when :active
|
110
|
-
b.use MessageAlreadyCreated
|
111
|
-
when :off
|
112
|
-
b.use StartInstance
|
113
|
-
b.use action_provision
|
114
109
|
when :not_created
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
110
|
+
b1.use Create
|
111
|
+
b1.use SetupSudo
|
112
|
+
b1.use SetupUser
|
113
|
+
b1.use action_provision
|
114
|
+
when :off
|
115
|
+
b1.use StartInstance
|
116
|
+
b1.use action_provision
|
117
|
+
else
|
118
|
+
b1.use MessageAlreadyCreated
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -123,56 +123,54 @@ module VagrantPlugins
|
|
123
123
|
|
124
124
|
# This action is called to halt the remote machine.
|
125
125
|
def self.action_halt
|
126
|
-
new_builder.tap do |
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
end
|
141
|
-
end
|
126
|
+
new_builder.tap do |b|
|
127
|
+
b.use MessageWillNotStop
|
128
|
+
# b.use ConfigValidate
|
129
|
+
# b.use ConnectToRimu
|
130
|
+
# b.use Call, ReadState do |env, b1|
|
131
|
+
# case env[:machine_state]
|
132
|
+
# when :not_created
|
133
|
+
# b1.use MessageNotCreated
|
134
|
+
# when :off
|
135
|
+
# b1.use MessageAlreadyOff
|
136
|
+
# else
|
137
|
+
# b1.use StopInstance
|
138
|
+
# end
|
139
|
+
# end
|
142
140
|
end
|
143
141
|
end
|
144
142
|
|
145
143
|
def self.action_reload
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
144
|
+
new_builder.tap do |b|
|
145
|
+
b.use ConfigValidate
|
146
|
+
b.use ConnectToRimu
|
147
|
+
b.use Call, ReadState do |env, b1|
|
150
148
|
case env[:machine_state]
|
151
|
-
when :
|
152
|
-
|
153
|
-
b.use action_provision
|
149
|
+
when :not_created
|
150
|
+
b1.use MessageNotCreated
|
154
151
|
when :off
|
155
152
|
env[:ui].info I18n.t('vagrant_rimu.off')
|
156
|
-
|
157
|
-
|
153
|
+
else
|
154
|
+
b1.use Reload
|
155
|
+
b1.use action_provision
|
158
156
|
end
|
159
157
|
end
|
160
158
|
end
|
161
159
|
end
|
162
160
|
|
163
161
|
def self.action_rebuild
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
new_builder.tap do |b|
|
163
|
+
b.use ConfigValidate
|
164
|
+
b.use ConnectToRimu
|
165
|
+
b.use Call, ReadState do |env, b1|
|
168
166
|
case env[:machine_state]
|
169
167
|
when :active, :off
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
168
|
+
b1.use Rebuild
|
169
|
+
b1.use SetupSudo
|
170
|
+
b1.use SetupUser
|
171
|
+
b1.use action_provision
|
174
172
|
when :not_created
|
175
|
-
|
173
|
+
b1.use MessageNotCreated
|
176
174
|
end
|
177
175
|
end
|
178
176
|
end
|
@@ -203,26 +201,40 @@ module VagrantPlugins
|
|
203
201
|
end
|
204
202
|
|
205
203
|
def self.action_move
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
204
|
+
new_builder.tap do |b|
|
205
|
+
b.use ConfigValidate
|
206
|
+
b.use ConnectToRimu
|
207
|
+
b.use Call, ReadState do |env, b1|
|
210
208
|
case env[:machine_state]
|
211
209
|
when :active, :off
|
212
|
-
|
210
|
+
b1.use Move
|
213
211
|
when :not_created
|
214
|
-
|
212
|
+
b1.use MessageNotCreated
|
215
213
|
end
|
216
214
|
end
|
217
215
|
end
|
218
216
|
end
|
219
217
|
|
218
|
+
def self.action_suspend
|
219
|
+
new_builder.tap do |b|
|
220
|
+
b.use ConfigValidate
|
221
|
+
b.use MessageActionNotSupported
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def self.action_resume
|
226
|
+
new_builder.tap do |b|
|
227
|
+
b.use ConfigValidate
|
228
|
+
b.use MessageActionNotSupported
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
220
232
|
action_root = Pathname.new(File.expand_path('../actions', __FILE__))
|
221
233
|
autoload :ConnectToRimu, action_root.join('connect_to_rimu')
|
222
234
|
autoload :StopInstance, action_root.join('stop_instance')
|
223
235
|
autoload :TerminateInstance, action_root.join('terminate_instance')
|
224
|
-
autoload :IsCreated, action_root.join('is_created')
|
225
|
-
autoload :IsStopped, action_root.join('is_stopped')
|
236
|
+
# autoload :IsCreated, action_root.join('is_created')
|
237
|
+
# autoload :IsStopped, action_root.join('is_stopped')
|
226
238
|
autoload :ReadSSHInfo, action_root.join('read_ssh_info')
|
227
239
|
autoload :ReadState, action_root.join('read_state')
|
228
240
|
autoload :StartInstance, action_root.join('start_instance')
|
@@ -240,6 +252,8 @@ module VagrantPlugins
|
|
240
252
|
autoload :MessageNotCreated, action_root.join('message_not_created')
|
241
253
|
autoload :MessageWillNotDestroy, action_root.join('message_will_not_destroy')
|
242
254
|
autoload :MessageAlreadyCreated, action_root.join('message_already_created')
|
255
|
+
autoload :MessageWillNotStop, action_root.join('message_will_not_stop')
|
256
|
+
autoload :MessageActionNotSupported, action_root.join('message_action_not_supported')
|
243
257
|
|
244
258
|
private
|
245
259
|
|
@@ -21,7 +21,7 @@ module VagrantPlugins
|
|
21
21
|
cmd(name, @argv, env)
|
22
22
|
@env.ui.info('')
|
23
23
|
# rubocop:disable Lint/RescueException
|
24
|
-
rescue Errors::
|
24
|
+
rescue Errors::RimuError, SystemExit, Interrupt => e
|
25
25
|
raise e
|
26
26
|
rescue Exception => e
|
27
27
|
puts I18n.t('vagrant_rimu.errors.global_error').red unless e.message
|
@@ -1,17 +1,16 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'vagrant-rimu/commands/abstract_command'
|
3
|
-
|
4
1
|
module VagrantPlugins
|
5
2
|
module Rimu
|
6
3
|
module Commands
|
7
|
-
class Rebuild <
|
4
|
+
class Rebuild < Vagrant.plugin('2', :command)
|
8
5
|
def self.synopsis
|
9
6
|
I18n.t('vagrant_rimu.commands.rebuild')
|
10
7
|
end
|
11
8
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
9
|
+
def execute
|
10
|
+
with_target_vms(nil, provider: :rimu) do |machine|
|
11
|
+
machine.action(:rebuild)
|
12
|
+
end
|
13
|
+
0
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
@@ -6,7 +6,7 @@ module VagrantPlugins
|
|
6
6
|
{ name: :'distributions', file: 'distributions', clazz: 'Distributions' },
|
7
7
|
{ name: :'servers', file: 'list_servers', clazz: 'ListServers' },
|
8
8
|
{ name: :'move-vps', file: 'move', clazz: 'Move' },
|
9
|
-
{ name: :'rebuild', file: 'rebuild', clazz: 'Rebuild' },
|
9
|
+
# { name: :'rebuild', file: 'rebuild', clazz: 'Rebuild' },
|
10
10
|
]
|
11
11
|
|
12
12
|
class Root < Vagrant.plugin('2', :command)
|
data/lib/vagrant-rimu/config.rb
CHANGED
@@ -165,8 +165,8 @@ module VagrantPlugins
|
|
165
165
|
|
166
166
|
def validate(machine)
|
167
167
|
errors = []
|
168
|
-
errors << I18n.t('vagrant_rimu.config.api_key')
|
169
|
-
errors << I18n.t('vagrant_rimu.config.host_name')
|
168
|
+
errors << I18n.t('vagrant_rimu.config.api_key') unless @api_key
|
169
|
+
errors << I18n.t('vagrant_rimu.config.host_name') unless @host_name
|
170
170
|
if @host_name
|
171
171
|
errors << I18n.t('vagrant_rimu.config.invalid_host_name', {:host_name => @host_name}) \
|
172
172
|
unless @host_name.match(/\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/)
|
data/lib/vagrant-rimu/plugin.rb
CHANGED
@@ -33,7 +33,7 @@ module VagrantPlugins
|
|
33
33
|
# key in the environment.
|
34
34
|
env = @machine.action("read_state")
|
35
35
|
|
36
|
-
state_id = env[:
|
36
|
+
state_id = env[:machine_state]
|
37
37
|
|
38
38
|
# Get the short and long description
|
39
39
|
short = I18n.t("vagrant_rimu.states.short_#{state_id}")
|
data/lib/vagrant-rimu/version.rb
CHANGED
data/locales/en.yml
CHANGED
@@ -23,10 +23,15 @@ en:
|
|
23
23
|
will_not_destroy: |-
|
24
24
|
The VPS '%{name}' will not be destroyed, since the confirmation
|
25
25
|
was declined.
|
26
|
+
will_not_stop: |-
|
27
|
+
The VPS '%{name}' will not be stopped, as the Rimu API does not
|
28
|
+
support this action. To stop your VPS run `vagrant ssh` and then
|
29
|
+
`halt` on the VPS console.
|
26
30
|
ip_address: |-
|
27
31
|
Assigned IP address: %{ip}
|
28
32
|
creating_user: "Creating user account: %{user}..."
|
29
33
|
modifying_sudo: "Modifying sudoers file to remove tty requirement..."
|
34
|
+
action_not_supported: "The requested command is not supported by this provider"
|
30
35
|
reloading: "Rebooting the VPS..."
|
31
36
|
rebuilding: "Rebuilding the VPS..."
|
32
37
|
config:
|
@@ -48,8 +53,12 @@ en:
|
|
48
53
|
The VPS is starting.
|
49
54
|
short_stopped: |-
|
50
55
|
stopped
|
56
|
+
short_off: |-
|
57
|
+
stopped
|
51
58
|
long_stopped: |-
|
52
59
|
The VPS is stopped. Run `vagrant up` to start it.
|
60
|
+
long_off: |-
|
61
|
+
The VPS is stopped. Run `vagrant up` to start it.
|
53
62
|
short_stopping: |-
|
54
63
|
stopping
|
55
64
|
long_stopping: |-
|
@@ -57,26 +66,35 @@ en:
|
|
57
66
|
run `vagrant up` and start it.
|
58
67
|
short_running: |-
|
59
68
|
running
|
69
|
+
short_active: |-
|
70
|
+
running
|
60
71
|
long_running: |-
|
61
72
|
The VPS is running. To stop this machine, you can run
|
62
73
|
`vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
|
74
|
+
long_active: |-
|
75
|
+
The VPS is running. To stop this machine, you can run
|
76
|
+
`vagrant halt`. To destroy the machine, you can run `vagrant destroy`.
|
77
|
+
current_state: |-
|
78
|
+
Machine state is `%{state}`
|
63
79
|
commands:
|
64
80
|
root_synopsis: |-
|
65
|
-
|
81
|
+
Rimu provider specific commands
|
66
82
|
root_usage: |-
|
67
|
-
|
83
|
+
Usage: vagrant rimu <subcommand> [<args>]
|
84
|
+
rebuild_usage: |-
|
85
|
+
Usage: vagrant rebuild [vm-name]
|
68
86
|
available_subcommands: |-
|
69
|
-
|
87
|
+
Available subcommands:
|
70
88
|
billing_methods: |-
|
71
|
-
|
89
|
+
List billing methods
|
72
90
|
list_distributions: |-
|
73
|
-
|
91
|
+
List Distributions
|
74
92
|
list_servers: |-
|
75
|
-
|
93
|
+
List servers
|
76
94
|
move: |-
|
77
|
-
|
95
|
+
Moves server to different host
|
78
96
|
rebuild: |-
|
79
|
-
|
97
|
+
Rebuilds the server, retaining the current IP address
|
80
98
|
errors:
|
81
99
|
global_error: |-
|
82
100
|
An unknown error happened in Vagrant Rimu provider
|
data/spec/spec_helper.rb
CHANGED
@@ -4,7 +4,7 @@ if ENV['CI']=='true'
|
|
4
4
|
require 'codecov'
|
5
5
|
require 'coveralls'
|
6
6
|
require 'codeclimate-test-reporter'
|
7
|
-
SimpleCov.
|
7
|
+
SimpleCov.formatters = [
|
8
8
|
SimpleCov::Formatter::HTMLFormatter,
|
9
9
|
Coveralls::SimpleCov::Formatter,
|
10
10
|
SimpleCov::Formatter::Codecov,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe VagrantPlugins::Rimu::Actions::ConnectToRimu do
|
4
|
+
let(:rimu_api) { double('rimu_api') }
|
4
5
|
let(:app) do
|
5
6
|
double.tap do |app|
|
6
7
|
app.stub(:call)
|
@@ -21,7 +22,7 @@ describe VagrantPlugins::Rimu::Actions::ConnectToRimu do
|
|
21
22
|
env[:ui].stub(:warn).with(anything)
|
22
23
|
env[:machine] = double('machine')
|
23
24
|
env[:machine].stub(:provider_config) { config }
|
24
|
-
env[:rimu_api] =
|
25
|
+
env[:rimu_api] = rimu_api
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -7,7 +7,7 @@ require 'spec_helper'
|
|
7
7
|
describe VagrantPlugins::Rimu::Actions::Create do
|
8
8
|
let(:dup) { double('dup') }
|
9
9
|
let(:ssh) { double('ssh') }
|
10
|
-
|
10
|
+
let(:root_path) { '.' }
|
11
11
|
let(:servers) { double('servers') }
|
12
12
|
let(:machine) { double('machine') }
|
13
13
|
let(:create) { double('create') }
|
@@ -55,11 +55,14 @@ describe VagrantPlugins::Rimu::Actions::Create do
|
|
55
55
|
servers.stub(:create) { create }
|
56
56
|
os.stub(:servers) { servers }
|
57
57
|
end
|
58
|
+
env.stub(:root_path) { root_path }
|
58
59
|
machine.stub(:id) { id }
|
59
60
|
machine.stub(:id=) { id }
|
61
|
+
machine.stub(:env) { env }
|
60
62
|
env[:machine] = machine
|
61
63
|
env[:machine].stub(:config) { config }
|
62
64
|
env[:machine].stub(:provider_config) { config }
|
65
|
+
communicate.stub(:execute).with(anything)
|
63
66
|
communicate.stub(:ready?) { true }
|
64
67
|
env[:machine].stub(:communicate) { communicate }
|
65
68
|
# dup.stub(:delete) { double('delete') }
|
@@ -28,7 +28,7 @@ describe VagrantPlugins::Rimu::Actions::IsCreated do
|
|
28
28
|
describe 'call' do
|
29
29
|
context 'when server is created' do
|
30
30
|
it 'returns true' do
|
31
|
-
env[:machine].state.stub(:id) { :
|
31
|
+
env[:machine].state.stub(:id) { :off }
|
32
32
|
expect(app).to receive(:call)
|
33
33
|
@action = VagrantPlugins::Rimu::Actions::IsCreated.new(app, env)
|
34
34
|
@action.call(env)
|
@@ -28,7 +28,7 @@ describe VagrantPlugins::Rimu::Actions::IsStopped do
|
|
28
28
|
describe 'call' do
|
29
29
|
context 'when server is stopped' do
|
30
30
|
it 'returns true' do
|
31
|
-
env[:machine].state.stub(:id) { :
|
31
|
+
env[:machine].state.stub(:id) { :off }
|
32
32
|
expect(app).to receive(:call)
|
33
33
|
@action = VagrantPlugins::Rimu::Actions::IsStopped.new(app, env)
|
34
34
|
@action.call(env)
|
@@ -38,7 +38,7 @@ describe VagrantPlugins::Rimu::Actions::IsStopped do
|
|
38
38
|
|
39
39
|
context 'when server is running' do
|
40
40
|
it 'returns false' do
|
41
|
-
env[:machine].state.stub(:id) { :
|
41
|
+
env[:machine].state.stub(:id) { :active }
|
42
42
|
expect(app).to receive(:call)
|
43
43
|
@action = VagrantPlugins::Rimu::Actions::IsStopped.new(app, env)
|
44
44
|
@action.call(env)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# action_root = Pathname.new(File.expand_path('../../../../lib/vagrant-rimu/actions', __FILE__))
|
4
|
+
# autoload :StopInstance, action_root.join('stop_instance')
|
5
|
+
|
6
|
+
describe VagrantPlugins::Rimu::Actions::MessageActionNotSupported do
|
7
|
+
let(:env) do
|
8
|
+
{}.tap do |env|
|
9
|
+
env[:ui] = double('ui').tap do |ui|
|
10
|
+
ui.stub(:info).with(anything)
|
11
|
+
ui.stub(:error).with(anything)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:app) do
|
17
|
+
double('app').tap do |app|
|
18
|
+
app.stub(:call).with(anything)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'call' do
|
23
|
+
it 'sets info variable' do
|
24
|
+
expect(I18n).to receive(:t).with('vagrant_rimu.action_not_supported')
|
25
|
+
expect(app).to receive(:call)
|
26
|
+
@action = VagrantPlugins::Rimu::Actions::MessageActionNotSupported.new(app, env)
|
27
|
+
@action.call(env)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
1
|
require 'spec_helper'
|
5
2
|
|
6
3
|
# action_root = Pathname.new(File.expand_path('../../../../lib/vagrant-rimu/actions', __FILE__))
|
@@ -30,4 +27,4 @@ describe VagrantPlugins::Rimu::Actions::MessageAlreadyCreated do
|
|
30
27
|
@action.call(env)
|
31
28
|
end
|
32
29
|
end
|
33
|
-
end
|
30
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
# action_root = Pathname.new(File.expand_path('../../../../lib/vagrant-rimu/actions', __FILE__))
|
6
|
+
# autoload :StopInstance, action_root.join('stop_instance')
|
7
|
+
|
8
|
+
describe VagrantPlugins::Rimu::Actions::MessageWillNotStop do
|
9
|
+
let(:env) do
|
10
|
+
{}.tap do |env|
|
11
|
+
env[:ui] = double('ui').tap do |ui|
|
12
|
+
ui.stub(:info).with(anything)
|
13
|
+
ui.stub(:error).with(anything)
|
14
|
+
end
|
15
|
+
env[:machine] = OpenStruct.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:app) do
|
20
|
+
double('app').tap do |app|
|
21
|
+
app.stub(:call).with(anything)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'call' do
|
26
|
+
it 'sets info variable' do
|
27
|
+
name = 'rimu.example.com'
|
28
|
+
env[:machine].name = name
|
29
|
+
expect(I18n).to receive(:t).with('vagrant_rimu.will_not_stop', {:name => name})
|
30
|
+
expect(app).to receive(:call)
|
31
|
+
@action = VagrantPlugins::Rimu::Actions::MessageWillNotStop.new(app, env)
|
32
|
+
@action.call(env)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -5,12 +5,19 @@ require 'spec_helper'
|
|
5
5
|
# autoload :StopInstance, action_root.join('stop_instance')
|
6
6
|
|
7
7
|
describe VagrantPlugins::Rimu::Actions::ReadSSHInfo do
|
8
|
+
let(:ssh) { double('ssh') }
|
8
9
|
let(:orders) { double('orders') }
|
9
10
|
let(:machine) { double('machine') }
|
10
11
|
let(:order) { double('order') }
|
11
12
|
let(:allocated_ips) { {:primary_ip=>'192.168.1.1'} }
|
12
13
|
let(:id) { '200' }
|
13
14
|
|
15
|
+
let(:config) do
|
16
|
+
double.tap do |config|
|
17
|
+
ssh.stub(:private_key_path) { 'test/test_rimu_id_rsa' }
|
18
|
+
config.stub(:ssh) { ssh }
|
19
|
+
end
|
20
|
+
end
|
14
21
|
|
15
22
|
let(:env) do
|
16
23
|
{}.tap do |env|
|
@@ -24,6 +31,7 @@ describe VagrantPlugins::Rimu::Actions::ReadSSHInfo do
|
|
24
31
|
os.stub(:orders) { orders }
|
25
32
|
end
|
26
33
|
machine.stub(:id) { id }
|
34
|
+
machine.stub(:config) { config }
|
27
35
|
env[:machine] = machine
|
28
36
|
end
|
29
37
|
end
|