vagrant-destroy-provisioner 0.0.1 → 0.0.2
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/README.md +7 -1
- data/lib/vagrant-destroy-provisioner.rb +1 -39
- data/lib/vagrant-destroy-provisioner/config.rb +22 -0
- data/lib/vagrant-destroy-provisioner/plugin.rb +23 -0
- data/lib/vagrant-destroy-provisioner/provisioner.rb +25 -0
- data/lib/vagrant-destroy-provisioner/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d13d6e59eda92046028e488daa9fdf96681ea454
|
4
|
+
data.tar.gz: 91747d59ff55061e76b72425de051cfdb0df299a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3975730faf1c2bf6b69011314c8b5a9615d6b0a21268aae823b075ac3b58e20d31baf6ff1df1e43f74d15ce95fc458051d60a40b5d7d96085fd286766a594a17
|
7
|
+
data.tar.gz: 403a64c4b6ad8603045cd362a7f742b30a11c4b42f41aed5e2310e511f10a86eb8e7281e827da73cdcfb592e11a91ba9451281105bb9c1d1ec223ce42e998d15
|
data/README.md
CHANGED
@@ -8,7 +8,13 @@ vagrant-destroy-provisioner allows a VM to be destroyed as a provisioning step.
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
config.vm.provision :
|
11
|
+
config.vm.provision "destroy", destroy: true
|
12
|
+
|
13
|
+
## Option
|
14
|
+
|
15
|
+
- destroy: true/false
|
16
|
+
|
17
|
+
Destroy VM if true, otherwise only halt is executed. Default is true.
|
12
18
|
|
13
19
|
## Contributing
|
14
20
|
|
@@ -1,40 +1,2 @@
|
|
1
|
-
|
2
|
-
module VagrantPlugins
|
3
|
-
module Destroy
|
4
|
-
class Plugin < Vagrant.plugin("2")
|
5
|
-
|
6
|
-
name "Destroy"
|
7
|
-
description <<-DESC
|
8
|
-
vagrant-destroy-provisioner allows a VM to be destroyed as a provisioning step.
|
9
|
-
DESC
|
10
|
-
|
11
|
-
provisioner "destroy" do
|
12
|
-
class Provisioner < Vagrant.plugin("2", :provisioner)
|
13
|
-
|
14
|
-
def initialize(machine, config)
|
15
|
-
super
|
16
|
-
end
|
17
|
-
|
18
|
-
def configure(root_config)
|
19
|
-
end
|
20
|
-
|
21
|
-
def provision
|
22
|
-
options = {}
|
23
|
-
options[:force_confirm_destroy] = true
|
24
|
-
@machine.action(:destroy, options)
|
25
|
-
begin
|
26
|
-
sleep 2
|
27
|
-
end while @machine.communicate.ready?
|
28
|
-
end
|
29
|
-
|
30
|
-
def cleanup
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
Provisioner
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
1
|
+
require_relative 'vagrant-destroy-provisioner/plugin'
|
40
2
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Destroy
|
3
|
+
class Config < Vagrant.plugin("2", :config)
|
4
|
+
attr_accessor :destroy
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@destroy = UNSET_VALUE
|
8
|
+
end
|
9
|
+
|
10
|
+
def finalize!
|
11
|
+
@destroy = true if @destroy == UNSET_VALUE
|
12
|
+
end
|
13
|
+
|
14
|
+
def validate(machine)
|
15
|
+
errors = _detected_errors
|
16
|
+
{ "destroy provisioner" => errors }
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module Destroy
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
name "Destroy Provisoner"
|
7
|
+
description <<-DESC
|
8
|
+
vagrant-destroy-provisioner allows a VM to be destroyed as a provisioning step.
|
9
|
+
DESC
|
10
|
+
|
11
|
+
config(:destroy, :provisioner) do
|
12
|
+
require_relative 'config'
|
13
|
+
Config
|
14
|
+
end
|
15
|
+
|
16
|
+
provisioner(:destroy) do
|
17
|
+
require_relative 'provisioner'
|
18
|
+
Provisioner
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Destroy
|
3
|
+
class Provisioner < Vagrant.plugin("2", :provisioner)
|
4
|
+
def initialize(machine, config)
|
5
|
+
super
|
6
|
+
@logger = Log4r::Logger.new("vagrant::provisioners::destroy")
|
7
|
+
end
|
8
|
+
|
9
|
+
def provision
|
10
|
+
options = {}
|
11
|
+
if config.destroy
|
12
|
+
options[:force_confirm_destroy] = true
|
13
|
+
@logger.info("VM is going to destroy");
|
14
|
+
@machine.action(:destroy, options)
|
15
|
+
else
|
16
|
+
@logger.info("VM is going to halt");
|
17
|
+
@machine.action(:halt, options)
|
18
|
+
end
|
19
|
+
begin
|
20
|
+
sleep 2
|
21
|
+
end while @machine.communicate.ready?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-destroy-provisioner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Nagano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,9 @@ files:
|
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
54
|
- lib/vagrant-destroy-provisioner.rb
|
55
|
+
- lib/vagrant-destroy-provisioner/config.rb
|
56
|
+
- lib/vagrant-destroy-provisioner/plugin.rb
|
57
|
+
- lib/vagrant-destroy-provisioner/provisioner.rb
|
55
58
|
- lib/vagrant-destroy-provisioner/version.rb
|
56
59
|
- vagrant-destroy-provisioner.gemspec
|
57
60
|
homepage: ''
|