vagrant-windows-domain 1.1.4 → 1.1.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/lib/vagrant-windows-domain/action/leave_domain.rb +15 -4
- data/lib/vagrant-windows-domain/config.rb +0 -7
- data/lib/vagrant-windows-domain/provisioner.rb +5 -4
- data/lib/vagrant-windows-domain/version.rb +1 -1
- data/spec/provisioner/config_spec.rb +0 -7
- data/spec/provisioner/provisioner_spec.rb +2 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e30bd4addda05305cd59a0e120c3790b20d5c2f5
|
4
|
+
data.tar.gz: 2f5d4a1ff6e0a6fd34dc3f518e75fba516520220
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
@
|
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
|
-
@
|
18
|
-
|
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
|
107
|
-
|
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
|
@@ -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
|
-
|
191
|
-
|
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
|