vagrant-openstack-plugin 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/vagrant-openstack-plugin/action/create_server.rb +1 -1
- data/lib/vagrant-openstack-plugin/action/delete_server.rb +2 -0
- data/lib/vagrant-openstack-plugin/action/hard_reboot_server.rb +27 -0
- data/lib/vagrant-openstack-plugin/action/is_created.rb +1 -1
- data/lib/vagrant-openstack-plugin/action/is_paused.rb +16 -0
- data/lib/vagrant-openstack-plugin/action/is_suspended.rb +16 -0
- data/lib/vagrant-openstack-plugin/action/message_already_paused.rb +16 -0
- data/lib/vagrant-openstack-plugin/action/message_already_suspended.rb +16 -0
- data/lib/vagrant-openstack-plugin/action/message_server_running.rb +16 -0
- data/lib/vagrant-openstack-plugin/action/message_will_not_destroy.rb +16 -0
- data/lib/vagrant-openstack-plugin/action/pause_server.rb +3 -1
- data/lib/vagrant-openstack-plugin/action/read_state.rb +8 -8
- data/lib/vagrant-openstack-plugin/action/{unpause_server.rb → reboot_server.rb} +7 -5
- data/lib/vagrant-openstack-plugin/action/resume_server.rb +7 -1
- data/lib/vagrant-openstack-plugin/action/suspend_server.rb +3 -1
- data/lib/vagrant-openstack-plugin/action/sync_folders.rb +7 -5
- data/lib/vagrant-openstack-plugin/action/wait_for_state.rb +39 -0
- data/lib/vagrant-openstack-plugin/action.rb +133 -31
- data/lib/vagrant-openstack-plugin/version.rb +1 -1
- data/locales/en.yml +19 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b57c6221fd8bcfe94b1be1c952742f10224fc55
|
4
|
+
data.tar.gz: 6f65f3af923abc32f53ec5d22015cc5cf2fec267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13e6a3c80a50ac260f0f2bcbae43c58f9349f5f3533f7ca62dbe7f7bb58d3d9d5212dda6a56741f5feb9704cc4869cc08dff4f27ac4420fcff423a4ab76dae80
|
7
|
+
data.tar.gz: 3c2bb0c482457bc42836d5f0ae4615e74f1169513d2743d7bace39d471a2b485f3ea38a972a82137fa06282d0505cef572b0987d83c20cc50343d691da68f867
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog for vagrant-openstack-plugin
|
2
2
|
|
3
|
+
## 0.7.0
|
4
|
+
|
5
|
+
- Merge pull request #35 from johnbellone/master [view commit](http://github.com///commit/5969261f11585e19348e903eec15617634c3c899)
|
6
|
+
- Fix issues with SSH private keys in Vagrant 1.4. [view commit](http://github.com///commit/a8bf7574de48dc1c62928f5ad73fb6d1e7dd4347)
|
7
|
+
- Refactor OpenStack actions to match AWS. [view commit](http://github.com///commit/c7177dc98ba43e3434075186a76df57d27ce7b26)
|
8
|
+
|
3
9
|
## 0.6.1
|
4
10
|
|
5
11
|
- Merge pull request #60 from matope/fix-floating_ip-NoMethodError [view commit](http://github.com///commit/a058256c27573c7545afbc09cce60214731e6e4e)
|
@@ -120,7 +120,7 @@ module VagrantPlugins
|
|
120
120
|
# If we don't have an error about a state transition, then
|
121
121
|
# we just move on.
|
122
122
|
raise if e.message !~ /should have transitioned/
|
123
|
-
raise Errors::CreateBadState, :state => server.state
|
123
|
+
raise Errors::CreateBadState, :state => server.state.downcase
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -16,6 +16,8 @@ module VagrantPlugins
|
|
16
16
|
|
17
17
|
if id
|
18
18
|
env[:ui].info(I18n.t("vagrant_openstack.deleting_server"))
|
19
|
+
|
20
|
+
# TODO: Validate the fact that we get a server back from the API.
|
19
21
|
server = env[:openstack_compute].servers.get(id)
|
20
22
|
server.destroy
|
21
23
|
env[:machine].id = nil
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module OpenStack
|
5
|
+
module Action
|
6
|
+
# This hard reboots a running server, if there is one.
|
7
|
+
class HardRebootServer
|
8
|
+
def initialize(app, env)
|
9
|
+
@app = app
|
10
|
+
@logger = Log4r::Logger.new("vagrant_openstack::action::hard_reboot_server")
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
if env[:machine].id
|
15
|
+
env[:ui].info(I18n.t("vagrant_openstack.hard_rebooting_server"))
|
16
|
+
|
17
|
+
# TODO: Validate the fact that we get a server back from the API.
|
18
|
+
server = env[:openstack_compute].servers.get(env[:machine].id)
|
19
|
+
server.reboot('HARD')
|
20
|
+
end
|
21
|
+
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module OpenStack
|
3
|
+
module Action
|
4
|
+
class MessageAlreadyPaused
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env[:ui].info(I18n.t("vagrant_openstack.already_paused"))
|
11
|
+
@app.call(env)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module OpenStack
|
3
|
+
module Action
|
4
|
+
class MessageAlreadySuspended
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env[:ui].info(I18n.t("vagrant_openstack.already_suspended"))
|
11
|
+
@app.call(env)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module OpenStack
|
3
|
+
module Action
|
4
|
+
class MessageServerRunning
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env[:ui].info(I18n.t("vagrant_openstack.server_running", name: env[:machine].name))
|
11
|
+
@app.call(env)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module OpenStack
|
3
|
+
module Action
|
4
|
+
class MessageWillNotDestroy
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env[:ui].info(I18n.t("vagrant_openstack.will_not_destroy", name: env[:machine].name))
|
11
|
+
@app.call(env)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -13,8 +13,10 @@ module VagrantPlugins
|
|
13
13
|
def call(env)
|
14
14
|
if env[:machine].id
|
15
15
|
env[:ui].info(I18n.t("vagrant_openstack.pausing_server"))
|
16
|
+
|
17
|
+
# TODO: Validate the fact that we get a server back from the API.
|
16
18
|
server = env[:openstack_compute].servers.get(env[:machine].id)
|
17
|
-
server.
|
19
|
+
env[:openstack_compute].pause_server(server.id)
|
18
20
|
end
|
19
21
|
|
20
22
|
@app.call(env)
|
@@ -6,6 +6,8 @@ module VagrantPlugins
|
|
6
6
|
# This action reads the state of the machine and puts it in the
|
7
7
|
# `:machine_state_id` key in the environment.
|
8
8
|
class ReadState
|
9
|
+
NOT_CREATED_STATES = [:deleted, :soft_deleted, :building, :error].freeze
|
10
|
+
|
9
11
|
def initialize(app, env)
|
10
12
|
@app = app
|
11
13
|
@logger = Log4r::Logger.new("vagrant_openstack::action::read_state")
|
@@ -13,7 +15,6 @@ module VagrantPlugins
|
|
13
15
|
|
14
16
|
def call(env)
|
15
17
|
env[:machine_state_id] = read_state(env[:openstack_compute], env[:machine])
|
16
|
-
|
17
18
|
@app.call(env)
|
18
19
|
end
|
19
20
|
|
@@ -21,18 +22,17 @@ module VagrantPlugins
|
|
21
22
|
id = machine.id || openstack.servers.all( :name => machine.name ).first.id rescue nil
|
22
23
|
return :not_created if id.nil?
|
23
24
|
|
24
|
-
# Find the machine
|
25
|
-
server = openstack.servers.get(id)
|
26
|
-
if server.nil? || server.state
|
27
|
-
|
28
|
-
@logger.info("Machine not found or deleted, assuming it got destroyed.")
|
25
|
+
# Find the machine using the OpenStack API.
|
26
|
+
server = openstack.servers.get(machine.id)
|
27
|
+
if server.nil? || NOT_CREATED_STATES.include?(server.state.downcase.to_sym)
|
28
|
+
@logger.info(I18n.t("vagrant_openstack.not_created"))
|
29
29
|
machine.id = nil
|
30
30
|
return :not_created
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
return server.state.downcase.to_sym
|
33
|
+
server.state.downcase.to_sym
|
35
34
|
end
|
35
|
+
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -3,18 +3,20 @@ require "log4r"
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module OpenStack
|
5
5
|
module Action
|
6
|
-
# This
|
7
|
-
class
|
6
|
+
# This reboots a running server, if there is one.
|
7
|
+
class RebootServer
|
8
8
|
def initialize(app, env)
|
9
9
|
@app = app
|
10
|
-
@logger = Log4r::Logger.new("vagrant_openstack::action::
|
10
|
+
@logger = Log4r::Logger.new("vagrant_openstack::action::reboot_server")
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(env)
|
14
14
|
if env[:machine].id
|
15
|
-
env[:ui].info(I18n.t("vagrant_openstack.
|
15
|
+
env[:ui].info(I18n.t("vagrant_openstack.rebooting_server"))
|
16
|
+
|
17
|
+
# TODO: Validate the fact that we get a server back from the API.
|
16
18
|
server = env[:openstack_compute].servers.get(env[:machine].id)
|
17
|
-
server.
|
19
|
+
server.reboot('SOFT')
|
18
20
|
end
|
19
21
|
|
20
22
|
@app.call(env)
|
@@ -13,8 +13,14 @@ module VagrantPlugins
|
|
13
13
|
def call(env)
|
14
14
|
if env[:machine].id
|
15
15
|
env[:ui].info(I18n.t("vagrant_openstack.resuming_server"))
|
16
|
+
|
17
|
+
# TODO: Validate the fact that we get a server back from the API.
|
16
18
|
server = env[:openstack_compute].servers.get(env[:machine].id)
|
17
|
-
server.
|
19
|
+
if server.state == 'PAUSED'
|
20
|
+
env[:openstack_compute].unpause_server(server.id)
|
21
|
+
elsif server.state == 'SUSPENDED'
|
22
|
+
env[:openstack_compute].resume_server(server.id)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
@app.call(env)
|
@@ -13,8 +13,10 @@ module VagrantPlugins
|
|
13
13
|
def call(env)
|
14
14
|
if env[:machine].id
|
15
15
|
env[:ui].info(I18n.t("vagrant_openstack.suspending_server"))
|
16
|
+
|
17
|
+
# TODO: Validate the fact that we get a server back from the API.
|
16
18
|
server = env[:openstack_compute].servers.get(env[:machine].id)
|
17
|
-
server.
|
19
|
+
env[:openstack_compute].suspend_server(server.id)
|
18
20
|
end
|
19
21
|
|
20
22
|
@app.call(env)
|
@@ -19,7 +19,6 @@ module VagrantPlugins
|
|
19
19
|
ssh_info = env[:machine].ssh_info
|
20
20
|
|
21
21
|
env[:machine].config.vm.synced_folders.each do |id, data|
|
22
|
-
|
23
22
|
# ignore disabled shared folders
|
24
23
|
if data[:disabled]
|
25
24
|
@logger.info "Not syncing disabled folder: #{data[:hostpath]} => #{data[:guestpath]}"
|
@@ -42,6 +41,9 @@ module VagrantPlugins
|
|
42
41
|
env[:machine].communicate.sudo(
|
43
42
|
"chown #{ssh_info[:username]} '#{guestpath}'")
|
44
43
|
|
44
|
+
#collect rsync excludes specified :rsync_excludes=>['path1',...] in synced_folder options
|
45
|
+
excludes = ['.vagrant/', 'Vagrantfile', *Array(data[:rsync_excludes])].uniq
|
46
|
+
|
45
47
|
# Rsync over to the guest path using the SSH info
|
46
48
|
if env[:machine].config.ssh.proxy_command
|
47
49
|
proxy_cmd = "-o ProxyCommand='#{env[:machine].config.ssh.proxy_command}'"
|
@@ -57,9 +59,9 @@ module VagrantPlugins
|
|
57
59
|
end
|
58
60
|
|
59
61
|
command = [
|
60
|
-
|
61
|
-
|
62
|
-
|
62
|
+
'rsync', '--verbose', '--archive', '-z', '--delete',
|
63
|
+
*excludes.map{|e|['--exclude', e]}.flatten,
|
64
|
+
'-e', "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no #{proxy_cmd} #{ssh_key_options(ssh_info)}",
|
63
65
|
hostpath,
|
64
66
|
user_at_host + ":" + guestpath]
|
65
67
|
|
@@ -77,7 +79,7 @@ module VagrantPlugins
|
|
77
79
|
|
78
80
|
def ssh_key_options(ssh_info)
|
79
81
|
# Ensure that `private_key_path` is an Array (for Vagrant < 1.4)
|
80
|
-
Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}'
|
82
|
+
Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}'" }.join
|
81
83
|
end
|
82
84
|
end
|
83
85
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'log4r'
|
3
|
+
require 'timeout'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module OpenStack
|
7
|
+
module Action
|
8
|
+
# This action will wait for a machine to reach a specific state or quit by timeout.
|
9
|
+
class WaitForState
|
10
|
+
def initialize(app, env, state, timeout)
|
11
|
+
@app = app
|
12
|
+
@logger = Log4r::Logger.new('vagrant_openstack::action::wait_for_state')
|
13
|
+
@state = Array.new(state).flatten
|
14
|
+
@timeout = timeout
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(env)
|
18
|
+
env[:result] = true
|
19
|
+
state = env[:machine].state.id.to_sym
|
20
|
+
|
21
|
+
if @state.include?(state)
|
22
|
+
@logger.info("Machine already at status #{ state.to_s }")
|
23
|
+
else
|
24
|
+
@logger.info("Waiting for machine to reach state...")
|
25
|
+
begin
|
26
|
+
Timeout.timeout(@timeout) do
|
27
|
+
sleep 2 until @state.include?(env[:machine].state.id)
|
28
|
+
end
|
29
|
+
rescue Timeout::Error
|
30
|
+
env[:result] = false
|
31
|
+
end
|
32
|
+
|
33
|
+
@app.call(env)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -8,18 +8,17 @@ module VagrantPlugins
|
|
8
8
|
# Include the built-in modules so we can use them as top-level things.
|
9
9
|
include Vagrant::Action::Builtin
|
10
10
|
|
11
|
-
# This action is called
|
11
|
+
# This action is called when `vagrant destroy` is executed.
|
12
12
|
def self.action_destroy
|
13
13
|
Vagrant::Action::Builder.new.tap do |b|
|
14
14
|
b.use ConfigValidate
|
15
|
-
b.use Call,
|
16
|
-
if
|
17
|
-
|
18
|
-
|
15
|
+
b.use Call, DestroyConfirm do |env, b1|
|
16
|
+
if env[:result]
|
17
|
+
b1.use ConnectOpenStack
|
18
|
+
b1.use DeleteServer
|
19
|
+
else
|
20
|
+
b1.use MessageWillNotDestroy
|
19
21
|
end
|
20
|
-
|
21
|
-
b2.use ConnectOpenStack
|
22
|
-
b2.use DeleteServer
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
@@ -46,16 +45,17 @@ module VagrantPlugins
|
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
48
|
+
# This action is called when `vagrant ssh` is executed.
|
49
49
|
def self.action_ssh
|
50
50
|
Vagrant::Action::Builder.new.tap do |b|
|
51
51
|
b.use ConfigValidate
|
52
|
-
b.use Call, IsCreated do |env,
|
53
|
-
|
54
|
-
|
52
|
+
b.use Call, IsCreated do |env, b1|
|
53
|
+
unless env[:result]
|
54
|
+
b1.use MessageNotCreated
|
55
55
|
next
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
b1.use SSHExec
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -63,48 +63,137 @@ module VagrantPlugins
|
|
63
63
|
def self.action_ssh_run
|
64
64
|
Vagrant::Action::Builder.new.tap do |b|
|
65
65
|
b.use ConfigValidate
|
66
|
-
b.use Call, IsCreated do |env,
|
67
|
-
|
68
|
-
|
66
|
+
b.use Call, IsCreated do |env, b1|
|
67
|
+
unless env[:result]
|
68
|
+
b1.use MessageNotCreated
|
69
69
|
next
|
70
70
|
end
|
71
71
|
|
72
|
-
|
72
|
+
b1.use SSHRun
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
def self.action_prepare_boot
|
78
|
+
Vagrant::Action::Builder.new.tap do |b|
|
79
|
+
b.use Provision
|
80
|
+
b.use SyncFolders
|
81
|
+
b.use WarnNetworks
|
82
|
+
b.use SetHostname
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# This action is called when `vagrant up` is executed.
|
77
87
|
def self.action_up
|
78
88
|
Vagrant::Action::Builder.new.tap do |b|
|
79
89
|
b.use HandleBoxUrl
|
80
90
|
b.use ConfigValidate
|
81
|
-
b.use Call, IsCreated do |env,
|
82
|
-
|
83
|
-
|
91
|
+
b.use Call, IsCreated do |env, b1|
|
92
|
+
unless env[:result]
|
93
|
+
b1.use action_prepare_boot
|
94
|
+
b1.use ConnectOpenStack
|
95
|
+
b1.use CreateServer
|
96
|
+
else
|
97
|
+
b1.use action_resume
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# This action is called when `vagrant provision` is executed.
|
104
|
+
def self.action_provision
|
105
|
+
Vagrant::Action::Builder.new.tap do |b|
|
106
|
+
b.use ConfigValidate
|
107
|
+
b.use Call, IsCreated do |env, b1|
|
108
|
+
unless env[:result]
|
109
|
+
b1.use MessageNotCreated
|
84
110
|
next
|
85
111
|
end
|
86
112
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
b2.use SetHostname
|
91
|
-
b2.use WarnNetworks
|
92
|
-
b2.use CreateServer
|
113
|
+
b1.use ConnectOpenStack
|
114
|
+
b1.use Provision
|
115
|
+
b1.use SyncFolders
|
93
116
|
end
|
94
117
|
end
|
95
118
|
end
|
96
119
|
|
97
|
-
|
120
|
+
# This action is called when `vagrant reload` is executed.
|
121
|
+
def self.action_reload
|
122
|
+
Vagrant::Action::Builder.new.tap do |b|
|
123
|
+
b.use ConfigValidate
|
124
|
+
b.use ConnectOpenStack
|
125
|
+
b.use Call, IsPaused do |env, b1|
|
126
|
+
unless env[:result]
|
127
|
+
b1.use Call, IsSuspended do |env2, b2|
|
128
|
+
b1.use action_halt unless env2[:result]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
b1.use Call, WaitForState, [:paused, :suspended], 120 do |env2, b2|
|
133
|
+
if env2[:result]
|
134
|
+
b2.use action_up
|
135
|
+
else
|
136
|
+
b2.use HardRebootServer
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# This action is called when `vagrant halt` is executed.
|
144
|
+
def self.action_halt
|
145
|
+
Vagrant::Action::Builder.new.tap do |b|
|
146
|
+
b.use ConfigValidate
|
147
|
+
b.use Call, IsCreated do |env, b1|
|
148
|
+
unless env[:result]
|
149
|
+
b1.use Call, IsSuspended do |env2, b2|
|
150
|
+
if env2[:result]
|
151
|
+
b1.use MessageAlreadySuspended
|
152
|
+
next
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
b1.use ConnectOpenStack
|
158
|
+
b1.use PauseServer
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# This action is called when `vagrant resume` is executed.
|
164
|
+
def self.action_resume
|
98
165
|
Vagrant::Action::Builder.new.tap do |b|
|
99
166
|
b.use ConfigValidate
|
100
|
-
b.use Call, IsCreated do |env,
|
101
|
-
if
|
102
|
-
|
167
|
+
b.use Call, IsCreated do |env, b1|
|
168
|
+
if env[:result]
|
169
|
+
b1.use MessageServerRunning
|
103
170
|
next
|
104
171
|
end
|
105
172
|
|
106
|
-
|
107
|
-
|
173
|
+
b1.use ConnectOpenStack
|
174
|
+
b1.use ResumeServer
|
175
|
+
b1.use SyncFolders
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# This action is called when `vagrant suspend` is executed.
|
181
|
+
def self.action_suspend
|
182
|
+
Vagrant::Action::Builder.new.tap do |b|
|
183
|
+
b.use ConfigValidate
|
184
|
+
b.use Call, IsCreated do |env, b1|
|
185
|
+
if env[:result]
|
186
|
+
b1.use ConnectOpenStack
|
187
|
+
b1.use SuspendServer
|
188
|
+
else
|
189
|
+
b1.use Call, IsPaused do |env2, b2|
|
190
|
+
if env2[:result]
|
191
|
+
b2.use MessageAlreadyPaused
|
192
|
+
else
|
193
|
+
b2.use MessageAlreadySuspended
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
108
197
|
end
|
109
198
|
end
|
110
199
|
end
|
@@ -114,12 +203,25 @@ module VagrantPlugins
|
|
114
203
|
autoload :ConnectOpenStack, action_root.join("connect_openstack")
|
115
204
|
autoload :CreateServer, action_root.join("create_server")
|
116
205
|
autoload :DeleteServer, action_root.join("delete_server")
|
206
|
+
autoload :HardRebootServer, action_root.join("hard_reboot_server")
|
117
207
|
autoload :IsCreated, action_root.join("is_created")
|
208
|
+
autoload :IsPaused, action_root.join("is_paused")
|
209
|
+
autoload :IsSuspended, action_root.join("is_suspended")
|
118
210
|
autoload :MessageAlreadyCreated, action_root.join("message_already_created")
|
211
|
+
autoload :MessageAlreadyPaused, action_root.join("message_already_paused")
|
212
|
+
autoload :MessageAlreadySuspended, action_root.join("message_already_suspended")
|
119
213
|
autoload :MessageNotCreated, action_root.join("message_not_created")
|
214
|
+
autoload :MessageNotSuspended, action_root.join("message_not_suspended")
|
215
|
+
autoload :MessageWillNotDestroy, action_root.join("message_will_not_destroy")
|
216
|
+
autoload :MessageServerRunning, action_root.join("message_server_running")
|
217
|
+
autoload :PauseServer, action_root.join("pause_server")
|
120
218
|
autoload :ReadSSHInfo, action_root.join("read_ssh_info")
|
121
219
|
autoload :ReadState, action_root.join("read_state")
|
220
|
+
autoload :RebootServer, action_root.join("reboot_server")
|
221
|
+
autoload :ResumeServer, action_root.join("resume_server")
|
222
|
+
autoload :SuspendServer, action_root.join("suspend_server")
|
122
223
|
autoload :SyncFolders, action_root.join("sync_folders")
|
224
|
+
autoload :WaitForState, action_root.join("wait_for_state")
|
123
225
|
autoload :WarnNetworks, action_root.join("warn_networks")
|
124
226
|
end
|
125
227
|
end
|
data/locales/en.yml
CHANGED
@@ -2,6 +2,10 @@ en:
|
|
2
2
|
vagrant_openstack:
|
3
3
|
already_created: |-
|
4
4
|
The server is already created.
|
5
|
+
already_paused: |-
|
6
|
+
The server is already paused.
|
7
|
+
already_suspended: |-
|
8
|
+
The server is already suspended.
|
5
9
|
deleting_server: |-
|
6
10
|
Deleting server...
|
7
11
|
finding_flavor: |-
|
@@ -10,14 +14,26 @@ en:
|
|
10
14
|
Finding image for server...
|
11
15
|
finding_network: |-
|
12
16
|
Finding network for server...
|
17
|
+
hard_rebooting_server: |-
|
18
|
+
Hard rebooting server instance.
|
13
19
|
launching_server: |-
|
14
20
|
Launching a server with the following settings...
|
15
21
|
not_created: |-
|
16
22
|
The server hasn't been created yet. Run `vagrant up` first.
|
23
|
+
pausing_server: |-
|
24
|
+
The server instance has been paused.
|
17
25
|
ready: |-
|
18
26
|
The server is ready!
|
27
|
+
rebooting_server: |-
|
28
|
+
This server instance is rebooting!
|
29
|
+
resuming_server: |-
|
30
|
+
The server instance has been resumed.
|
19
31
|
rsync_folder: |-
|
20
32
|
Rsyncing folder: %{hostpath} => %{guestpath}
|
33
|
+
server_running: |-
|
34
|
+
The instance '%{name}' is already running!
|
35
|
+
suspending_server: |-
|
36
|
+
The server instance has been suspended!
|
21
37
|
waiting_for_build: |-
|
22
38
|
Waiting for the server to be built...
|
23
39
|
waiting_for_ssh: |-
|
@@ -26,6 +42,9 @@ en:
|
|
26
42
|
Warning! The OpenStack provider doesn't support any of the Vagrant
|
27
43
|
high-level network configurations (`config.vm.network`). They
|
28
44
|
will be silently ignored.
|
45
|
+
will_not_destroy: |-
|
46
|
+
The instance '%{name}' will not be destroyed, since the confirmation
|
47
|
+
was declined.
|
29
48
|
|
30
49
|
config:
|
31
50
|
api_key_required: |-
|
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.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edmund Haselwanter
|
@@ -75,16 +75,24 @@ files:
|
|
75
75
|
- lib/vagrant-openstack-plugin/action/connect_openstack.rb
|
76
76
|
- lib/vagrant-openstack-plugin/action/create_server.rb
|
77
77
|
- lib/vagrant-openstack-plugin/action/delete_server.rb
|
78
|
+
- lib/vagrant-openstack-plugin/action/hard_reboot_server.rb
|
78
79
|
- lib/vagrant-openstack-plugin/action/is_created.rb
|
80
|
+
- lib/vagrant-openstack-plugin/action/is_paused.rb
|
81
|
+
- lib/vagrant-openstack-plugin/action/is_suspended.rb
|
79
82
|
- lib/vagrant-openstack-plugin/action/message_already_created.rb
|
83
|
+
- lib/vagrant-openstack-plugin/action/message_already_paused.rb
|
84
|
+
- lib/vagrant-openstack-plugin/action/message_already_suspended.rb
|
80
85
|
- lib/vagrant-openstack-plugin/action/message_not_created.rb
|
86
|
+
- lib/vagrant-openstack-plugin/action/message_server_running.rb
|
87
|
+
- lib/vagrant-openstack-plugin/action/message_will_not_destroy.rb
|
81
88
|
- lib/vagrant-openstack-plugin/action/pause_server.rb
|
82
89
|
- lib/vagrant-openstack-plugin/action/read_ssh_info.rb
|
83
90
|
- lib/vagrant-openstack-plugin/action/read_state.rb
|
91
|
+
- lib/vagrant-openstack-plugin/action/reboot_server.rb
|
84
92
|
- lib/vagrant-openstack-plugin/action/resume_server.rb
|
85
93
|
- lib/vagrant-openstack-plugin/action/suspend_server.rb
|
86
94
|
- lib/vagrant-openstack-plugin/action/sync_folders.rb
|
87
|
-
- lib/vagrant-openstack-plugin/action/
|
95
|
+
- lib/vagrant-openstack-plugin/action/wait_for_state.rb
|
88
96
|
- lib/vagrant-openstack-plugin/action/warn_networks.rb
|
89
97
|
- lib/vagrant-openstack-plugin/config.rb
|
90
98
|
- lib/vagrant-openstack-plugin/errors.rb
|