vagrant-windows-domain 1.1.4 → 1.1.5

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: 9a9722d26377397c2efd60e06c72d24755e8aa95
4
- data.tar.gz: 71725b27ec40f96f3aa28ae903dba5b2bf471751
3
+ metadata.gz: e30bd4addda05305cd59a0e120c3790b20d5c2f5
4
+ data.tar.gz: 2f5d4a1ff6e0a6fd34dc3f518e75fba516520220
5
5
  SHA512:
6
- metadata.gz: a76d24b22c36baebaa69bc5e4ff8334104adf42f0d08cb9ab6740249885429251f3527e1f268b4cc8a7a1bbc25beb9a33f953383d9882ea5bd808cfbef2f730e
7
- data.tar.gz: b299cec8a1a0182a0a76109574694cf93074d25c192ba77524f3b39611bdef0dbbc732d3a79f6a66da3804cc4f13ce03b7b566a87e37e01fab57a6b3d4eaa06e
6
+ metadata.gz: bdcca197a09d606352a9431c7dc65963bff2909cf23486213460a55a4879f13c4b08e72d25a72a8291fe04f0e37b7f1f122027124f7cdb3b1ec091a6831fcd4d
7
+ data.tar.gz: cd78c6f6c8fd24b7bd16c8aed4973a653592fc13b79070996ad0c48fee2367bab593dce7bf5e1b78229fea357a4e564528397dde69415b6420d0507aaaad964d
@@ -7,17 +7,28 @@ module VagrantPlugins
7
7
  include VagrantPlugins::WindowsDomain
8
8
 
9
9
  def initialize(app, env)
10
+ logger.debug("Initialising WindowsDomain plugin on destroy action")
10
11
  @app = app
11
12
  @machine = env[:machine]
12
- @config = env[:machine].config.windows_domain
13
+ @logger = Log4r::Logger.new("vagrant::provisioners::vagrant_windows_domain")
14
+
15
+ @machine.config.vm.provisioners.each do |prov|
16
+ @config = prov.config if prov.config.is_a?(VagrantPlugins::WindowsDomain::Config)
17
+ end
18
+
13
19
  @provisioner = VagrantPlugins::WindowsDomain::Provisioner.new(@machine, @config)
14
20
  end
15
21
 
16
22
  def call(env)
17
- @provisioner.destroy
18
- @app.call(env)
23
+ if @config
24
+ logger.debug("Configuration detected, triggering leave domain action")
25
+ @provisioner.destroy
26
+ @app.call(env)
27
+ else
28
+ logger.debug("No configuration detected, not leaving any domain")
29
+ end
19
30
  end
20
31
 
21
32
  end
22
33
  end
23
- end
34
+ end
@@ -45,10 +45,6 @@ module VagrantPlugins
45
45
  # When this option is used username/password are not required
46
46
  attr_accessor :unsecure
47
47
 
48
- # Internal id for use with detecting whether or not this
49
- # plugin should be run in the `destroy` or phase.
50
- attr_accessor :id
51
-
52
48
  def initialize
53
49
  super
54
50
  @domain = UNSET_VALUE
@@ -87,9 +83,6 @@ module VagrantPlugins
87
83
  def validate(machine)
88
84
  errors = _detected_errors
89
85
 
90
- # Store machine id for unique reference
91
- @id = machine.id
92
-
93
86
  # Need to supply one of them!
94
87
  if ( (@username != nil && @password != nil) && @unsecure == true)
95
88
  errors << I18n.t("vagrant_windows_domain.errors.both_credentials_provided")
@@ -103,12 +103,13 @@ module VagrantPlugins
103
103
  # for any state related to the machine created by the provisioner
104
104
  # to be cleaned up.
105
105
  def destroy
106
- if !@machine.id || !@machine.config.windows_domain.id
107
- @machine.env.ui.say "No machine id, nothing for 'windows-domain-provisioner' to do"
106
+ if @config && @config.include?("domain")
107
+ set_credentials
108
+ leave_domain
109
+ else
110
+ @logger.debug("Not leaving domain on `destroy` action - no valid configuration detected")
108
111
  return
109
112
  end
110
- set_credentials
111
- leave_domain
112
113
  end
113
114
 
114
115
  # Restarts the Computer and waits
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module WindowsDomain
3
- VERSION = "1.1.4"
3
+ VERSION = "1.1.5"
4
4
  end
5
5
  end
@@ -76,13 +76,6 @@ describe VagrantPlugins::WindowsDomain::Config do
76
76
  assert_invalid
77
77
  assert_error("You must not supply a \"username\" and \"password\" if \"unsecure\" is set to true.")
78
78
  end
79
-
80
- it "should populate the id with the unique machine id" do
81
- subject.validate(machine)
82
-
83
- expect(subject.id).to eq("1234")
84
- end
85
-
86
79
  end
87
80
 
88
81
  end
@@ -187,10 +187,8 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
187
187
  it "should not leave domain plugin not associated with current Vagrantfile" do
188
188
  allow(machine).to receive(:communicate).and_return(communicator)
189
189
 
190
- root_config.username = nil
191
- root_config.password = nil
192
- root_config.id = nil
193
- expect(ui).to receive(:say).with("No machine id, nothing for 'windows-domain-provisioner' to do")
190
+ subject = described_class.new machine, []
191
+
194
192
  expect(ui).to_not receive(:ask)
195
193
  expect(subject.destroy).to eq(nil)
196
194
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-windows-domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Fellows