vagrant-destroy-provisioner 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0ddfe3d7f244d5cd7a6928817795383fe56b512
4
- data.tar.gz: 2ecf5064800caa9d034ec01e04403bff9aaace5c
3
+ metadata.gz: d13d6e59eda92046028e488daa9fdf96681ea454
4
+ data.tar.gz: 91747d59ff55061e76b72425de051cfdb0df299a
5
5
  SHA512:
6
- metadata.gz: 82516d726e05e3dc7639d2f381209a0b978a001992b366477e345826fa3a28dd4f9ae2e03970f8d1cab51fc5f302e1dc8fe6228f57c0cab5ce99e24924c4e369
7
- data.tar.gz: 82e97382ae5fd5abb19dd499058aace6f24764b8525726fb944c57e0887a6481d60963335e9720bdecf4b9749436396a2dd88376d38963846f6b93fac7a7f095
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 :destroy
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
@@ -1,7 +1,7 @@
1
1
  module Vagrant
2
2
  module Destroy
3
3
  module Provisioner
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  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.1
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-13 00:00:00.000000000 Z
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: ''