vagrant-windows-domain 1.1.3 → 1.1.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a9722d26377397c2efd60e06c72d24755e8aa95
|
4
|
+
data.tar.gz: 71725b27ec40f96f3aa28ae903dba5b2bf471751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a76d24b22c36baebaa69bc5e4ff8334104adf42f0d08cb9ab6740249885429251f3527e1f268b4cc8a7a1bbc25beb9a33f953383d9882ea5bd808cfbef2f730e
|
7
|
+
data.tar.gz: b299cec8a1a0182a0a76109574694cf93074d25c192ba77524f3b39611bdef0dbbc732d3a79f6a66da3804cc4f13ce03b7b566a87e37e01fab57a6b3d4eaa06e
|
@@ -45,6 +45,10 @@ 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
|
+
|
48
52
|
def initialize
|
49
53
|
super
|
50
54
|
@domain = UNSET_VALUE
|
@@ -83,6 +87,9 @@ module VagrantPlugins
|
|
83
87
|
def validate(machine)
|
84
88
|
errors = _detected_errors
|
85
89
|
|
90
|
+
# Store machine id for unique reference
|
91
|
+
@id = machine.id
|
92
|
+
|
86
93
|
# Need to supply one of them!
|
87
94
|
if ( (@username != nil && @password != nil) && @unsecure == true)
|
88
95
|
errors << I18n.t("vagrant_windows_domain.errors.both_credentials_provided")
|
@@ -103,6 +103,10 @@ 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"
|
108
|
+
return
|
109
|
+
end
|
106
110
|
set_credentials
|
107
111
|
leave_domain
|
108
112
|
end
|
@@ -10,7 +10,7 @@ describe VagrantPlugins::WindowsDomain::Config do
|
|
10
10
|
|
11
11
|
let(:root_path) { (Pathname.new(Dir.mktmpdir)).to_s }
|
12
12
|
let(:ui) { Vagrant::UI::Silent.new }
|
13
|
-
let(:machine) { double("machine", ui: ui) }
|
13
|
+
let(:machine) { double("machine", ui: ui, id: "1234") }
|
14
14
|
let(:env) { double("environment", root_path: root_path, ui: ui) }
|
15
15
|
let(:vm) { double ("vm") }
|
16
16
|
let(:communicator) { double ("communicator") }
|
@@ -27,7 +27,7 @@ describe VagrantPlugins::WindowsDomain::Config do
|
|
27
27
|
before do
|
28
28
|
env = double("environment", root_path: "/tmp/vagrant-windows-domain-path")
|
29
29
|
config = double("config")
|
30
|
-
machine.stub(config: config, env: env)
|
30
|
+
machine.stub(config: config, env: env, id: "1234")
|
31
31
|
end
|
32
32
|
|
33
33
|
before { subject.finalize! }
|
@@ -77,6 +77,12 @@ describe VagrantPlugins::WindowsDomain::Config do
|
|
77
77
|
assert_error("You must not supply a \"username\" and \"password\" if \"unsecure\" is set to true.")
|
78
78
|
end
|
79
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
|
+
|
80
86
|
end
|
81
87
|
|
82
88
|
end
|
@@ -8,7 +8,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
|
|
8
8
|
|
9
9
|
let(:root_path) { (Pathname.new(Dir.mktmpdir)).to_s }
|
10
10
|
let(:ui) { double("ui") }
|
11
|
-
let(:machine) { double("machine", ui: ui) }
|
11
|
+
let(:machine) { double("machine", ui: ui, id: "1234") }
|
12
12
|
let(:env) { double("environment", root_path: root_path, ui: ui) }
|
13
13
|
let(:vm) { double ("vm") }
|
14
14
|
let(:communicator) { double ("communicator") }
|
@@ -23,7 +23,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
|
|
23
23
|
describe "configure" do
|
24
24
|
before do
|
25
25
|
allow(machine).to receive(:root_config).and_return(root_config)
|
26
|
-
machine.stub(config: root_config, env: env)
|
26
|
+
machine.stub(config: root_config, env: env, id: "1234")
|
27
27
|
allow(ui).to receive(:say).with(any_args)
|
28
28
|
allow(machine).to receive(:communicate).and_return(communicator)
|
29
29
|
allow(communicator).to receive(:shell).and_return(shell)
|
@@ -51,7 +51,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
|
|
51
51
|
|
52
52
|
before do
|
53
53
|
allow(machine).to receive(:root_config).and_return(root_config)
|
54
|
-
machine.stub(config: root_config, env: env)
|
54
|
+
machine.stub(config: root_config, env: env, id: "1234")
|
55
55
|
allow(ui).to receive(:say).with(any_args)
|
56
56
|
allow(machine).to receive(:communicate).and_return(communicator)
|
57
57
|
allow(communicator).to receive(:shell).and_return(shell)
|
@@ -151,6 +151,16 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
|
|
151
151
|
before do
|
152
152
|
allow(communicator).to receive(:shell).and_return(shell)
|
153
153
|
allow(shell).to receive(:powershell).and_yield(:stdout, "myoldcomputername")
|
154
|
+
config = double(config)
|
155
|
+
allow(machine).to receive(:config).and_return(config)
|
156
|
+
allow(config).to receive(:windows_domain).and_return(root_config)
|
157
|
+
allow(machine).to receive(:env).and_return(env)
|
158
|
+
|
159
|
+
root_config.domain = "foo.com"
|
160
|
+
root_config.username = "username"
|
161
|
+
root_config.password = "password"
|
162
|
+
root_config.finalize!
|
163
|
+
root_config.validate(machine)
|
154
164
|
end
|
155
165
|
|
156
166
|
it "should leave domain" do
|
@@ -168,13 +178,26 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
|
|
168
178
|
expect(communicator).to receive(:upload)
|
169
179
|
expect(communicator).to receive(:sudo).with(". 'c:/tmp/vagrant-windows-domain-runner.ps1'", {:elevated=>true, :error_key=>:ssh_bad_exit_status_muted, :good_exit=>0, :shell=>:powershell})
|
170
180
|
expect(ui).to receive(:info).with(any_args).once
|
171
|
-
|
181
|
+
|
182
|
+
expect(ui).to_not receive(:say)
|
183
|
+
expect(ui).to_not receive(:ask)
|
172
184
|
subject.destroy
|
173
185
|
end
|
174
186
|
|
187
|
+
it "should not leave domain plugin not associated with current Vagrantfile" do
|
188
|
+
allow(machine).to receive(:communicate).and_return(communicator)
|
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")
|
194
|
+
expect(ui).to_not receive(:ask)
|
195
|
+
expect(subject.destroy).to eq(nil)
|
196
|
+
end
|
197
|
+
|
175
198
|
it "should ask for credentials when leaving domain when no credentials were provided" do
|
176
199
|
root_config.username = nil
|
177
|
-
root_config.password = nil
|
200
|
+
root_config.password = nil
|
178
201
|
allow(machine).to receive(:communicate).and_return(communicator)
|
179
202
|
allow(machine).to receive(:env).and_return(env)
|
180
203
|
expect(communicator).to receive(:upload)
|
@@ -182,7 +205,6 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
|
|
182
205
|
expect(ui).to receive(:info).with(any_args).twice
|
183
206
|
expect(ui).to receive(:ask).with("Please enter your domain password (output will be hidden): ", {:echo=>false}).and_return("myusername")
|
184
207
|
expect(ui).to receive(:ask).with("Please enter your domain username: ")
|
185
|
-
|
186
208
|
subject.destroy
|
187
209
|
end
|
188
210
|
|
@@ -191,7 +213,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
|
|
191
213
|
describe "Powershell runner script" do
|
192
214
|
before do
|
193
215
|
allow(machine).to receive(:root_config).and_return(root_config)
|
194
|
-
machine.stub(config: root_config, env: env)
|
216
|
+
machine.stub(config: root_config, env: env, id: "1234")
|
195
217
|
allow(ui).to receive(:say).with(any_args)
|
196
218
|
allow(machine).to receive(:communicate).and_return(communicator)
|
197
219
|
allow(communicator).to receive(:shell).and_return(shell)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-windows-domain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Fellows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
200
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.0.14
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: Windows Domain Provisioner for Vagrant
|