vagrant-winrm 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTEwOWNjNDY2ZjFjZmMzZGNlOGYwZDI2NjZhZmU0YTU3OWIwMWI3NA==
4
+ Njk3N2M1M2U5ZGNjNzM0NDg5YWJmNDhmZjllNDU5ZmY4Mzg4NWI0Nw==
5
5
  data.tar.gz: !binary |-
6
- MmVhYTJmZGY3YjkzNjgwNmM2ODY4YmMxMTNiNWM1OTZlNjg1MTc1Yw==
6
+ Mzc5MTZlYThlNjk3YWE0NWQ4MzcwMTcxYjBlYTc2MTRmNDExY2ExMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODdhMWYyMDdmNjM2Mzk5MWM2N2QxYzJiYThjMDFiZmNjZGEyYTYxMDI4M2Ux
10
- NDBkNzVlZTdhMDFjMmE3MzFlY2NiNjgwMWJlNWM4MjBjOTllNWVhODgxMDQ2
11
- NGZkYTgxY2M3NTBjNzdiODVjMDE5MTE3Yjc3MjE4M2MzYTUzY2Y=
9
+ OTQ4MDU2MjAwODY1ZGNjNmVmMGI3YTllMjkwYjkzNzZhZDkwNjEzZGIyN2M5
10
+ NmQwOWJmZGIzNjdlYmVhZDhlYjk4NWNlYjlmODk2NmQwNDE1OGIwZmQ1ZTFk
11
+ MTBjOWQ1ZmRiZTNlMzcxMTJlNDA3YWZhYzliNWRhYmQzMTI0NDI=
12
12
  data.tar.gz: !binary |-
13
- OWJmMzZkMTFmOWFjNmExMWNmMzA4ZGZmM2NlY2NlYTQ2ZTIzOTlmNDU0ODA1
14
- NTU0ZDhmZmNlOGI3OTgwODUzN2I2ZDNhMmMzYmU2NTY0NDg4MTg2NTJjZDI5
15
- YzMyZDk1MTMxM2JkY2IwOGUzMTRjNzBkMDA2YTc3NTc2YWMwY2E=
13
+ OTcyZmIwZmE3Zjc0ODc4YzVhMGRjMzY2ZWY2MTVmOGQ2OTNjOTA2YTAwZjU0
14
+ NmYxYzkyOTVhNzA2YmJhZjNmODNmMTRlZGViYzg4MjM0YWU3ZTc2ODQwZjc0
15
+ YjVjMGU3NDRkZGRhNjBlZDg1ZjQwZjVhMjYwMTJlNWI1YTNhMDk=
data/README.md CHANGED
@@ -6,7 +6,7 @@ This is a [Vagrant][vagrant_dl] 1.6+ plugin that adds new command to extends Win
6
6
 
7
7
  ## <a name="features"></a> Features
8
8
 
9
- * Execute remote command
9
+ * Execute remote command (even with elevated credentials)
10
10
  * Upload files
11
11
  * Retrieve WinRM configuration
12
12
 
@@ -26,6 +26,9 @@ This command allows you to execute arbitrary remote commands through WinRM.
26
26
 
27
27
  vagrant winrm -c "pre-install.bat" -c "install.bat" -c "post-install.bat" Windows2008VM
28
28
 
29
+ The following command run the given command with local elevated credentials
30
+ vagrant winrm -e -c "winrm get winrm/config Windows2008VM
31
+
29
32
  ### <a name="usage-winrm-upload"> winrm-upload
30
33
 
31
34
  This command allows you to upload a file or a directory to your machine through WinRM.
@@ -20,6 +20,10 @@ module VagrantPlugins
20
20
  options[:command].push c
21
21
  end
22
22
 
23
+ o.on('-e', '--elevated', 'Run all commands with elevated credentials') do |e|
24
+ options[:elevated] = true
25
+ end
26
+
23
27
  o.on('-s', '--shell SHELL', [:powershell, :cmd], 'Use the specified shell (powershell, cmd)') do |s|
24
28
  options[:shell] = s
25
29
  end
@@ -51,7 +55,7 @@ module VagrantPlugins
51
55
 
52
56
  options[:command].each do |c|
53
57
  @logger.debug("Executing command: #{c}")
54
- exit_code |= vm.communicate.execute(c, shell: options[:shell]) { |type, data| (type == :stderr ? $stderr : $stdout).print data }
58
+ exit_code |= vm.communicate.execute(c, shell: options[:shell], elevated: options[:elevated]) { |type, data| (type == :stderr ? $stderr : $stdout).print data }
55
59
  end
56
60
  return exit_code
57
61
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VagrantWinRM
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
@@ -37,7 +37,7 @@ describe VagrantPlugins::VagrantWinRM::WinRMConfig, :unit => true do
37
37
  end
38
38
 
39
39
  # Add our machine to the environment
40
- allow(env).to receive(:machine).with(any_args, :virtualbox) do |name, provider|
40
+ allow(env).to receive(:machine) do |name, provider|
41
41
  machine if :vagrant == name
42
42
  end
43
43
  end
@@ -28,7 +28,7 @@ describe VagrantPlugins::VagrantWinRM::WinRM, :unit => true do
28
28
  end
29
29
 
30
30
  # Add our machine to the environment
31
- allow(env).to receive(:machine).with(any_args, :virtualbox) do |name, provider|
31
+ allow(env).to receive(:machine) do |name, provider|
32
32
  machine if :vagrant == name
33
33
  end
34
34
  end
@@ -78,10 +78,10 @@ describe VagrantPlugins::VagrantWinRM::WinRM, :unit => true do
78
78
  it 'passes commands to communicator with no target' do
79
79
  c = VagrantPlugins::VagrantWinRM::WinRM.new(['-c', 'command1', '--command', 'command2', '-c', 'command3', '--command', 'command4'], env)
80
80
 
81
- expect(communicator).to receive(:execute).ordered.with('command1', { shell: :powershell }).and_return 0
82
- expect(communicator).to receive(:execute).ordered.with('command2', { shell: :powershell }).and_return 0
83
- expect(communicator).to receive(:execute).ordered.with('command3', { shell: :powershell }).and_return 0
84
- expect(communicator).to receive(:execute).ordered.with('command4', { shell: :powershell }).and_return 0
81
+ expect(communicator).to receive(:execute).ordered.with('command1', { shell: :powershell, elevated: nil }).and_return 0
82
+ expect(communicator).to receive(:execute).ordered.with('command2', { shell: :powershell, elevated: nil }).and_return 0
83
+ expect(communicator).to receive(:execute).ordered.with('command3', { shell: :powershell, elevated: nil }).and_return 0
84
+ expect(communicator).to receive(:execute).ordered.with('command4', { shell: :powershell, elevated: nil }).and_return 0
85
85
 
86
86
  expect {
87
87
  expect(c.execute).to be_zero
@@ -90,19 +90,28 @@ describe VagrantPlugins::VagrantWinRM::WinRM, :unit => true do
90
90
 
91
91
  it 'passes commands to communicator even with a specific target' do
92
92
  c = VagrantPlugins::VagrantWinRM::WinRM.new(['-c', 'command5', '--command', 'command6', '-c', 'command7', '--command', 'command8', 'vagrant'], env)
93
- expect(communicator).to receive(:execute).ordered.with('command5', { shell: :powershell }).and_return 0
94
- expect(communicator).to receive(:execute).ordered.with('command6', { shell: :powershell }).and_return 0
95
- expect(communicator).to receive(:execute).ordered.with('command7', { shell: :powershell }).and_return 0
96
- expect(communicator).to receive(:execute).ordered.with('command8', { shell: :powershell }).and_return 0
93
+ expect(communicator).to receive(:execute).ordered.with('command5', { shell: :powershell, elevated: nil }).and_return 0
94
+ expect(communicator).to receive(:execute).ordered.with('command6', { shell: :powershell, elevated: nil }).and_return 0
95
+ expect(communicator).to receive(:execute).ordered.with('command7', { shell: :powershell, elevated: nil }).and_return 0
96
+ expect(communicator).to receive(:execute).ordered.with('command8', { shell: :powershell, elevated: nil }).and_return 0
97
97
  expect {
98
98
  expect(c.execute).to be_zero
99
99
  }.not_to output.to_stdout
100
100
  end
101
101
 
102
+ it 'uses communicator elevated feature when option -e is present' do
103
+ c = VagrantPlugins::VagrantWinRM::WinRM.new(['-e', '-c', 'command'], env)
104
+
105
+ expect(communicator).to receive(:execute).with('command', { shell: :powershell, elevated: true }).and_yield(:stdout, 'output message').and_return 0
106
+ expect {
107
+ expect(c.execute).to be_zero
108
+ }.to output('output message').to_stdout
109
+ end
110
+
102
111
  it 'redirects winrm outputs to stdout' do
103
112
  c = VagrantPlugins::VagrantWinRM::WinRM.new(['-c', 'command'], env)
104
113
 
105
- expect(communicator).to receive(:execute).with('command', { shell: :powershell }).and_yield(:stdout, 'output message').and_return 0
114
+ expect(communicator).to receive(:execute).with('command', { shell: :powershell, elevated: nil }).and_yield(:stdout, 'output message').and_return 0
106
115
  expect {
107
116
  expect(c.execute).to be_zero
108
117
  }.to output('output message').to_stdout
@@ -111,7 +120,7 @@ describe VagrantPlugins::VagrantWinRM::WinRM, :unit => true do
111
120
  it 'redirects winrm errors to stderr' do
112
121
  c = VagrantPlugins::VagrantWinRM::WinRM.new(['-c', 'command'], env)
113
122
 
114
- expect(communicator).to receive(:execute).with('command', { shell: :powershell }).and_yield(:stderr, 'error message').and_return 0
123
+ expect(communicator).to receive(:execute).with('command', { shell: :powershell, elevated: nil }).and_yield(:stderr, 'error message').and_return 0
115
124
  expect {
116
125
  expect(c.execute).to be_zero
117
126
  }.to output('error message').to_stderr
@@ -28,7 +28,7 @@ describe VagrantPlugins::VagrantWinRM::WinRMUpload, :unit => true do
28
28
  end
29
29
 
30
30
  # Add our machine to the environment
31
- allow(env).to receive(:machine).with(any_args, :virtualbox) do |name, provider|
31
+ allow(env).to receive(:machine) do |name, provider|
32
32
  machine if :vagrant == name
33
33
  end
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-winrm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Courtois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-31 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitar