vagrant-windows-domain 1.1.1 → 1.1.3

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: 42f3d186357fa789c5cfe433c9dcb260b30f0d1e
4
- data.tar.gz: a0d0b75ed02779afc0c96fc7dd21c5fdcde19cd3
3
+ metadata.gz: ce86949685fe8c228f0bf2ecb5b5284f6fd85eac
4
+ data.tar.gz: da22799eb1a74e416c9c32178fca198256c5757b
5
5
  SHA512:
6
- metadata.gz: 0177c73b416054d338634b3abda33249f5c652eee85fbfc365b86d9039421afca652f603e3a0d6d30b89b16116e3ec974dea67c57f53407ecdd9eed3474065db
7
- data.tar.gz: 1cd8a084046bc000aee30493c8c28e115810eb64cba17e698c9b6540c7555fcf9ccb3e3b24af5876d2ace64b957495fa60bc713b09eb9859ca6297b1eba4d02c
6
+ metadata.gz: 05d2351ac7ae90cc26c49106ee8a0374d29cf8bd8341b5fb2fabdfaa59d6ebd408d93b0439bd839a58563a5694c4bec8a87a737aebe735c828011184069dea1a
7
+ data.tar.gz: 7b7299f283728ca184295b3c1c80532db8a309fff96c6a7867c32869bab22b8631814f7230ed52676a5a54cf97b220b44f9e5ad08b87292382bf967fef25bd02
@@ -10,11 +10,15 @@ VAGRANTFILE_API_VERSION = "2"
10
10
 
11
11
  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
12
12
 
13
- config.vm.box = "windows2012r2"
13
+ config.vm.box = "mfellows/windows2012r2"
14
14
  config.vm.guest = :windows
15
15
  config.vm.communicator = "winrm"
16
16
  config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true
17
17
 
18
+ config.vm.provider "virtualbox" do |v|
19
+ v.gui = true
20
+ end
21
+
18
22
  # Run Windows Domain Provisioner
19
23
  config.vm.provision :windows_domain do |domain|
20
24
 
@@ -0,0 +1,23 @@
1
+ require_relative '../provisioner'
2
+ require 'pp'
3
+
4
+ module VagrantPlugins
5
+ module WindowsDomain
6
+ class LeaveDomain
7
+ include VagrantPlugins::WindowsDomain
8
+
9
+ def initialize(app, env)
10
+ @app = app
11
+ @machine = env[:machine]
12
+ @config = env[:machine].config.windows_domain
13
+ @provisioner = VagrantPlugins::WindowsDomain::Provisioner.new(@machine, @config)
14
+ end
15
+
16
+ def call(env)
17
+ @provisioner.destroy
18
+ @app.call(env)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -13,11 +13,21 @@ module VagrantPlugins
13
13
  require_relative 'config'
14
14
  Config
15
15
  end
16
+
17
+ config(:windows_domain) do
18
+ require_relative 'config'
19
+ Config
20
+ end
16
21
 
17
22
  provisioner(:windows_domain) do
18
23
  require_relative 'provisioner'
19
24
  Provisioner
20
25
  end
26
+
27
+ action_hook(:windows_domain, :machine_action_destroy) do |hook|
28
+ require_relative 'action/leave_domain'
29
+ hook.prepend(VagrantPlugins::WindowsDomain::LeaveDomain)
30
+ end
21
31
  end
22
32
  end
23
33
  end
@@ -102,7 +102,7 @@ module VagrantPlugins
102
102
  # This is the method called when destroying a machine that allows
103
103
  # for any state related to the machine created by the provisioner
104
104
  # to be cleaned up.
105
- def cleanup
105
+ def destroy
106
106
  set_credentials
107
107
  leave_domain
108
108
  end
@@ -155,9 +155,9 @@ module VagrantPlugins
155
155
 
156
156
  # Generates the argument list
157
157
  def generate_command_arguments(add_to_domain=true)
158
- params = {"-DomainName" => @config.domain }
159
158
 
160
159
  if add_to_domain
160
+ params = {"-DomainName" => @config.domain }
161
161
 
162
162
  if @config.unsecure
163
163
  params["-Unsecure"] = nil
@@ -173,6 +173,7 @@ module VagrantPlugins
173
173
  params["-OUPath"] = "'#{@config.ou_path}'"
174
174
  end
175
175
  else
176
+ params = {}
176
177
  if !@config.unsecure
177
178
  params["-UnjoinDomainCredential $credentials"] = nil
178
179
  end
@@ -237,7 +238,7 @@ module VagrantPlugins
237
238
  end
238
239
  end
239
240
 
240
- result
241
+ result == 0
241
242
  end
242
243
 
243
244
  # Gets the Computer Name from the guest machine
@@ -5,5 +5,5 @@ $credentials = New-Object System.Management.Automation.PSCredential ("<%= option
5
5
  <% if options[:add_to_domain] === true %>
6
6
  Add-Computer <%= options[:parameters] %> -Verbose -Force
7
7
  <% else %>
8
- Remove-Computer <%= options[:parameters] %> -Verbose -Force
8
+ Remove-Computer <%= options[:parameters] %> -Workgroup "WORKGROUP" -Verbose -Force
9
9
  <% end %>
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module WindowsDomain
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.3"
4
4
  end
5
5
  end
@@ -73,7 +73,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
73
73
  it "should join the domain" do
74
74
  allow(communicator).to receive(:upload)
75
75
  allow(ui).to receive(:info)
76
- 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}).and_return(true)
76
+ 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}).and_return(0)
77
77
  expect(communicator).to receive(:sudo).with("del c:/tmp/vagrant-windows-domain-runner.ps1")
78
78
  expect(machine).to receive(:action). with(:reload, {:provision_ignore_sentinel=>false})
79
79
  expect(communicator).to receive(:ready?).and_return(true)
@@ -85,7 +85,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
85
85
  it "should restart the machine on a successful domain join" do
86
86
  allow(communicator).to receive(:upload)
87
87
  allow(ui).to receive(:info)
88
- 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}).and_return(true)
88
+ 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}).and_return(0)
89
89
  expect(communicator).to receive(:sudo).with("del c:/tmp/vagrant-windows-domain-runner.ps1")
90
90
  expect(machine).to receive(:action). with(:reload, {:provision_ignore_sentinel=>false})
91
91
  expect(communicator).to receive(:ready?).and_return(true)
@@ -156,7 +156,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
156
156
  it "should leave domain" do
157
157
  allow(machine).to receive(:communicate).and_return(communicator)
158
158
  expect(communicator).to receive(:upload)
159
- 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}).and_return(true)
159
+ 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}).and_return(0)
160
160
  expect(ui).to receive(:info).with(any_args).once
161
161
 
162
162
  result = subject.leave_domain
@@ -169,7 +169,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
169
169
  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
170
  expect(ui).to receive(:info).with(any_args).once
171
171
 
172
- subject.cleanup
172
+ subject.destroy
173
173
  end
174
174
 
175
175
  it "should ask for credentials when leaving domain when no credentials were provided" do
@@ -183,7 +183,7 @@ describe VagrantPlugins::WindowsDomain::Provisioner do
183
183
  expect(ui).to receive(:ask).with("Please enter your domain password (output will be hidden): ", {:echo=>false}).and_return("myusername")
184
184
  expect(ui).to receive(:ask).with("Please enter your domain username: ")
185
185
 
186
- subject.cleanup
186
+ subject.destroy
187
187
  end
188
188
 
189
189
  end
@@ -222,7 +222,7 @@ Add-Computer -DomainName foo.com -Credential $credentials -Verbose -Force
222
222
  expect_script =
223
223
  %Q{$secpasswd = ConvertTo-SecureString "password" -AsPlainText -Force
224
224
  $credentials = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
225
- Remove-Computer -DomainName foo.com -UnjoinDomainCredential $credentials -Verbose -Force
225
+ Remove-Computer -UnjoinDomainCredential $credentials -Workgroup "WORKGROUP" -Verbose -Force
226
226
  }
227
227
  expect(script).to eq(expect_script)
228
228
  end
@@ -259,7 +259,7 @@ Add-Computer -DomainName foo.com -Credential $credentials -NewName 'mynewcompute
259
259
 
260
260
  it "should generate a valid powershell command to remove the computer from a domain" do
261
261
  script = subject.generate_command_runner_script(false).strip
262
- expect_script = "Remove-Computer -DomainName foo.com -Verbose -Force"
262
+ expect_script = "Remove-Computer -Workgroup \"WORKGROUP\" -Verbose -Force"
263
263
  expect(script).to eq(expect_script)
264
264
  end
265
265
  end
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.1
4
+ version: 1.1.3
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-01 00:00:00.000000000 Z
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -166,6 +166,7 @@ files:
166
166
  - Rakefile
167
167
  - development/Vagrantfile
168
168
  - lib/vagrant-windows-domain.rb
169
+ - lib/vagrant-windows-domain/action/leave_domain.rb
169
170
  - lib/vagrant-windows-domain/config.rb
170
171
  - lib/vagrant-windows-domain/locales/en.yml
171
172
  - lib/vagrant-windows-domain/plugin.rb