coverage/index.html in vagrant-windows-1.2.1 vs coverage/index.html in vagrant-windows-1.2.2

- old
+ new

@@ -12,31 +12,31 @@ <body> <div id="loading"> <img src="./assets/0.7.1/loading.gif" alt="loading"/> </div> <div id="wrapper" style="display:none;"> - <div class="timestamp">Generated <abbr class="timeago" title="2013-09-16T08:37:43-07:00">2013-09-16T08:37:43-07:00</abbr></div> + <div class="timestamp">Generated <abbr class="timeago" title="2013-10-21T10:22:32-07:00">2013-10-21T10:22:32-07:00</abbr></div> <ul class="group_tabs"></ul> <div id="content"> <div class="file_list_container" id="AllFiles"> <h2> <span class="group_name">All Files</span> - (<span class="covered_percent"><span class="red">68.62%</span></span> + (<span class="covered_percent"><span class="red">70.99%</span></span> covered at <span class="covered_strength"> <span class="green"> - 1.14 + 1.43 </span> </span> hits/line) </h2> <a name="AllFiles"></a> <div> - <b>23</b> files in total. - <b>650</b> relevant lines. - <span class="green"><b>446</b> lines covered</span> and - <span class="red"><b>204</b> lines missed </span> + <b>26</b> files in total. + <b>717</b> relevant lines. + <span class="green"><b>509</b> lines covered</span> and + <span class="red"><b>208</b> lines missed </span> </div> <table class="file_list"> <thead> <tr> <th>File</th> @@ -55,11 +55,11 @@ <td class="green strong">100.0 %</td> <td>24</td> <td>11</td> <td>11</td> <td>0</td> - <td>2.1</td> + <td>2.4</td> </tr> <tr> <td class="strong"><a href="#dec1987bc6b58f2134e55c26a9e0d4f67a0e5a04" class="src_link" title="lib/vagrant-windows/communication/guestnetwork.rb">lib/vagrant-windows/communication/guestnetwork.rb</a></td> <td class="yellow strong">81.67 %</td> @@ -70,36 +70,36 @@ <td>1.5</td> </tr> <tr> <td class="strong"><a href="#9c5c265071fce540a59ec662bb558312c6c54c4b" class="src_link" title="lib/vagrant-windows/communication/winrmcommunicator.rb">lib/vagrant-windows/communication/winrmcommunicator.rb</a></td> - <td class="red strong">60.71 %</td> - <td>120</td> - <td>56</td> - <td>34</td> - <td>22</td> - <td>0.7</td> + <td class="red strong">64.71 %</td> + <td>147</td> + <td>68</td> + <td>44</td> + <td>24</td> + <td>0.9</td> </tr> <tr> <td class="strong"><a href="#46df79007581e23184efb74db86daf5c58254ec5" class="src_link" title="lib/vagrant-windows/communication/winrmfinder.rb">lib/vagrant-windows/communication/winrmfinder.rb</a></td> - <td class="red strong">52.17 %</td> - <td>45</td> - <td>23</td> - <td>12</td> - <td>11</td> - <td>0.5</td> + <td class="red strong">70.83 %</td> + <td>48</td> + <td>24</td> + <td>17</td> + <td>7</td> + <td>1.3</td> </tr> <tr> <td class="strong"><a href="#206e71d4215a183bebef0dee5b2d9ce2fe77aea6" class="src_link" title="lib/vagrant-windows/communication/winrmshell.rb">lib/vagrant-windows/communication/winrmshell.rb</a></td> - <td class="yellow strong">86.3 %</td> - <td>141</td> + <td class="green strong">91.78 %</td> + <td>139</td> <td>73</td> - <td>63</td> - <td>10</td> - <td>2.8</td> + <td>67</td> + <td>6</td> + <td>4.3</td> </tr> <tr> <td class="strong"><a href="#ec6c148e559f5558fb277fea15c45c85fa409d28" class="src_link" title="lib/vagrant-windows/config/windows.rb">lib/vagrant-windows/config/windows.rb</a></td> <td class="red strong">76.19 %</td> @@ -110,16 +110,16 @@ <td>1.6</td> </tr> <tr> <td class="strong"><a href="#a372cc3d4ed5fc1cc5c873176518bf601233f6f1" class="src_link" title="lib/vagrant-windows/config/winrm.rb">lib/vagrant-windows/config/winrm.rb</a></td> - <td class="red strong">75.68 %</td> - <td>51</td> - <td>37</td> + <td class="red strong">77.78 %</td> + <td>50</td> + <td>36</td> <td>28</td> - <td>9</td> - <td>5.7</td> + <td>8</td> + <td>6.6</td> </tr> <tr> <td class="strong"><a href="#2d43162323a6643b71b6db31fa0a711c9acdfe90" class="src_link" title="lib/vagrant-windows/errors.rb">lib/vagrant-windows/errors.rb</a></td> <td class="green strong">100.0 %</td> @@ -200,16 +200,16 @@ <td>0.3</td> </tr> <tr> <td class="strong"><a href="#9387455ce27f9821d2f4388bcb52524681914003" class="src_link" title="lib/vagrant-windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet.rb">lib/vagrant-windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet.rb</a></td> - <td class="red strong">25.0 %</td> - <td>101</td> - <td>48</td> + <td class="red strong">21.43 %</td> + <td>114</td> + <td>56</td> <td>12</td> - <td>36</td> - <td>0.3</td> + <td>44</td> + <td>0.2</td> </tr> <tr> <td class="strong"><a href="#6093af51a0c7e6f795cd8cd2111d8d673bde18c3" class="src_link" title="lib/vagrant-windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet_server.rb">lib/vagrant-windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet_server.rb</a></td> <td class="green strong">100.0 %</td> @@ -230,29 +230,19 @@ <td>0.3</td> </tr> <tr> <td class="strong"><a href="#ee8701360a03270a2ab0f3354046766cf5f92da8" class="src_link" title="lib/vagrant-windows/plugin.rb">lib/vagrant-windows/plugin.rb</a></td> - <td class="red strong">70.0 %</td> + <td class="red strong">63.33 %</td> <td>129</td> <td>60</td> - <td>42</td> - <td>18</td> - <td>0.8</td> + <td>38</td> + <td>22</td> + <td>0.6</td> </tr> <tr> - <td class="strong"><a href="#fc65074c6619984f8557ec48c3c84dbc08554a83" class="src_link" title="spec/vagrant-windows/guestnetwork_spec.rb">spec/vagrant-windows/guestnetwork_spec.rb</a></td> - <td class="green strong">100.0 %</td> - <td>62</td> - <td>33</td> - <td>33</td> - <td>0</td> - <td>1.1</td> - </tr> - - <tr> <td class="strong"><a href="#13b6aec4445d4eeafa03e964d1e1486037abd7a4" class="src_link" title="spec/vagrant-windows/helper_spec.rb">spec/vagrant-windows/helper_spec.rb</a></td> <td class="green strong">100.0 %</td> <td>57</td> <td>29</td> <td>29</td> @@ -269,19 +259,59 @@ <td>0</td> <td>1.1</td> </tr> <tr> - <td class="strong"><a href="#844842835a3c9ba296ba1e91954dcd0979df99b4" class="src_link" title="spec/vagrant-windows/winrmcommunicator_spec.rb">spec/vagrant-windows/winrmcommunicator_spec.rb</a></td> - <td class="green strong">92.31 %</td> + <td class="strong"><a href="#967ff63c080ac973ec82b5efb410383048f559e0" class="src_link" title="spec/vagrant-windows/windows_config_spec.rb">spec/vagrant-windows/windows_config_spec.rb</a></td> + <td class="green strong">100.0 %</td> <td>26</td> - <td>13</td> - <td>12</td> - <td>1</td> - <td>0.9</td> + <td>15</td> + <td>15</td> + <td>0</td> + <td>1.8</td> </tr> + <tr> + <td class="strong"><a href="#5a677aee80d575d53b9b20a950767cd27c7f2e9e" class="src_link" title="spec/vagrant-windows/winrm_config_spec.rb">spec/vagrant-windows/winrm_config_spec.rb</a></td> + <td class="green strong">100.0 %</td> + <td>31</td> + <td>20</td> + <td>20</td> + <td>0</td> + <td>3.9</td> + </tr> + + <tr> + <td class="strong"><a href="#844842835a3c9ba296ba1e91954dcd0979df99b4" class="src_link" title="spec/vagrant-windows/winrmcommunicator_spec.rb">spec/vagrant-windows/winrmcommunicator_spec.rb</a></td> + <td class="green strong">100.0 %</td> + <td>28</td> + <td>14</td> + <td>14</td> + <td>0</td> + <td>1.1</td> + </tr> + + <tr> + <td class="strong"><a href="#5bf85486dfa43acdf015a1bc09ffbc798937c5ed" class="src_link" title="spec/vagrant-windows/winrmfinder_spec.rb">spec/vagrant-windows/winrmfinder_spec.rb</a></td> + <td class="green strong">100.0 %</td> + <td>44</td> + <td>24</td> + <td>24</td> + <td>0</td> + <td>1.2</td> + </tr> + + <tr> + <td class="strong"><a href="#25447093b9cbe29e6009455b5e95c517f212a004" class="src_link" title="spec/vagrant-windows/winrmshell_spec.rb">spec/vagrant-windows/winrmshell_spec.rb</a></td> + <td class="green strong">100.0 %</td> + <td>39</td> + <td>20</td> + <td>20</td> + <td>0</td> + <td>1.4</td> + </tr> + </tbody> </table> </div> @@ -338,12 +368,12 @@ <span class="hits">1</span> <code class="ruby"> def self.vagrant_windows_root</code> </li> - <li class="covered" data-hits="6" data-linenumber="6"> - <span class="hits">6</span> + <li class="covered" data-hits="7" data-linenumber="6"> + <span class="hits">7</span> <code class="ruby"> @vagrant_windows_root ||= Pathname.new(File.expand_path(&quot;../../&quot;, __FILE__))</code> </li> <li class="never" data-hits="" data-linenumber="7"> @@ -362,12 +392,12 @@ <span class="hits">1</span> <code class="ruby"> def self.load_script(script_file_name)</code> </li> - <li class="covered" data-hits="3" data-linenumber="10"> - <span class="hits">3</span> + <li class="covered" data-hits="4" data-linenumber="10"> + <span class="hits">4</span> <code class="ruby"> File.read(expand_script_path(script_file_name))</code> </li> <li class="never" data-hits="" data-linenumber="11"> @@ -410,12 +440,12 @@ <span class="hits">1</span> <code class="ruby"> def self.expand_script_path(script_file_name)</code> </li> - <li class="covered" data-hits="5" data-linenumber="18"> - <span class="hits">5</span> + <li class="covered" data-hits="6" data-linenumber="18"> + <span class="hits">6</span> <code class="ruby"> File.expand_path(&quot;lib/vagrant-windows/scripts/#{script_file_name}&quot;, VagrantWindows.vagrant_windows_root)</code> </li> <li class="never" data-hits="" data-linenumber="19"> @@ -698,12 +728,12 @@ <span class="hits">3</span> <code class="ruby"> @winrmshell.powershell(cmd) do |type, line|</code> </li> - <li class="covered" data-hits="6" data-linenumber="39"> - <span class="hits">6</span> + <li class="covered" data-hits="7" data-linenumber="39"> + <span class="hits">7</span> <code class="ruby"> has_dhcp_enabled = !line.nil?</code> </li> <li class="never" data-hits="" data-linenumber="40"> @@ -1275,15 +1305,15 @@ </div> <div class="source_table" id="9c5c265071fce540a59ec662bb558312c6c54c4b"> <div class="header"> <h3>lib/vagrant-windows/communication/winrmcommunicator.rb</h3> - <h4><span class="red">60.71 %</span> covered</h4> + <h4><span class="red">64.71 %</span> covered</h4> <div> - <b>56</b> relevant lines. - <span class="green"><b>34</b> lines covered</span> and - <span class="red"><b>22</b> lines missed.</span> + <b>68</b> relevant lines. + <span class="green"><b>44</b> lines covered</span> and + <span class="red"><b>24</b> lines missed.</span> </div> </div> <pre> <ol> @@ -1550,461 +1580,623 @@ <span class="hits">1</span> <code class="ruby"> def execute(command, opts={}, &amp;block)</code> </li> - <li class="covered" data-hits="2" data-linenumber="45"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="45"> + <span class="hits">3</span> - <code class="ruby"> if opts[:shell].eql? :cmd</code> + <code class="ruby"> opts = {</code> </li> - <li class="missed" data-hits="0" data-linenumber="46"> + <li class="never" data-hits="" data-linenumber="46"> - <code class="ruby"> session.cmd(command, &amp;block)[:exitcode]</code> + <code class="ruby"> :error_check =&gt; true,</code> </li> <li class="never" data-hits="" data-linenumber="47"> - <code class="ruby"> else</code> + <code class="ruby"> :error_class =&gt; VagrantWindows::Errors::WinRMExecutionError,</code> </li> - <li class="covered" data-hits="2" data-linenumber="48"> - <span class="hits">2</span> + <li class="never" data-hits="" data-linenumber="48"> - <code class="ruby"> command = VagrantWindows.load_script(&quot;command_alias.ps1&quot;) &lt;&lt; &quot;\r\n&quot; &lt;&lt; command</code> + + <code class="ruby"> :error_key =&gt; :winrm_execution_error,</code> </li> - <li class="covered" data-hits="2" data-linenumber="49"> - <span class="hits">2</span> + <li class="never" data-hits="" data-linenumber="49"> - <code class="ruby"> session.powershell(command, &amp;block)[:exitcode]</code> + + <code class="ruby"> :command =&gt; command,</code> </li> <li class="never" data-hits="" data-linenumber="50"> - <code class="ruby"> end</code> + <code class="ruby"> :shell =&gt; :powershell</code> </li> <li class="never" data-hits="" data-linenumber="51"> + <code class="ruby"> }.merge(opts || {})</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="52"> + <span class="hits">3</span> + + <code class="ruby"> exit_status = do_execute(command, opts[:shell], &amp;block)</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="53"> + <span class="hits">3</span> + + <code class="ruby"> if opts[:error_check] &amp;&amp; exit_status != 0</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="54"> + <span class="hits">2</span> + + <code class="ruby"> raise_execution_error(opts, exit_status)</code> + </li> + + <li class="never" data-hits="" data-linenumber="55"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="56"> + <span class="hits">1</span> + + <code class="ruby"> exit_status</code> + </li> + + <li class="never" data-hits="" data-linenumber="57"> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="52"> + <li class="covered" data-hits="1" data-linenumber="58"> <span class="hits">1</span> <code class="ruby"> alias_method :sudo, :execute</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="never" data-hits="" data-linenumber="59"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="54"> + <li class="covered" data-hits="1" data-linenumber="60"> <span class="hits">1</span> <code class="ruby"> def test(command, opts=nil)</code> </li> - <li class="never" data-hits="" data-linenumber="55"> + <li class="missed" data-hits="0" data-linenumber="61"> + <code class="ruby"> @logger.debug(&quot;Testing: #{command}&quot;)</code> + </li> + + <li class="never" data-hits="" data-linenumber="62"> + + + <code class="ruby"> </code> + </li> + + <li class="never" data-hits="" data-linenumber="63"> + + <code class="ruby"> # HACK: to speed up Vagrant 1.2 OS detection, skip checking for *nix OS</code> </li> - <li class="missed" data-hits="0" data-linenumber="56"> + <li class="missed" data-hits="0" data-linenumber="64"> <code class="ruby"> return false unless (command =~ /^uname|^cat \/etc|^cat \/proc|grep 'Fedora/).nil?</code> </li> - <li class="missed" data-hits="0" data-linenumber="57"> + <li class="never" data-hits="" data-linenumber="65"> - <code class="ruby"> execute(command) == 0</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="missed" data-hits="0" data-linenumber="66"> + <code class="ruby"> opts = { :error_check =&gt; false }.merge(opts || {})</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="67"> + + + <code class="ruby"> execute(command, opts) == 0</code> + </li> + + <li class="never" data-hits="" data-linenumber="68"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="59"> + <li class="never" data-hits="" data-linenumber="69"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="60"> + <li class="covered" data-hits="1" data-linenumber="70"> <span class="hits">1</span> <code class="ruby"> def upload(from, to)</code> </li> - <li class="missed" data-hits="0" data-linenumber="61"> + <li class="missed" data-hits="0" data-linenumber="71"> <code class="ruby"> @logger.debug(&quot;Uploading: #{from} to #{to}&quot;)</code> </li> - <li class="missed" data-hits="0" data-linenumber="62"> + <li class="missed" data-hits="0" data-linenumber="72"> <code class="ruby"> file = &quot;winrm-upload-#{rand()}&quot;</code> </li> - <li class="missed" data-hits="0" data-linenumber="63"> + <li class="missed" data-hits="0" data-linenumber="73"> <code class="ruby"> file_name = (session.cmd(&quot;echo %TEMP%\\#{file}&quot;))[:data][0][:stdout].chomp</code> </li> - <li class="missed" data-hits="0" data-linenumber="64"> + <li class="missed" data-hits="0" data-linenumber="74"> <code class="ruby"> session.powershell &lt;&lt;-EOH</code> </li> - <li class="never" data-hits="" data-linenumber="65"> + <li class="never" data-hits="" data-linenumber="75"> <code class="ruby"> if(Test-Path #{to})</code> </li> - <li class="never" data-hits="" data-linenumber="66"> + <li class="never" data-hits="" data-linenumber="76"> <code class="ruby"> {</code> </li> - <li class="never" data-hits="" data-linenumber="67"> + <li class="never" data-hits="" data-linenumber="77"> <code class="ruby"> rm #{to}</code> </li> - <li class="never" data-hits="" data-linenumber="68"> + <li class="never" data-hits="" data-linenumber="78"> <code class="ruby"> }</code> </li> - <li class="never" data-hits="" data-linenumber="69"> + <li class="never" data-hits="" data-linenumber="79"> <code class="ruby"> EOH</code> </li> - <li class="missed" data-hits="0" data-linenumber="70"> + <li class="missed" data-hits="0" data-linenumber="80"> <code class="ruby"> Base64.encode64(IO.binread(from)).gsub(&quot;\n&quot;,'').chars.to_a.each_slice(8000-file_name.size) do |chunk|</code> </li> - <li class="missed" data-hits="0" data-linenumber="71"> + <li class="missed" data-hits="0" data-linenumber="81"> <code class="ruby"> out = session.cmd(&quot;echo #{chunk.join} &gt;&gt; \&quot;#{file_name}\&quot;&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="72"> + <li class="never" data-hits="" data-linenumber="82"> <code class="ruby"> end</code> </li> - <li class="missed" data-hits="0" data-linenumber="73"> + <li class="missed" data-hits="0" data-linenumber="83"> <code class="ruby"> session.powershell(&quot;mkdir $([System.IO.Path]::GetDirectoryName(\&quot;#{to}\&quot;))&quot;)</code> </li> - <li class="missed" data-hits="0" data-linenumber="74"> + <li class="missed" data-hits="0" data-linenumber="84"> <code class="ruby"> session.powershell &lt;&lt;-EOH</code> </li> - <li class="never" data-hits="" data-linenumber="75"> + <li class="never" data-hits="" data-linenumber="85"> <code class="ruby"> $base64_string = Get-Content \&quot;#{file_name}\&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="76"> + <li class="never" data-hits="" data-linenumber="86"> <code class="ruby"> $bytes = [System.Convert]::FromBase64String($base64_string) </code> </li> - <li class="never" data-hits="" data-linenumber="77"> + <li class="never" data-hits="" data-linenumber="87"> <code class="ruby"> $new_file = [System.IO.Path]::GetFullPath(\&quot;#{to}\&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="78"> + <li class="never" data-hits="" data-linenumber="88"> <code class="ruby"> [System.IO.File]::WriteAllBytes($new_file,$bytes)</code> </li> - <li class="never" data-hits="" data-linenumber="79"> + <li class="never" data-hits="" data-linenumber="89"> <code class="ruby"> EOH</code> </li> - <li class="never" data-hits="" data-linenumber="80"> + <li class="never" data-hits="" data-linenumber="90"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="81"> + <li class="never" data-hits="" data-linenumber="91"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="82"> + <li class="covered" data-hits="1" data-linenumber="92"> <span class="hits">1</span> <code class="ruby"> def download(from, to=nil)</code> </li> - <li class="missed" data-hits="0" data-linenumber="83"> + <li class="missed" data-hits="0" data-linenumber="93"> <code class="ruby"> @logger.warn(&quot;Downloading: #{from} to #{to} not supported on Windows guests&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="94"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="85"> + <li class="never" data-hits="" data-linenumber="95"> <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="86"> + <li class="never" data-hits="" data-linenumber="96"> <code class="ruby"> # Runs a remote WQL query against the VM</code> </li> - <li class="never" data-hits="" data-linenumber="87"> + <li class="never" data-hits="" data-linenumber="97"> <code class="ruby"> #</code> </li> - <li class="never" data-hits="" data-linenumber="88"> + <li class="never" data-hits="" data-linenumber="98"> <code class="ruby"> # Note: This is not part of the standard Vagrant communicator interface, but</code> </li> - <li class="never" data-hits="" data-linenumber="89"> + <li class="never" data-hits="" data-linenumber="99"> <code class="ruby"> # guest capabilities may need to use this.</code> </li> - <li class="covered" data-hits="1" data-linenumber="90"> + <li class="covered" data-hits="1" data-linenumber="100"> <span class="hits">1</span> <code class="ruby"> def wql(query)</code> </li> - <li class="missed" data-hits="0" data-linenumber="91"> + <li class="missed" data-hits="0" data-linenumber="101"> <code class="ruby"> session.wql(query)</code> </li> - <li class="never" data-hits="" data-linenumber="92"> + <li class="never" data-hits="" data-linenumber="102"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="93"> + <li class="never" data-hits="" data-linenumber="103"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="94"> + <li class="covered" data-hits="1" data-linenumber="104"> <span class="hits">1</span> <code class="ruby"> def set_winrmshell(winrmshell)</code> </li> - <li class="covered" data-hits="1" data-linenumber="95"> + <li class="covered" data-hits="1" data-linenumber="105"> <span class="hits">1</span> <code class="ruby"> @session = winrmshell</code> </li> - <li class="never" data-hits="" data-linenumber="96"> + <li class="never" data-hits="" data-linenumber="106"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="97"> + <li class="never" data-hits="" data-linenumber="107"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="98"> + <li class="covered" data-hits="1" data-linenumber="108"> <span class="hits">1</span> <code class="ruby"> def session</code> </li> - <li class="covered" data-hits="2" data-linenumber="99"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="109"> + <span class="hits">3</span> <code class="ruby"> @session ||= new_session</code> </li> - <li class="never" data-hits="" data-linenumber="100"> + <li class="never" data-hits="" data-linenumber="110"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="101"> + <li class="covered" data-hits="1" data-linenumber="111"> <span class="hits">1</span> <code class="ruby"> alias_method :winrmshell, :session</code> </li> - <li class="never" data-hits="" data-linenumber="102"> + <li class="never" data-hits="" data-linenumber="112"> <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="103"> + <li class="never" data-hits="" data-linenumber="113"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="104"> + <li class="covered" data-hits="1" data-linenumber="114"> <span class="hits">1</span> <code class="ruby"> protected</code> </li> - <li class="never" data-hits="" data-linenumber="105"> + <li class="never" data-hits="" data-linenumber="115"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="106"> + <li class="covered" data-hits="1" data-linenumber="116"> <span class="hits">1</span> + <code class="ruby"> def do_execute(command, shell, &amp;block)</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="117"> + <span class="hits">3</span> + + <code class="ruby"> if shell.eql? :cmd</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="118"> + + + <code class="ruby"> session.cmd(command, &amp;block)[:exitcode]</code> + </li> + + <li class="never" data-hits="" data-linenumber="119"> + + + <code class="ruby"> else</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="120"> + <span class="hits">3</span> + + <code class="ruby"> command = VagrantWindows.load_script(&quot;command_alias.ps1&quot;) &lt;&lt; &quot;\r\n&quot; &lt;&lt; command</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="121"> + <span class="hits">3</span> + + <code class="ruby"> session.powershell(command, &amp;block)[:exitcode]</code> + </li> + + <li class="never" data-hits="" data-linenumber="122"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="123"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="124"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="125"> + <span class="hits">1</span> + + <code class="ruby"> def raise_execution_error(opts, exit_code)</code> + </li> + + <li class="never" data-hits="" data-linenumber="126"> + + + <code class="ruby"> # The error classes expect the translation key to be _key, but that makes for an ugly</code> + </li> + + <li class="never" data-hits="" data-linenumber="127"> + + + <code class="ruby"> # configuration parameter, so we set it here from `error_key`</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="128"> + <span class="hits">2</span> + + <code class="ruby"> msg = &quot;Command execution failed with an exit code of #{exit_code}&quot;</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="129"> + <span class="hits">2</span> + + <code class="ruby"> error_opts = opts.merge(:_key =&gt; opts[:error_key], :message =&gt; msg)</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="130"> + <span class="hits">2</span> + + <code class="ruby"> raise opts[:error_class], error_opts</code> + </li> + + <li class="never" data-hits="" data-linenumber="131"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="132"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="133"> + <span class="hits">1</span> + <code class="ruby"> def new_session</code> </li> - <li class="missed" data-hits="0" data-linenumber="107"> + <li class="missed" data-hits="0" data-linenumber="134"> <code class="ruby"> WinRMShell.new(</code> </li> - <li class="never" data-hits="" data-linenumber="108"> + <li class="never" data-hits="" data-linenumber="135"> <code class="ruby"> @winrm_finder.winrm_host_address(),</code> </li> - <li class="never" data-hits="" data-linenumber="109"> + <li class="never" data-hits="" data-linenumber="136"> <code class="ruby"> @machine.config.winrm.username,</code> </li> - <li class="never" data-hits="" data-linenumber="110"> + <li class="never" data-hits="" data-linenumber="137"> <code class="ruby"> @machine.config.winrm.password,</code> </li> - <li class="never" data-hits="" data-linenumber="111"> + <li class="never" data-hits="" data-linenumber="138"> <code class="ruby"> {</code> </li> - <li class="never" data-hits="" data-linenumber="112"> + <li class="never" data-hits="" data-linenumber="139"> <code class="ruby"> :port =&gt; @winrm_finder.winrm_host_port(),</code> </li> - <li class="never" data-hits="" data-linenumber="113"> + <li class="never" data-hits="" data-linenumber="140"> <code class="ruby"> :timeout_in_seconds =&gt; @machine.config.winrm.timeout,</code> </li> - <li class="never" data-hits="" data-linenumber="114"> + <li class="never" data-hits="" data-linenumber="141"> <code class="ruby"> :max_tries =&gt; @machine.config.winrm.max_tries</code> </li> - <li class="never" data-hits="" data-linenumber="115"> + <li class="never" data-hits="" data-linenumber="142"> <code class="ruby"> })</code> </li> - <li class="never" data-hits="" data-linenumber="116"> + <li class="never" data-hits="" data-linenumber="143"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="117"> + <li class="never" data-hits="" data-linenumber="144"> <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="118"> + <li class="never" data-hits="" data-linenumber="145"> <code class="ruby"> end #WinRM class</code> </li> - <li class="never" data-hits="" data-linenumber="119"> + <li class="never" data-hits="" data-linenumber="146"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="120"> + <li class="never" data-hits="" data-linenumber="147"> <code class="ruby">end</code> </li> @@ -2013,15 +2205,15 @@ </div> <div class="source_table" id="46df79007581e23184efb74db86daf5c58254ec5"> <div class="header"> <h3>lib/vagrant-windows/communication/winrmfinder.rb</h3> - <h4><span class="red">52.17 %</span> covered</h4> + <h4><span class="red">70.83 %</span> covered</h4> <div> - <b>23</b> relevant lines. - <span class="green"><b>12</b> lines covered</span> and - <span class="red"><b>11</b> lines missed.</span> + <b>24</b> relevant lines. + <span class="green"><b>17</b> lines covered</span> and + <span class="red"><b>7</b> lines missed.</span> </div> </div> <pre> <ol> @@ -2090,18 +2282,18 @@ <span class="hits">1</span> <code class="ruby"> def initialize(machine)</code> </li> - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> + <li class="covered" data-hits="4" data-linenumber="12"> + <span class="hits">4</span> <code class="ruby"> @machine = machine</code> </li> - <li class="covered" data-hits="1" data-linenumber="13"> - <span class="hits">1</span> + <li class="covered" data-hits="4" data-linenumber="13"> + <span class="hits">4</span> <code class="ruby"> @logger = Log4r::Logger.new(&quot;vagrant_windows::communication::winrmfinder&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="14"> @@ -2129,170 +2321,188 @@ </li> <li class="never" data-hits="" data-linenumber="18"> - <code class="ruby"> # provider is saying that SSH is not ready.</code> + <code class="ruby"> # provider is saying that the machine is not ready.</code> </li> - <li class="missed" data-hits="0" data-linenumber="19"> + <li class="covered" data-hits="3" data-linenumber="19"> + <span class="hits">3</span> - <code class="ruby"> ssh_info = @machine.ssh_info</code> </li> - <li class="missed" data-hits="0" data-linenumber="20"> + <li class="covered" data-hits="3" data-linenumber="20"> + <span class="hits">3</span> + <code class="ruby"> raise VagrantWindows::Errors::WinRMNotReady if ssh_info.nil?</code> + </li> + + <li class="never" data-hits="" data-linenumber="21"> - <code class="ruby"> raise Vagrant::Errors::SSHNotReady if ssh_info.nil?</code> + + <code class="ruby"> </code> </li> - <li class="missed" data-hits="0" data-linenumber="21"> + <li class="never" data-hits="" data-linenumber="22"> - <code class="ruby"> @logger.info(&quot;WinRM host: #{ssh_info[:host]}&quot;)</code> + <code class="ruby"> # if the configuration has a host value, that takes precedence</code> </li> - <li class="missed" data-hits="0" data-linenumber="22"> + <li class="covered" data-hits="2" data-linenumber="23"> + <span class="hits">2</span> + <code class="ruby"> host = @machine.config.winrm.host || ssh_info[:host]</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="24"> + <span class="hits">2</span> - <code class="ruby"> return ssh_info[:host]</code> + <code class="ruby"> @logger.info(&quot;WinRM host: #{host}&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="23"> + <li class="covered" data-hits="2" data-linenumber="25"> + <span class="hits">2</span> + <code class="ruby"> host</code> + </li> + + <li class="never" data-hits="" data-linenumber="26"> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="24"> + <li class="never" data-hits="" data-linenumber="27"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="25"> + <li class="covered" data-hits="1" data-linenumber="28"> <span class="hits">1</span> <code class="ruby"> def winrm_host_port</code> </li> - <li class="missed" data-hits="0" data-linenumber="26"> + <li class="missed" data-hits="0" data-linenumber="29"> <code class="ruby"> expected_guest_port = @machine.config.winrm.guest_port</code> </li> - <li class="missed" data-hits="0" data-linenumber="27"> + <li class="missed" data-hits="0" data-linenumber="30"> <code class="ruby"> @logger.debug(&quot;Searching for WinRM port: #{expected_guest_port.inspect}&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="28"> + <li class="never" data-hits="" data-linenumber="31"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="29"> + <li class="never" data-hits="" data-linenumber="32"> <code class="ruby"> # Look for the forwarded port only by comparing the guest port</code> </li> - <li class="missed" data-hits="0" data-linenumber="30"> + <li class="missed" data-hits="0" data-linenumber="33"> <code class="ruby"> begin</code> </li> - <li class="missed" data-hits="0" data-linenumber="31"> + <li class="missed" data-hits="0" data-linenumber="34"> <code class="ruby"> @machine.provider.driver.read_forwarded_ports.each do |_, _, hostport, guestport|</code> </li> - <li class="missed" data-hits="0" data-linenumber="32"> + <li class="missed" data-hits="0" data-linenumber="35"> <code class="ruby"> return hostport if guestport == expected_guest_port</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="34"> + <li class="never" data-hits="" data-linenumber="37"> <code class="ruby"> rescue NoMethodError =&gt; e</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="38"> <code class="ruby"> # VMWare provider doesn't support read_forwarded_ports</code> </li> - <li class="missed" data-hits="0" data-linenumber="36"> + <li class="missed" data-hits="0" data-linenumber="39"> <code class="ruby"> @logger.debug(e.message)</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="40"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="38"> + <li class="never" data-hits="" data-linenumber="41"> <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="39"> + <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"> # We tried, give up and use the configured port as-is</code> </li> - <li class="missed" data-hits="0" data-linenumber="40"> + <li class="missed" data-hits="0" data-linenumber="43"> <code class="ruby"> @machine.config.winrm.port</code> </li> - <li class="never" data-hits="" data-linenumber="41"> + <li class="never" data-hits="" data-linenumber="44"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="42"> + <li class="never" data-hits="" data-linenumber="45"> <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="never" data-hits="" data-linenumber="46"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="47"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="45"> + <li class="never" data-hits="" data-linenumber="48"> <code class="ruby">end</code> </li> @@ -2301,15 +2511,15 @@ </div> <div class="source_table" id="206e71d4215a183bebef0dee5b2d9ce2fe77aea6"> <div class="header"> <h3>lib/vagrant-windows/communication/winrmshell.rb</h3> - <h4><span class="yellow">86.3 %</span> covered</h4> + <h4><span class="green">91.78 %</span> covered</h4> <div> <b>73</b> relevant lines. - <span class="green"><b>63</b> lines covered</span> and - <span class="red"><b>10</b> lines missed.</span> + <span class="green"><b>67</b> lines covered</span> and + <span class="red"><b>6</b> lines missed.</span> </div> </div> <pre> <ol> @@ -2528,60 +2738,60 @@ <span class="hits">1</span> <code class="ruby"> def initialize(host, username, password, options = {})</code> </li> - <li class="covered" data-hits="2" data-linenumber="37"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="37"> + <span class="hits">3</span> <code class="ruby"> @logger = Log4r::Logger.new(&quot;vagrant_windows::communication::winrmshell&quot;)</code> </li> - <li class="covered" data-hits="2" data-linenumber="38"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="38"> + <span class="hits">3</span> <code class="ruby"> @logger.debug(&quot;initializing WinRMShell&quot;)</code> </li> <li class="never" data-hits="" data-linenumber="39"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="2" data-linenumber="40"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="40"> + <span class="hits">3</span> <code class="ruby"> @host = host</code> </li> - <li class="covered" data-hits="2" data-linenumber="41"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="41"> + <span class="hits">3</span> <code class="ruby"> @port = options[:port] || 5985</code> </li> - <li class="covered" data-hits="2" data-linenumber="42"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="42"> + <span class="hits">3</span> <code class="ruby"> @username = username</code> </li> - <li class="covered" data-hits="2" data-linenumber="43"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="43"> + <span class="hits">3</span> <code class="ruby"> @password = password</code> </li> - <li class="covered" data-hits="2" data-linenumber="44"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="44"> + <span class="hits">3</span> <code class="ruby"> @timeout_in_seconds = options[:timeout_in_seconds] || 60</code> </li> - <li class="covered" data-hits="2" data-linenumber="45"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="45"> + <span class="hits">3</span> <code class="ruby"> @max_tries = options[:max_tries] || 20</code> </li> <li class="never" data-hits="" data-linenumber="46"> @@ -2600,12 +2810,12 @@ <span class="hits">1</span> <code class="ruby"> def powershell(command, &amp;block)</code> </li> - <li class="covered" data-hits="11" data-linenumber="49"> - <span class="hits">11</span> + <li class="covered" data-hits="15" data-linenumber="49"> + <span class="hits">15</span> <code class="ruby"> execute_shell(command, :powershell, &amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="50"> @@ -2624,13 +2834,13 @@ <span class="hits">1</span> <code class="ruby"> def cmd(command, &amp;block)</code> </li> - <li class="missed" data-hits="0" data-linenumber="53"> + <li class="covered" data-hits="1" data-linenumber="53"> + <span class="hits">1</span> - <code class="ruby"> execute_shell(command, :cmd, &amp;block)</code> </li> <li class="never" data-hits="" data-linenumber="54"> @@ -2684,108 +2894,108 @@ <span class="hits">1</span> <code class="ruby"> def execute_shell(command, shell=:powershell, &amp;block)</code> </li> - <li class="covered" data-hits="11" data-linenumber="63"> - <span class="hits">11</span> + <li class="covered" data-hits="16" data-linenumber="63"> + <span class="hits">16</span> - <code class="ruby"> retryable(:tries =&gt; @max_tries, :on =&gt; @@exceptions_to_retry_on, :sleep =&gt; 10) do</code> + <code class="ruby"> raise Errors::WinRMInvalidShell, :shell =&gt; shell unless shell == :cmd || shell == :powershell</code> </li> - <li class="covered" data-hits="11" data-linenumber="64"> - <span class="hits">11</span> + <li class="covered" data-hits="16" data-linenumber="64"> + <span class="hits">16</span> - <code class="ruby"> @logger.debug(&quot;#{shell} executing:\n#{command}&quot;)</code> + <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="11" data-linenumber="65"> - <span class="hits">11</span> + <li class="covered" data-hits="16" data-linenumber="65"> + <span class="hits">16</span> - <code class="ruby"> if shell.eql? :cmd</code> + <code class="ruby"> execute_shell_with_retry(command, shell, &amp;block)</code> </li> <li class="missed" data-hits="0" data-linenumber="66"> - <code class="ruby"> output = session.cmd(command) do |out, err|</code> + <code class="ruby"> rescue =&gt; e</code> </li> <li class="missed" data-hits="0" data-linenumber="67"> - <code class="ruby"> block.call(:stdout, out) if block_given? &amp;&amp; out</code> + <code class="ruby"> raise_winrm_exception(e, shell, command)</code> </li> - <li class="missed" data-hits="0" data-linenumber="68"> + <li class="never" data-hits="" data-linenumber="68"> - <code class="ruby"> block.call(:stderr, err) if block_given? &amp;&amp; err</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="69"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="70"> - <code class="ruby"> elsif shell.eql? :powershell</code> + <code class="ruby"> </code> </li> - <li class="covered" data-hits="11" data-linenumber="71"> - <span class="hits">11</span> + <li class="covered" data-hits="1" data-linenumber="71"> + <span class="hits">1</span> - <code class="ruby"> output = session.powershell(command) do |out, err|</code> + <code class="ruby"> def execute_shell_with_retry(command, shell, &amp;block)</code> </li> <li class="covered" data-hits="16" data-linenumber="72"> <span class="hits">16</span> - <code class="ruby"> block.call(:stdout, out) if block_given? &amp;&amp; out</code> + <code class="ruby"> retryable(:tries =&gt; @max_tries, :on =&gt; @@exceptions_to_retry_on, :sleep =&gt; 10) do</code> </li> <li class="covered" data-hits="16" data-linenumber="73"> <span class="hits">16</span> - <code class="ruby"> block.call(:stderr, err) if block_given? &amp;&amp; err</code> + <code class="ruby"> @logger.debug(&quot;#{shell} executing:\n#{command}&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="74"> + <li class="covered" data-hits="16" data-linenumber="74"> + <span class="hits">16</span> - - <code class="ruby"> end</code> + <code class="ruby"> output = session.send(shell, command) do |out, err|</code> </li> - <li class="never" data-hits="" data-linenumber="75"> + <li class="covered" data-hits="23" data-linenumber="75"> + <span class="hits">23</span> - - <code class="ruby"> else</code> + <code class="ruby"> block.call(:stdout, out) if block_given? &amp;&amp; out</code> </li> - <li class="missed" data-hits="0" data-linenumber="76"> + <li class="covered" data-hits="23" data-linenumber="76"> + <span class="hits">23</span> - - <code class="ruby"> raise Errors::WinRMInvalidShell, :shell =&gt; shell</code> + <code class="ruby"> block.call(:stderr, err) if block_given? &amp;&amp; err</code> </li> <li class="never" data-hits="" data-linenumber="77"> <code class="ruby"> end</code> </li> - <li class="covered" data-hits="11" data-linenumber="78"> - <span class="hits">11</span> + <li class="covered" data-hits="16" data-linenumber="78"> + <span class="hits">16</span> <code class="ruby"> @logger.debug(&quot;Exit status: #{output[:exitcode].inspect}&quot;)</code> </li> - <li class="covered" data-hits="11" data-linenumber="79"> - <span class="hits">11</span> + <li class="covered" data-hits="16" data-linenumber="79"> + <span class="hits">16</span> <code class="ruby"> return output</code> </li> <li class="never" data-hits="" data-linenumber="80"> @@ -2795,368 +3005,356 @@ </li> <li class="never" data-hits="" data-linenumber="81"> - <code class="ruby"> rescue =&gt; e</code> - </li> - - <li class="missed" data-hits="0" data-linenumber="82"> - - - <code class="ruby"> handle_winrm_exception(e, shell, command)</code> - </li> - - <li class="never" data-hits="" data-linenumber="83"> - - <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="82"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="85"> + <li class="covered" data-hits="1" data-linenumber="83"> <span class="hits">1</span> <code class="ruby"> def execute_wql(query)</code> </li> - <li class="covered" data-hits="3" data-linenumber="86"> + <li class="covered" data-hits="3" data-linenumber="84"> <span class="hits">3</span> <code class="ruby"> retryable(:tries =&gt; @max_tries, :on =&gt; @@exceptions_to_retry_on, :sleep =&gt; 10) do</code> </li> - <li class="covered" data-hits="3" data-linenumber="87"> + <li class="covered" data-hits="3" data-linenumber="85"> <span class="hits">3</span> <code class="ruby"> @logger.debug(&quot;#executing wql: #{query}&quot;)</code> </li> - <li class="covered" data-hits="3" data-linenumber="88"> + <li class="covered" data-hits="3" data-linenumber="86"> <span class="hits">3</span> <code class="ruby"> output = session.wql(query)</code> </li> - <li class="covered" data-hits="3" data-linenumber="89"> + <li class="covered" data-hits="3" data-linenumber="87"> <span class="hits">3</span> <code class="ruby"> @logger.debug(&quot;wql result: #{output.inspect}&quot;)</code> </li> - <li class="covered" data-hits="3" data-linenumber="90"> + <li class="covered" data-hits="3" data-linenumber="88"> <span class="hits">3</span> <code class="ruby"> return output</code> </li> - <li class="never" data-hits="" data-linenumber="91"> + <li class="never" data-hits="" data-linenumber="89"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="92"> + <li class="never" data-hits="" data-linenumber="90"> <code class="ruby"> rescue =&gt; e</code> </li> - <li class="missed" data-hits="0" data-linenumber="93"> + <li class="missed" data-hits="0" data-linenumber="91"> - <code class="ruby"> handle_winrm_exception(e, :wql, query)</code> + <code class="ruby"> raise_winrm_exception(e, :wql, query)</code> </li> - <li class="never" data-hits="" data-linenumber="94"> + <li class="never" data-hits="" data-linenumber="92"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="95"> + <li class="never" data-hits="" data-linenumber="93"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="96"> + <li class="covered" data-hits="1" data-linenumber="94"> <span class="hits">1</span> - <code class="ruby"> def handle_winrm_exception(winrm_exception, shell, command)</code> + <code class="ruby"> def raise_winrm_exception(winrm_exception, shell, command)</code> </li> - <li class="missed" data-hits="0" data-linenumber="97"> + <li class="missed" data-hits="0" data-linenumber="95"> <code class="ruby"> if winrm_exception.message.include?(&quot;401&quot;) # return a more specific auth error for 401 errors</code> </li> - <li class="missed" data-hits="0" data-linenumber="98"> + <li class="missed" data-hits="0" data-linenumber="96"> <code class="ruby"> raise Errors::WinRMAuthorizationError,</code> </li> - <li class="never" data-hits="" data-linenumber="99"> + <li class="never" data-hits="" data-linenumber="97"> <code class="ruby"> :user =&gt; @username,</code> </li> - <li class="never" data-hits="" data-linenumber="100"> + <li class="never" data-hits="" data-linenumber="98"> <code class="ruby"> :password =&gt; @password,</code> </li> - <li class="never" data-hits="" data-linenumber="101"> + <li class="never" data-hits="" data-linenumber="99"> <code class="ruby"> :endpoint =&gt; endpoint,</code> </li> - <li class="never" data-hits="" data-linenumber="102"> + <li class="never" data-hits="" data-linenumber="100"> <code class="ruby"> :message =&gt; winrm_exception.message</code> </li> - <li class="never" data-hits="" data-linenumber="103"> + <li class="never" data-hits="" data-linenumber="101"> <code class="ruby"> end</code> </li> - <li class="missed" data-hits="0" data-linenumber="104"> + <li class="missed" data-hits="0" data-linenumber="102"> <code class="ruby"> raise Errors::WinRMExecutionError,</code> </li> - <li class="never" data-hits="" data-linenumber="105"> + <li class="never" data-hits="" data-linenumber="103"> <code class="ruby"> :shell =&gt; shell,</code> </li> - <li class="never" data-hits="" data-linenumber="106"> + <li class="never" data-hits="" data-linenumber="104"> <code class="ruby"> :command =&gt; command,</code> </li> - <li class="never" data-hits="" data-linenumber="107"> + <li class="never" data-hits="" data-linenumber="105"> <code class="ruby"> :message =&gt; winrm_exception.message</code> </li> - <li class="never" data-hits="" data-linenumber="108"> + <li class="never" data-hits="" data-linenumber="106"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="109"> + <li class="never" data-hits="" data-linenumber="107"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="110"> + <li class="covered" data-hits="1" data-linenumber="108"> <span class="hits">1</span> <code class="ruby"> def new_session</code> </li> - <li class="covered" data-hits="2" data-linenumber="111"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="109"> + <span class="hits">3</span> <code class="ruby"> @logger.info(&quot;Attempting to connect to WinRM...&quot;)</code> </li> - <li class="covered" data-hits="2" data-linenumber="112"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="110"> + <span class="hits">3</span> <code class="ruby"> @logger.info(&quot; - Host: #{@host}&quot;)</code> </li> - <li class="covered" data-hits="2" data-linenumber="113"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="111"> + <span class="hits">3</span> <code class="ruby"> @logger.info(&quot; - Port: #{@port}&quot;)</code> </li> - <li class="covered" data-hits="2" data-linenumber="114"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="112"> + <span class="hits">3</span> <code class="ruby"> @logger.info(&quot; - Username: #{@username}&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="115"> + <li class="never" data-hits="" data-linenumber="113"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="2" data-linenumber="116"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="114"> + <span class="hits">3</span> <code class="ruby"> client = ::WinRM::WinRMWebService.new(endpoint, :plaintext, endpoint_options)</code> </li> - <li class="covered" data-hits="2" data-linenumber="117"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="115"> + <span class="hits">3</span> <code class="ruby"> client.set_timeout(@timeout_in_seconds)</code> </li> - <li class="covered" data-hits="2" data-linenumber="118"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="116"> + <span class="hits">3</span> <code class="ruby"> client.toggle_nori_type_casting(:off) #we don't want coersion of types</code> </li> - <li class="covered" data-hits="2" data-linenumber="119"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="117"> + <span class="hits">3</span> <code class="ruby"> client</code> </li> - <li class="never" data-hits="" data-linenumber="120"> + <li class="never" data-hits="" data-linenumber="118"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="121"> + <li class="never" data-hits="" data-linenumber="119"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="122"> + <li class="covered" data-hits="1" data-linenumber="120"> <span class="hits">1</span> <code class="ruby"> def session</code> </li> - <li class="covered" data-hits="14" data-linenumber="123"> - <span class="hits">14</span> + <li class="covered" data-hits="19" data-linenumber="121"> + <span class="hits">19</span> <code class="ruby"> @session ||= new_session</code> </li> - <li class="never" data-hits="" data-linenumber="124"> + <li class="never" data-hits="" data-linenumber="122"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="125"> + <li class="never" data-hits="" data-linenumber="123"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="126"> + <li class="covered" data-hits="1" data-linenumber="124"> <span class="hits">1</span> <code class="ruby"> def endpoint</code> </li> - <li class="covered" data-hits="2" data-linenumber="127"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="125"> + <span class="hits">3</span> <code class="ruby"> &quot;http://#{@host}:#{@port}/wsman&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="128"> + <li class="never" data-hits="" data-linenumber="126"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="129"> + <li class="never" data-hits="" data-linenumber="127"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="130"> + <li class="covered" data-hits="1" data-linenumber="128"> <span class="hits">1</span> <code class="ruby"> def endpoint_options</code> </li> - <li class="never" data-hits="" data-linenumber="131"> + <li class="never" data-hits="" data-linenumber="129"> <code class="ruby"> { :user =&gt; @username,</code> </li> - <li class="never" data-hits="" data-linenumber="132"> + <li class="never" data-hits="" data-linenumber="130"> <code class="ruby"> :pass =&gt; @password,</code> </li> - <li class="never" data-hits="" data-linenumber="133"> + <li class="never" data-hits="" data-linenumber="131"> <code class="ruby"> :host =&gt; @host,</code> </li> - <li class="never" data-hits="" data-linenumber="134"> + <li class="never" data-hits="" data-linenumber="132"> <code class="ruby"> :port =&gt; @port,</code> </li> - <li class="never" data-hits="" data-linenumber="135"> + <li class="never" data-hits="" data-linenumber="133"> <code class="ruby"> :operation_timeout =&gt; @timeout_in_seconds,</code> </li> - <li class="covered" data-hits="2" data-linenumber="136"> - <span class="hits">2</span> + <li class="covered" data-hits="3" data-linenumber="134"> + <span class="hits">3</span> <code class="ruby"> :basic_auth_only =&gt; true }</code> </li> - <li class="never" data-hits="" data-linenumber="137"> + <li class="never" data-hits="" data-linenumber="135"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="138"> + <li class="never" data-hits="" data-linenumber="136"> <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="139"> + <li class="never" data-hits="" data-linenumber="137"> <code class="ruby"> end #WinShell class</code> </li> - <li class="never" data-hits="" data-linenumber="140"> + <li class="never" data-hits="" data-linenumber="138"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="141"> + <li class="never" data-hits="" data-linenumber="139"> <code class="ruby">end</code> </li> @@ -3393,15 +3591,15 @@ </div> <div class="source_table" id="a372cc3d4ed5fc1cc5c873176518bf601233f6f1"> <div class="header"> <h3>lib/vagrant-windows/config/winrm.rb</h3> - <h4><span class="red">75.68 %</span> covered</h4> + <h4><span class="red">77.78 %</span> covered</h4> <div> - <b>37</b> relevant lines. + <b>36</b> relevant lines. <span class="green"><b>28</b> lines covered</span> and - <span class="red"><b>9</b> lines missed.</span> + <span class="red"><b>8</b> lines missed.</span> </div> </div> <pre> <ol> @@ -3494,48 +3692,48 @@ <span class="hits">1</span> <code class="ruby"> def initialize</code> </li> - <li class="covered" data-hits="14" data-linenumber="16"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="16"> + <span class="hits">16</span> <code class="ruby"> @username = UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="17"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="17"> + <span class="hits">16</span> <code class="ruby"> @password = UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="18"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="18"> + <span class="hits">16</span> <code class="ruby"> @host = UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="19"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="19"> + <span class="hits">16</span> <code class="ruby"> @port = UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="20"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="20"> + <span class="hits">16</span> <code class="ruby"> @guest_port = UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="21"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="21"> + <span class="hits">16</span> <code class="ruby"> @max_tries = UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="22"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="22"> + <span class="hits">16</span> <code class="ruby"> @timeout = UNSET_VALUE</code> </li> <li class="never" data-hits="" data-linenumber="23"> @@ -3581,134 +3779,128 @@ </li> <li class="missed" data-hits="0" data-linenumber="30"> - <code class="ruby"> errors &lt;&lt; &quot;winrm.host cannot be nil.&quot; if machine.config.winrm.host.nil?</code> + <code class="ruby"> errors &lt;&lt; &quot;winrm.port cannot be nil.&quot; if machine.config.winrm.port.nil?</code> </li> <li class="missed" data-hits="0" data-linenumber="31"> - <code class="ruby"> errors &lt;&lt; &quot;winrm.port cannot be nil.&quot; if machine.config.winrm.port.nil?</code> + <code class="ruby"> errors &lt;&lt; &quot;winrm.guest_port cannot be nil.&quot; if machine.config.winrm.guest_port.nil?</code> </li> <li class="missed" data-hits="0" data-linenumber="32"> - <code class="ruby"> errors &lt;&lt; &quot;winrm.guest_port cannot be nil.&quot; if machine.config.winrm.guest_port.nil?</code> + <code class="ruby"> errors &lt;&lt; &quot;winrm.max_tries cannot be nil.&quot; if machine.config.winrm.max_tries.nil?</code> </li> <li class="missed" data-hits="0" data-linenumber="33"> - <code class="ruby"> errors &lt;&lt; &quot;winrm.max_tries cannot be nil.&quot; if machine.config.winrm.max_tries.nil?</code> - </li> - - <li class="missed" data-hits="0" data-linenumber="34"> - - <code class="ruby"> errors &lt;&lt; &quot;winrm.timeout cannot be nil.&quot; if machine.config.winrm.timeout.nil?</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="never" data-hits="" data-linenumber="34"> <code class="ruby"></code> </li> - <li class="missed" data-hits="0" data-linenumber="36"> + <li class="missed" data-hits="0" data-linenumber="35"> <code class="ruby"> { &quot;WinRM&quot; =&gt; errors }</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="38"> + <li class="never" data-hits="" data-linenumber="37"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="39"> + <li class="covered" data-hits="1" data-linenumber="38"> <span class="hits">1</span> <code class="ruby"> def finalize!</code> </li> - <li class="covered" data-hits="14" data-linenumber="40"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="39"> + <span class="hits">16</span> <code class="ruby"> @username = &quot;vagrant&quot; if @username == UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="41"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="40"> + <span class="hits">16</span> <code class="ruby"> @password = &quot;vagrant&quot; if @password == UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="42"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="41"> + <span class="hits">16</span> - <code class="ruby"> @host = &quot;localhost&quot; if @host == UNSET_VALUE</code> + <code class="ruby"> @host = nil if @host == UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="43"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="42"> + <span class="hits">16</span> <code class="ruby"> @port = 5985 if @port == UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="44"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="43"> + <span class="hits">16</span> <code class="ruby"> @guest_port = 5985 if @guest_port == UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="45"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="44"> + <span class="hits">16</span> <code class="ruby"> @max_tries = 20 if @max_tries == UNSET_VALUE</code> </li> - <li class="covered" data-hits="14" data-linenumber="46"> - <span class="hits">14</span> + <li class="covered" data-hits="16" data-linenumber="45"> + <span class="hits">16</span> <code class="ruby"> @timeout = 1800 if @timeout == UNSET_VALUE</code> </li> - <li class="never" data-hits="" data-linenumber="47"> + <li class="never" data-hits="" data-linenumber="46"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="never" data-hits="" data-linenumber="47"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="48"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="50"> + <li class="never" data-hits="" data-linenumber="49"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="51"> + <li class="never" data-hits="" data-linenumber="50"> <code class="ruby">end</code> </li> @@ -3785,17 +3977,17 @@ </li> <li class="covered" data-hits="1" data-linenumber="10"> <span class="hits">1</span> - <code class="ruby"> class WinRMPortNotDetected &lt; VagrantWindowsError</code> + <code class="ruby"> class WinRMNotReady &lt; VagrantWindowsError</code> </li> <li class="covered" data-hits="1" data-linenumber="11"> <span class="hits">1</span> - <code class="ruby"> error_key(:winrm_port_not_detected)</code> + <code class="ruby"> error_key(:winrm_not_ready)</code> </li> <li class="never" data-hits="" data-linenumber="12"> @@ -5625,15 +5817,15 @@ </div> <div class="source_table" id="9387455ce27f9821d2f4388bcb52524681914003"> <div class="header"> <h3>lib/vagrant-windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet.rb</h3> - <h4><span class="red">25.0 %</span> covered</h4> + <h4><span class="red">21.43 %</span> covered</h4> <div> - <b>48</b> relevant lines. + <b>56</b> relevant lines. <span class="green"><b>12</b> lines covered</span> and - <span class="red"><b>36</b> lines missed.</span> + <span class="red"><b>44</b> lines missed.</span> </div> </div> <pre> <ol> @@ -5675,11 +5867,11 @@ </li> <li class="never" data-hits="" data-linenumber="7"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> <li class="never" data-hits="" data-linenumber="8"> @@ -5699,11 +5891,11 @@ </li> <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> <li class="covered" data-hits="1" data-linenumber="12"> <span class="hits">1</span> @@ -5723,11 +5915,11 @@ </li> <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> <li class="covered" data-hits="1" data-linenumber="16"> <span class="hits">1</span> @@ -5747,11 +5939,11 @@ </li> <li class="never" data-hits="" data-linenumber="19"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> <li class="covered" data-hits="1" data-linenumber="20"> <span class="hits">1</span> @@ -5819,428 +6011,506 @@ </li> <li class="missed" data-hits="0" data-linenumber="31"> - <code class="ruby"> options &lt;&lt; @manifest_file</code> + <code class="ruby"> if @hiera_config_path</code> </li> <li class="missed" data-hits="0" data-linenumber="32"> - <code class="ruby"> options = options.join(&quot; &quot;)</code> + <code class="ruby"> options &lt;&lt; &quot;--hiera_config=#{@hiera_config_path}&quot;</code> </li> <li class="never" data-hits="" data-linenumber="33"> - <code class="ruby"></code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="34"> - <code class="ruby"> # Build up the custom facts if we have any</code> + <code class="ruby"></code> </li> <li class="missed" data-hits="0" data-linenumber="35"> - <code class="ruby"> facter = &quot;&quot;</code> + <code class="ruby"> if !@machine.env.ui.is_a?(Vagrant::UI::Colored)</code> </li> <li class="missed" data-hits="0" data-linenumber="36"> + <code class="ruby"> options &lt;&lt; &quot;--color=false&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="37"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="38"> + + + <code class="ruby"></code> + </li> + + <li class="missed" data-hits="0" data-linenumber="39"> + + + <code class="ruby"> options &lt;&lt; &quot;--manifestdir #{manifests_guest_path}&quot;</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="40"> + + + <code class="ruby"> options &lt;&lt; &quot;--detailed-exitcodes&quot;</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="41"> + + + <code class="ruby"> options &lt;&lt; @manifest_file</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="42"> + + + <code class="ruby"> options = options.join(&quot; &quot;)</code> + </li> + + <li class="never" data-hits="" data-linenumber="43"> + + + <code class="ruby"></code> + </li> + + <li class="never" data-hits="" data-linenumber="44"> + + + <code class="ruby"> # Build up the custom facts if we have any</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="45"> + + + <code class="ruby"> facter = &quot;&quot;</code> + </li> + + <li class="missed" data-hits="0" data-linenumber="46"> + + <code class="ruby"> if !config.facter.empty?</code> </li> - <li class="missed" data-hits="0" data-linenumber="37"> + <li class="missed" data-hits="0" data-linenumber="47"> <code class="ruby"> facts = []</code> </li> - <li class="missed" data-hits="0" data-linenumber="38"> + <li class="missed" data-hits="0" data-linenumber="48"> <code class="ruby"> config.facter.each do |key, value|</code> </li> - <li class="missed" data-hits="0" data-linenumber="39"> + <li class="missed" data-hits="0" data-linenumber="49"> <code class="ruby"> facts &lt;&lt; &quot;$env:FACTER_#{key}='#{value}';&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="40"> + <li class="never" data-hits="" data-linenumber="50"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="41"> + <li class="never" data-hits="" data-linenumber="51"> <code class="ruby"></code> </li> - <li class="missed" data-hits="0" data-linenumber="42"> + <li class="missed" data-hits="0" data-linenumber="52"> <code class="ruby"> facter = &quot;#{facts.join(&quot; &quot;)} &quot;</code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="never" data-hits="" data-linenumber="53"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="54"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> - <li class="missed" data-hits="0" data-linenumber="45"> + <li class="missed" data-hits="0" data-linenumber="55"> - <code class="ruby"> command = &quot;cd #{manifests_guest_path}; if($?) \{ #{facter} puppet apply #{options} \}&quot;</code> + <code class="ruby"> command = &quot;#{facter} puppet apply #{options}&quot;</code> </li> - <li class="never" data-hits="" data-linenumber="46"> + <li class="missed" data-hits="0" data-linenumber="56"> - <code class="ruby"> </code> + <code class="ruby"> if config.working_directory</code> </li> - <li class="missed" data-hits="0" data-linenumber="47"> + <li class="missed" data-hits="0" data-linenumber="57"> + <code class="ruby"> command = &quot;cd #{config.working_directory}; if($?) \{ #{command} \}&quot;</code> + </li> + + <li class="never" data-hits="" data-linenumber="58"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="59"> + + + <code class="ruby"></code> + </li> + + <li class="missed" data-hits="0" data-linenumber="60"> + + <code class="ruby"> @machine.env.ui.info I18n.t(&quot;vagrant.provisioners.puppet.running_puppet&quot;,</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="never" data-hits="" data-linenumber="61"> <code class="ruby"> :manifest =&gt; @manifest_file)</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="62"> <code class="ruby"></code> </li> - <li class="missed" data-hits="0" data-linenumber="50"> + <li class="missed" data-hits="0" data-linenumber="63"> <code class="ruby"> @machine.communicate.sudo(command) do |type, data|</code> </li> - <li class="missed" data-hits="0" data-linenumber="51"> + <li class="missed" data-hits="0" data-linenumber="64"> <code class="ruby"> if !data.empty?</code> </li> - <li class="missed" data-hits="0" data-linenumber="52"> + <li class="missed" data-hits="0" data-linenumber="65"> <code class="ruby"> @machine.env.ui.info(data, :new_line =&gt; false, :prefix =&gt; false)</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="never" data-hits="" data-linenumber="66"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="54"> + <li class="never" data-hits="" data-linenumber="67"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="55"> + <li class="never" data-hits="" data-linenumber="68"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="56"> + <li class="never" data-hits="" data-linenumber="69"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="57"> + <li class="covered" data-hits="1" data-linenumber="70"> <span class="hits">1</span> <code class="ruby"> def configure_on_windows(root_config)</code> </li> - <li class="never" data-hits="" data-linenumber="58"> + <li class="never" data-hits="" data-linenumber="71"> <code class="ruby"> # Calculate the paths we're going to use based on the environment</code> </li> - <li class="missed" data-hits="0" data-linenumber="59"> + <li class="missed" data-hits="0" data-linenumber="72"> <code class="ruby"> root_path = @machine.env.root_path</code> </li> - <li class="missed" data-hits="0" data-linenumber="60"> + <li class="missed" data-hits="0" data-linenumber="73"> <code class="ruby"> @expanded_manifests_path = @config.expanded_manifests_path(root_path)</code> </li> - <li class="missed" data-hits="0" data-linenumber="61"> + <li class="missed" data-hits="0" data-linenumber="74"> <code class="ruby"> @expanded_module_paths = @config.expanded_module_paths(root_path)</code> </li> - <li class="missed" data-hits="0" data-linenumber="62"> + <li class="missed" data-hits="0" data-linenumber="75"> - <code class="ruby"> @manifest_file = @config.manifest_file</code> + <code class="ruby"> @manifest_file = File.join(manifests_guest_path, @config.manifest_file)</code> </li> - <li class="never" data-hits="" data-linenumber="63"> + <li class="never" data-hits="" data-linenumber="76"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="64"> + <li class="never" data-hits="" data-linenumber="77"> <code class="ruby"> # Setup the module paths</code> </li> - <li class="missed" data-hits="0" data-linenumber="65"> + <li class="missed" data-hits="0" data-linenumber="78"> <code class="ruby"> @module_paths = []</code> </li> - <li class="missed" data-hits="0" data-linenumber="66"> + <li class="missed" data-hits="0" data-linenumber="79"> <code class="ruby"> @expanded_module_paths.each_with_index do |path, i|</code> </li> - <li class="missed" data-hits="0" data-linenumber="67"> + <li class="missed" data-hits="0" data-linenumber="80"> <code class="ruby"> @module_paths &lt;&lt; [path, File.join(config.temp_dir, &quot;modules-#{i}&quot;)]</code> </li> - <li class="never" data-hits="" data-linenumber="68"> + <li class="never" data-hits="" data-linenumber="81"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="69"> + <li class="never" data-hits="" data-linenumber="82"> <code class="ruby"></code> </li> - <li class="missed" data-hits="0" data-linenumber="70"> + <li class="missed" data-hits="0" data-linenumber="83"> <code class="ruby"> @logger.debug(&quot;Syncing folders from puppet configure&quot;)</code> </li> - <li class="missed" data-hits="0" data-linenumber="71"> + <li class="missed" data-hits="0" data-linenumber="84"> <code class="ruby"> @logger.debug(&quot;manifests_guest_path = #{manifests_guest_path}&quot;)</code> </li> - <li class="missed" data-hits="0" data-linenumber="72"> + <li class="missed" data-hits="0" data-linenumber="85"> <code class="ruby"> @logger.debug(&quot;expanded_manifests_path = #{@expanded_manifests_path}&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="73"> + <li class="never" data-hits="" data-linenumber="86"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="74"> + <li class="never" data-hits="" data-linenumber="87"> <code class="ruby"> # Windows guest volume mounting fails without an &quot;id&quot; specified</code> </li> - <li class="never" data-hits="" data-linenumber="75"> + <li class="never" data-hits="" data-linenumber="88"> <code class="ruby"> # This hacks around that problem and allows the PS mount script to work</code> </li> - <li class="missed" data-hits="0" data-linenumber="76"> + <li class="missed" data-hits="0" data-linenumber="89"> <code class="ruby"> root_config.vm.synced_folder(</code> </li> - <li class="never" data-hits="" data-linenumber="77"> + <li class="never" data-hits="" data-linenumber="90"> <code class="ruby"> @expanded_manifests_path, manifests_guest_path,</code> </li> - <li class="never" data-hits="" data-linenumber="78"> + <li class="never" data-hits="" data-linenumber="91"> <code class="ruby"> :id =&gt; &quot;v-manifests-1&quot;)</code> </li> - <li class="never" data-hits="" data-linenumber="79"> + <li class="never" data-hits="" data-linenumber="92"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="80"> + <li class="never" data-hits="" data-linenumber="93"> <code class="ruby"> # Share the manifests directory with the guest</code> </li> - <li class="never" data-hits="" data-linenumber="81"> + <li class="never" data-hits="" data-linenumber="94"> <code class="ruby"> #root_config.vm.synced_folder(</code> </li> - <li class="never" data-hits="" data-linenumber="82"> + <li class="never" data-hits="" data-linenumber="95"> <code class="ruby"> # @expanded_manifests_path, manifests_guest_path)</code> </li> - <li class="never" data-hits="" data-linenumber="83"> + <li class="never" data-hits="" data-linenumber="96"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="84"> + <li class="never" data-hits="" data-linenumber="97"> <code class="ruby"> # Share the module paths</code> </li> - <li class="missed" data-hits="0" data-linenumber="85"> + <li class="missed" data-hits="0" data-linenumber="98"> <code class="ruby"> count = 0</code> </li> - <li class="missed" data-hits="0" data-linenumber="86"> + <li class="missed" data-hits="0" data-linenumber="99"> <code class="ruby"> @module_paths.each do |from, to|</code> </li> - <li class="never" data-hits="" data-linenumber="87"> + <li class="never" data-hits="" data-linenumber="100"> <code class="ruby"> # Sorry for the cryptic key here, but VirtualBox has a strange limit on</code> </li> - <li class="never" data-hits="" data-linenumber="88"> + <li class="never" data-hits="" data-linenumber="101"> <code class="ruby"> # maximum size for it and its something small (around 10)</code> </li> - <li class="missed" data-hits="0" data-linenumber="89"> + <li class="missed" data-hits="0" data-linenumber="102"> <code class="ruby"> root_config.vm.synced_folder(from, to, :id =&gt; &quot;v-modules-#{count}&quot;)</code> </li> - <li class="missed" data-hits="0" data-linenumber="90"> + <li class="missed" data-hits="0" data-linenumber="103"> <code class="ruby"> count += 1</code> </li> - <li class="never" data-hits="" data-linenumber="91"> + <li class="never" data-hits="" data-linenumber="104"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="92"> + <li class="never" data-hits="" data-linenumber="105"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="93"> + <li class="never" data-hits="" data-linenumber="106"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="94"> + <li class="covered" data-hits="1" data-linenumber="107"> <span class="hits">1</span> <code class="ruby"> def is_windows</code> </li> - <li class="missed" data-hits="0" data-linenumber="95"> + <li class="missed" data-hits="0" data-linenumber="108"> <code class="ruby"> @machine.config.vm.guest.eql? :windows</code> </li> - <li class="never" data-hits="" data-linenumber="96"> + <li class="never" data-hits="" data-linenumber="109"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="97"> + <li class="never" data-hits="" data-linenumber="110"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="98"> + <li class="never" data-hits="" data-linenumber="111"> <code class="ruby"> end # Puppet class</code> </li> - <li class="never" data-hits="" data-linenumber="99"> + <li class="never" data-hits="" data-linenumber="112"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="100"> + <li class="never" data-hits="" data-linenumber="113"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="101"> + <li class="never" data-hits="" data-linenumber="114"> <code class="ruby">end</code> </li> @@ -6825,15 +7095,15 @@ </div> <div class="source_table" id="ee8701360a03270a2ab0f3354046766cf5f92da8"> <div class="header"> <h3>lib/vagrant-windows/plugin.rb</h3> - <h4><span class="red">70.0 %</span> covered</h4> + <h4><span class="red">63.33 %</span> covered</h4> <div> <b>60</b> relevant lines. - <span class="green"><b>42</b> lines covered</span> and - <span class="red"><b>18</b> lines missed.</span> + <span class="green"><b>38</b> lines covered</span> and + <span class="red"><b>22</b> lines missed.</span> </div> </div> <pre> <ol> @@ -7418,36 +7688,36 @@ <span class="hits">1</span> <code class="ruby"> def self.setup_logging</code> </li> - <li class="covered" data-hits="2" data-linenumber="98"> - <span class="hits">2</span> + <li class="covered" data-hits="1" data-linenumber="98"> + <span class="hits">1</span> <code class="ruby"> require &quot;log4r&quot;</code> </li> <li class="never" data-hits="" data-linenumber="99"> <code class="ruby"></code> </li> - <li class="covered" data-hits="2" data-linenumber="100"> - <span class="hits">2</span> + <li class="covered" data-hits="1" data-linenumber="100"> + <span class="hits">1</span> <code class="ruby"> level = nil</code> </li> - <li class="covered" data-hits="2" data-linenumber="101"> - <span class="hits">2</span> + <li class="covered" data-hits="1" data-linenumber="101"> + <span class="hits">1</span> <code class="ruby"> begin</code> </li> - <li class="covered" data-hits="2" data-linenumber="102"> - <span class="hits">2</span> + <li class="covered" data-hits="1" data-linenumber="102"> + <span class="hits">1</span> <code class="ruby"> level = Log4r.const_get(ENV[&quot;VAGRANT_LOG&quot;].upcase)</code> </li> <li class="never" data-hits="" data-linenumber="103"> @@ -7508,12 +7778,12 @@ <code class="ruby"> # sure that the log level is an integer, as Log4r requires.</code> </li> - <li class="covered" data-hits="2" data-linenumber="113"> - <span class="hits">2</span> + <li class="covered" data-hits="1" data-linenumber="113"> + <span class="hits">1</span> <code class="ruby"> level = nil if !level.is_a?(Integer)</code> </li> <li class="never" data-hits="" data-linenumber="114"> @@ -7532,37 +7802,37 @@ <code class="ruby"> # logs as long as we have a valid level.</code> </li> - <li class="covered" data-hits="2" data-linenumber="117"> - <span class="hits">2</span> + <li class="covered" data-hits="1" data-linenumber="117"> + <span class="hits">1</span> <code class="ruby"> if level</code> </li> - <li class="covered" data-hits="1" data-linenumber="118"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="118"> + <code class="ruby"> logger = Log4r::Logger.new(&quot;vagrant_windows&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="119"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="119"> + <code class="ruby"> logger.outputters = Log4r::Outputter.stderr</code> </li> - <li class="covered" data-hits="1" data-linenumber="120"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="120"> + <code class="ruby"> logger.level = level</code> </li> - <li class="covered" data-hits="1" data-linenumber="121"> - <span class="hits">1</span> + <li class="missed" data-hits="0" data-linenumber="121"> + <code class="ruby"> logger = nil</code> </li> <li class="never" data-hits="" data-linenumber="122"> @@ -7614,17 +7884,17 @@ </ol> </pre> </div> - <div class="source_table" id="fc65074c6619984f8557ec48c3c84dbc08554a83"> + <div class="source_table" id="13b6aec4445d4eeafa03e964d1e1486037abd7a4"> <div class="header"> - <h3>spec/vagrant-windows/guestnetwork_spec.rb</h3> + <h3>spec/vagrant-windows/helper_spec.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>33</b> relevant lines. - <span class="green"><b>33</b> lines covered</span> and + <b>29</b> relevant lines. + <span class="green"><b>29</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -7634,182 +7904,182 @@ <span class="hits">1</span> <code class="ruby">require 'spec_helper'</code> </li> - <li class="never" data-hits="" data-linenumber="2"> + <li class="covered" data-hits="1" data-linenumber="2"> + <span class="hits">1</span> + <code class="ruby">require 'mocha/api'</code> + </li> + + <li class="never" data-hits="" data-linenumber="3"> + <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="3"> + <li class="covered" data-hits="1" data-linenumber="4"> <span class="hits">1</span> - <code class="ruby">describe VagrantWindows::Communication::GuestNetwork , :integration =&gt; true do</code> + <code class="ruby">describe VagrantWindows::Helper , :unit =&gt; true do</code> </li> - <li class="never" data-hits="" data-linenumber="4"> + <li class="never" data-hits="" data-linenumber="5"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="5"> - <span class="hits">1</span> - - <code class="ruby"> before(:all) do</code> - </li> - <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> ENV[&quot;VAGRANT_LOG&quot;] = 'DEBUG'</code> + <code class="ruby"> class DummyHelper</code> </li> <li class="covered" data-hits="1" data-linenumber="7"> <span class="hits">1</span> - <code class="ruby"> VagrantWindows::Plugin.setup_logging()</code> + <code class="ruby"> include VagrantWindows::Helper</code> </li> <li class="never" data-hits="" data-linenumber="8"> - <code class="ruby"> </code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="9"> - <code class="ruby"> # This test requires you already have a running Windows Server 2008 R2 Vagrant VM</code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="10"> + <li class="covered" data-hits="1" data-linenumber="10"> + <span class="hits">1</span> - - <code class="ruby"> # Not ideal, but you have to start somewhere</code> + <code class="ruby"> before(:all) do</code> </li> <li class="covered" data-hits="1" data-linenumber="11"> <span class="hits">1</span> - <code class="ruby"> @shell = VagrantWindows::Communication::WinRMShell.new(&quot;localhost&quot;, &quot;vagrant&quot;, &quot;vagrant&quot;)</code> + <code class="ruby"> @dummy = DummyHelper.new</code> </li> - <li class="covered" data-hits="1" data-linenumber="12"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> @guestnetwork = VagrantWindows::Communication::GuestNetwork.new(@shell)</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="13"> - <code class="ruby"> end</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="14"> + <li class="covered" data-hits="1" data-linenumber="14"> + <span class="hits">1</span> - - <code class="ruby"> </code> + <code class="ruby"> describe &quot;win_friendly_path&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="15"> <span class="hits">1</span> - <code class="ruby"> describe &quot;wsman_version&quot; do</code> + <code class="ruby"> it &quot;should replace slashes with backslashes&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="16"> <span class="hits">1</span> - <code class="ruby"> it &quot;network_adapters&quot; do</code> + <code class="ruby"> @dummy.win_friendly_path('c:/tmp/dir').should eq('c:\\tmp\\dir')</code> </li> - <li class="covered" data-hits="1" data-linenumber="17"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="17"> - <code class="ruby"> nics = @guestnetwork.network_adapters()</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="18"> - <code class="ruby"> #puts nics.pretty_inspect()</code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="19"> + <li class="covered" data-hits="1" data-linenumber="19"> + <span class="hits">1</span> - - <code class="ruby"></code> + <code class="ruby"> it &quot;should prepend c: drive if not drive specified&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="20"> <span class="hits">1</span> - <code class="ruby"> expect(nics.count).to be &gt;= 1</code> + <code class="ruby"> @dummy.win_friendly_path('/tmp/dir').should eq('c:\\tmp\\dir')</code> </li> - <li class="covered" data-hits="1" data-linenumber="21"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="21"> - <code class="ruby"> nic = nics[0]</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="22"> - <code class="ruby"></code> + <code class="ruby"> </code> </li> <li class="covered" data-hits="1" data-linenumber="23"> <span class="hits">1</span> - <code class="ruby"> expect(nic.has_key?(:mac_address)).to be_true</code> + <code class="ruby"> it &quot;should return nil if no path specified&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="24"> <span class="hits">1</span> - <code class="ruby"> expect(nic.has_key?(:net_connection_id)).to be_true</code> + <code class="ruby"> @dummy.win_friendly_path(nil).should be_nil</code> </li> - <li class="covered" data-hits="1" data-linenumber="25"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="25"> - <code class="ruby"> expect(nic.has_key?(:interface_index)).to be_true</code> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="26"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="26"> - <code class="ruby"> expect(nic.has_key?(:index)).to be_true</code> + + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="27"> - <code class="ruby"> </code> + <code class="ruby"> </code> </li> <li class="covered" data-hits="1" data-linenumber="28"> <span class="hits">1</span> - <code class="ruby"> expect(nic[:mac_address]).to match(/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/)</code> + <code class="ruby"> describe &quot;win_friendly_share_id&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="29"> <span class="hits">1</span> - <code class="ruby"> Integer(nic[:interface_index])</code> + <code class="ruby"> it &quot;should use share id if present&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="30"> <span class="hits">1</span> - <code class="ruby"> Integer(nic[:index])</code> + <code class="ruby"> @dummy.win_friendly_share_id('sharename').should eq('sharename')</code> </li> <li class="never" data-hits="" data-linenumber="31"> @@ -7823,198 +8093,390 @@ </li> <li class="covered" data-hits="1" data-linenumber="33"> <span class="hits">1</span> - <code class="ruby"> it &quot;should configure DHCP for adapter&quot; do</code> + <code class="ruby"> it &quot;should use last folder name in guest_path&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="34"> <span class="hits">1</span> - <code class="ruby"> nics = @guestnetwork.network_adapters()</code> + <code class="ruby"> @dummy.win_friendly_share_id('/tmp/folder/sharename').should eq('tmp_folder_sharename')</code> </li> - <li class="covered" data-hits="1" data-linenumber="35"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="35"> - <code class="ruby"> @guestnetwork.configure_dhcp_interface(nics[0][:index], nics[0][:net_connection_id])</code> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="36"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="36"> - <code class="ruby"> expect(@guestnetwork.is_dhcp_enabled(nics[0][:index])).to be_true</code> + + <code class="ruby"></code> </li> <li class="never" data-hits="" data-linenumber="37"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="38"> - <code class="ruby"> </code> + <code class="ruby"> </code> </li> <li class="covered" data-hits="1" data-linenumber="39"> <span class="hits">1</span> - <code class="ruby"> it &quot;should configure static IP for adapter&quot; do</code> + <code class="ruby"> describe &quot;is_vmware&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="40"> <span class="hits">1</span> - <code class="ruby"> nics = @guestnetwork.network_adapters()</code> + <code class="ruby"> it &quot;should be true for vmware_fusion&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="41"> <span class="hits">1</span> - <code class="ruby"> @guestnetwork.configure_static_interface(</code> + <code class="ruby"> machine = stub(:provider_name =&gt; :vmware_fusion)</code> </li> - <li class="never" data-hits="" data-linenumber="42"> + <li class="covered" data-hits="1" data-linenumber="42"> + <span class="hits">1</span> - - <code class="ruby"> nics[1][:index],</code> + <code class="ruby"> expect(@dummy.is_vmware(machine)).to be_true</code> </li> <li class="never" data-hits="" data-linenumber="43"> - <code class="ruby"> nics[1][:net_connection_id],</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="44"> - <code class="ruby"> &quot;192.168.0.121&quot;,</code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="45"> + <li class="covered" data-hits="1" data-linenumber="45"> + <span class="hits">1</span> - - <code class="ruby"> &quot;255.255.255.0&quot;)</code> + <code class="ruby"> it &quot;should be true for vmware_workstation&quot; do</code> </li> - <li class="never" data-hits="" data-linenumber="46"> + <li class="covered" data-hits="1" data-linenumber="46"> + <span class="hits">1</span> - - <code class="ruby"> </code> + <code class="ruby"> machine = stub(:provider_name =&gt; :vmware_workstation)</code> </li> <li class="covered" data-hits="1" data-linenumber="47"> <span class="hits">1</span> - <code class="ruby"> expect(@guestnetwork.is_dhcp_enabled(nics[1][:index])).to be_false</code> + <code class="ruby"> expect(@dummy.is_vmware(machine)).to be_true</code> </li> <li class="never" data-hits="" data-linenumber="48"> - <code class="ruby"> </code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="49"> - <code class="ruby"> # ensure the right IP was set by looking through all the output of ipconfig</code> + <code class="ruby"> </code> </li> <li class="covered" data-hits="1" data-linenumber="50"> <span class="hits">1</span> - <code class="ruby"> ipconfig_out = ''</code> + <code class="ruby"> it &quot;should be false for virtual_box&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="51"> <span class="hits">1</span> - <code class="ruby"> @shell.powershell('ipconfig /all') do |_, line|</code> + <code class="ruby"> machine = stub(:provider_name =&gt; :virtual_box)</code> </li> - <li class="covered" data-hits="3" data-linenumber="52"> - <span class="hits">3</span> + <li class="covered" data-hits="1" data-linenumber="52"> + <span class="hits">1</span> - <code class="ruby"> ipconfig_out = ipconfig_out + &quot;#{line}&quot;</code> + <code class="ruby"> expect(@dummy.is_vmware(machine)).to be_false</code> </li> <li class="never" data-hits="" data-linenumber="53"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="54"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="54"> - <code class="ruby"> expect(ipconfig_out).to include('192.168.0.121')</code> + + <code class="ruby"></code> </li> <li class="never" data-hits="" data-linenumber="55"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> <li class="never" data-hits="" data-linenumber="56"> + <code class="ruby"></code> + </li> + + <li class="never" data-hits="" data-linenumber="57"> + + + <code class="ruby">end</code> + </li> + + </ol> + </pre> +</div> + + <div class="source_table" id="95c59faf2db79996a63e1d2688128ac8dab33b79"> + <div class="header"> + <h3>spec/vagrant-windows/mount_shared_folder_spec.rb</h3> + <h4><span class="green">100.0 %</span> covered</h4> + <div> + <b>17</b> relevant lines. + <span class="green"><b>17</b> lines covered</span> and + <span class="red"><b>0</b> lines missed.</span> + </div> + </div> + + <pre> + <ol> + + <li class="covered" data-hits="1" data-linenumber="1"> + <span class="hits">1</span> + + <code class="ruby">require 'spec_helper'</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="2"> + <span class="hits">1</span> + + <code class="ruby">require 'mocha/api'</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="3"> + <span class="hits">1</span> + + <code class="ruby">require 'vagrant-windows/guest/cap/mount_shared_folder'</code> + </li> + + <li class="never" data-hits="" data-linenumber="4"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="5"> + <span class="hits">1</span> + + <code class="ruby">describe VagrantWindows::Guest::Cap::MountSharedFolder, :unit =&gt; true do</code> + </li> + + <li class="never" data-hits="" data-linenumber="6"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="7"> + <span class="hits">1</span> + + <code class="ruby"> before(:each) do</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="8"> + <span class="hits">2</span> + + <code class="ruby"> @communicator = mock()</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="9"> + <span class="hits">2</span> + + <code class="ruby"> @machine = stub(:communicate =&gt; @communicator)</code> + </li> + + <li class="never" data-hits="" data-linenumber="10"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="11"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="12"> + <span class="hits">1</span> + + <code class="ruby"> describe &quot;mount_virtualbox_shared_folder&quot; do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="13"> + <span class="hits">1</span> + + <code class="ruby"> it &quot;should run script with vbox paths&quot; do</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="14"> + <span class="hits">1</span> + + <code class="ruby"> @communicator.expects(:execute).with do |script, options|</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="15"> + <span class="hits">1</span> + + <code class="ruby"> expect(script).to include(&quot;$VmProviderUncPath = \&quot;\\\\vboxsrv\\vagrant\&quot;&quot;)</code> + </li> + + <li class="never" data-hits="" data-linenumber="16"> + + + <code class="ruby"> end </code> + </li> + + <li class="never" data-hits="" data-linenumber="17"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="18"> + <span class="hits">1</span> + + <code class="ruby"> VagrantWindows::Guest::Cap::MountSharedFolder.mount_virtualbox_shared_folder(</code> + </li> + + <li class="never" data-hits="" data-linenumber="19"> + + + <code class="ruby"> @machine, &quot;vagrant&quot;, &quot;/tmp/vagrant&quot;, {})</code> + </li> + + <li class="never" data-hits="" data-linenumber="20"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="21"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="22"> + + <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="57"> + <li class="covered" data-hits="1" data-linenumber="23"> <span class="hits">1</span> - <code class="ruby"> it &quot;should configure all networks to work mode&quot; do</code> + <code class="ruby"> describe &quot;mount_vmware_shared_folder&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="58"> + <li class="covered" data-hits="1" data-linenumber="24"> <span class="hits">1</span> - <code class="ruby"> @guestnetwork.set_all_networks_to_work()</code> + <code class="ruby"> it &quot;should run script with vmware paths&quot; do</code> </li> - <li class="never" data-hits="" data-linenumber="59"> + <li class="covered" data-hits="1" data-linenumber="25"> + <span class="hits">1</span> + <code class="ruby"> @communicator.expects(:execute).with do |script, options|</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="26"> + <span class="hits">1</span> + <code class="ruby"> expect(script).to include(&quot;$VmProviderUncPath = \&quot;\\\\vmware-host\\Shared Folders\\vagrant\&quot;&quot;)</code> + </li> + + <li class="never" data-hits="" data-linenumber="27"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="28"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="29"> + <span class="hits">1</span> + + <code class="ruby"> VagrantWindows::Guest::Cap::MountSharedFolder.mount_vmware_shared_folder(</code> + </li> + + <li class="never" data-hits="" data-linenumber="30"> + + + <code class="ruby"> @machine, &quot;vagrant&quot;, &quot;/tmp/vagrant&quot;, {})</code> + </li> + + <li class="never" data-hits="" data-linenumber="31"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="60"> + <li class="never" data-hits="" data-linenumber="32"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="61"> + <li class="never" data-hits="" data-linenumber="33"> - <code class="ruby"></code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="62"> + <li class="never" data-hits="" data-linenumber="34"> <code class="ruby">end</code> </li> </ol> </pre> </div> - <div class="source_table" id="13b6aec4445d4eeafa03e964d1e1486037abd7a4"> + <div class="source_table" id="967ff63c080ac973ec82b5efb410383048f559e0"> <div class="header"> - <h3>spec/vagrant-windows/helper_spec.rb</h3> + <h3>spec/vagrant-windows/windows_config_spec.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>29</b> relevant lines. - <span class="green"><b>29</b> lines covered</span> and + <b>15</b> relevant lines. + <span class="green"><b>15</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -8024,357 +8486,561 @@ <span class="hits">1</span> <code class="ruby">require 'spec_helper'</code> </li> - <li class="covered" data-hits="1" data-linenumber="2"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="2"> - <code class="ruby">require 'mocha/api'</code> - </li> - - <li class="never" data-hits="" data-linenumber="3"> - <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="4"> + <li class="covered" data-hits="1" data-linenumber="3"> <span class="hits">1</span> - <code class="ruby">describe VagrantWindows::Helper , :unit =&gt; true do</code> + <code class="ruby">describe VagrantWindows::Config::Windows , :unit =&gt; true do</code> </li> + <li class="covered" data-hits="5" data-linenumber="4"> + <span class="hits">5</span> + + <code class="ruby"> let(:instance) { described_class.new }</code> + </li> + <li class="never" data-hits="" data-linenumber="5"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> class DummyHelper</code> + <code class="ruby"> describe &quot;defaults&quot; do</code> </li> <li class="covered" data-hits="1" data-linenumber="7"> <span class="hits">1</span> - <code class="ruby"> include VagrantWindows::Helper</code> + <code class="ruby"> subject do</code> </li> - <li class="never" data-hits="" data-linenumber="8"> + <li class="covered" data-hits="2" data-linenumber="8"> + <span class="hits">2</span> + <code class="ruby"> instance.tap do |o|</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="9"> + <span class="hits">2</span> - <code class="ruby"> end</code> + <code class="ruby"> o.finalize!</code> </li> - <li class="never" data-hits="" data-linenumber="9"> + <li class="never" data-hits="" data-linenumber="10"> - <code class="ruby"> </code> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="10"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> before(:all) do</code> + + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="11"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> @dummy = DummyHelper.new</code> + + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="12"> + <li class="covered" data-hits="2" data-linenumber="13"> + <span class="hits">2</span> + <code class="ruby"> its(&quot;halt_timeout&quot;) { should == 30 }</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="14"> + <span class="hits">2</span> + <code class="ruby"> its(&quot;halt_check_interval&quot;) { should == 1 }</code> + </li> + + <li class="never" data-hits="" data-linenumber="15"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="13"> + <li class="never" data-hits="" data-linenumber="16"> <code class="ruby"></code> </li> - <li class="covered" data-hits="1" data-linenumber="14"> + <li class="covered" data-hits="1" data-linenumber="17"> <span class="hits">1</span> - <code class="ruby"> describe &quot;win_friendly_path&quot; do</code> + <code class="ruby"> describe &quot;overriding defaults&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="15"> + <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> - <code class="ruby"> it &quot;should replace slashes with backslashes&quot; do</code> + <code class="ruby"> [:halt_timeout, :halt_check_interval].each do |attribute|</code> </li> - <li class="covered" data-hits="1" data-linenumber="16"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="19"> + <span class="hits">2</span> - <code class="ruby"> @dummy.win_friendly_path('c:/tmp/dir').should eq('c:\\tmp\\dir')</code> + <code class="ruby"> it &quot;should not default #{attribute} if overridden&quot; do</code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="covered" data-hits="2" data-linenumber="20"> + <span class="hits">2</span> + <code class="ruby"> instance.send(&quot;#{attribute}=&quot;.to_sym, 10)</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="21"> + <span class="hits">2</span> + <code class="ruby"> instance.finalize!</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="22"> + <span class="hits">2</span> + + <code class="ruby"> instance.send(attribute).should == 10</code> + </li> + + <li class="never" data-hits="" data-linenumber="23"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="24"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="18"> + <li class="never" data-hits="" data-linenumber="25"> - <code class="ruby"> </code> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="19"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="26"> - <code class="ruby"> it &quot;should prepend c: drive if not drive specified&quot; do</code> + + <code class="ruby">end</code> </li> - <li class="covered" data-hits="1" data-linenumber="20"> + </ol> + </pre> +</div> + + <div class="source_table" id="5a677aee80d575d53b9b20a950767cd27c7f2e9e"> + <div class="header"> + <h3>spec/vagrant-windows/winrm_config_spec.rb</h3> + <h4><span class="green">100.0 %</span> covered</h4> + <div> + <b>20</b> relevant lines. + <span class="green"><b>20</b> lines covered</span> and + <span class="red"><b>0</b> lines missed.</span> + </div> + </div> + + <pre> + <ol> + + <li class="covered" data-hits="1" data-linenumber="1"> <span class="hits">1</span> - <code class="ruby"> @dummy.win_friendly_path('/tmp/dir').should eq('c:\\tmp\\dir')</code> + <code class="ruby">require 'spec_helper'</code> </li> - <li class="never" data-hits="" data-linenumber="21"> + <li class="never" data-hits="" data-linenumber="2"> - <code class="ruby"> end</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="22"> + <li class="covered" data-hits="1" data-linenumber="3"> + <span class="hits">1</span> + <code class="ruby">describe VagrantWindows::Config::WinRM, :unit =&gt; true do</code> + </li> + + <li class="covered" data-hits="15" data-linenumber="4"> + <span class="hits">15</span> - <code class="ruby"> </code> + <code class="ruby"> let(:instance) { described_class.new }</code> </li> - <li class="covered" data-hits="1" data-linenumber="23"> + <li class="never" data-hits="" data-linenumber="5"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="6"> <span class="hits">1</span> - <code class="ruby"> it &quot;should return nil if no path specified&quot; do</code> + <code class="ruby"> describe &quot;defaults&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="24"> + <li class="covered" data-hits="1" data-linenumber="7"> <span class="hits">1</span> - <code class="ruby"> @dummy.win_friendly_path(nil).should be_nil</code> + <code class="ruby"> subject do</code> </li> - <li class="never" data-hits="" data-linenumber="25"> + <li class="covered" data-hits="7" data-linenumber="8"> + <span class="hits">7</span> + <code class="ruby"> instance.tap do |o|</code> + </li> + + <li class="covered" data-hits="7" data-linenumber="9"> + <span class="hits">7</span> + <code class="ruby"> o.finalize!</code> + </li> + + <li class="never" data-hits="" data-linenumber="10"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="11"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="26"> + <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> end</code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="27"> + <li class="covered" data-hits="2" data-linenumber="13"> + <span class="hits">2</span> + <code class="ruby"> its(&quot;username&quot;) { should == &quot;vagrant&quot; }</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="14"> + <span class="hits">2</span> - <code class="ruby"> </code> + <code class="ruby"> its(&quot;password&quot;) { should == &quot;vagrant&quot; }</code> </li> - <li class="covered" data-hits="1" data-linenumber="28"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="15"> + <span class="hits">2</span> - <code class="ruby"> describe &quot;win_friendly_share_id&quot; do</code> + <code class="ruby"> its(&quot;host&quot;) { should == nil }</code> </li> - <li class="covered" data-hits="1" data-linenumber="29"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="16"> + <span class="hits">2</span> - <code class="ruby"> it &quot;should use share id if present&quot; do</code> + <code class="ruby"> its(&quot;port&quot;) { should == 5985 }</code> </li> - <li class="covered" data-hits="1" data-linenumber="30"> - <span class="hits">1</span> + <li class="covered" data-hits="2" data-linenumber="17"> + <span class="hits">2</span> - <code class="ruby"> @dummy.win_friendly_share_id('sharename').should eq('sharename')</code> + <code class="ruby"> its(&quot;guest_port&quot;) { should == 5985 }</code> </li> - <li class="never" data-hits="" data-linenumber="31"> + <li class="covered" data-hits="2" data-linenumber="18"> + <span class="hits">2</span> + <code class="ruby"> its(&quot;max_tries&quot;) { should == 20 }</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="19"> + <span class="hits">2</span> - <code class="ruby"> end</code> + <code class="ruby"> its(&quot;timeout&quot;) { should == 1800 }</code> </li> - <li class="never" data-hits="" data-linenumber="32"> + <li class="never" data-hits="" data-linenumber="20"> - <code class="ruby"> </code> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="21"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> - <code class="ruby"> it &quot;should use last folder name in guest_path&quot; do</code> + <code class="ruby"> describe &quot;overriding defaults&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="34"> + <li class="covered" data-hits="1" data-linenumber="23"> <span class="hits">1</span> - <code class="ruby"> @dummy.win_friendly_share_id('/tmp/folder/sharename').should eq('tmp_folder_sharename')</code> + <code class="ruby"> [:username, :password, :host, :port, :guest_port, :max_tries, :timeout].each do |attribute|</code> </li> - <li class="never" data-hits="" data-linenumber="35"> + <li class="covered" data-hits="7" data-linenumber="24"> + <span class="hits">7</span> + <code class="ruby"> it &quot;should not default #{attribute} if overridden&quot; do</code> + </li> + + <li class="covered" data-hits="7" data-linenumber="25"> + <span class="hits">7</span> - <code class="ruby"> end</code> + <code class="ruby"> instance.send(&quot;#{attribute}=&quot;.to_sym, 10)</code> </li> - <li class="never" data-hits="" data-linenumber="36"> + <li class="covered" data-hits="7" data-linenumber="26"> + <span class="hits">7</span> + <code class="ruby"> instance.finalize!</code> + </li> + + <li class="covered" data-hits="7" data-linenumber="27"> + <span class="hits">7</span> - <code class="ruby"></code> + <code class="ruby"> instance.send(attribute).should == 10</code> </li> - <li class="never" data-hits="" data-linenumber="37"> + <li class="never" data-hits="" data-linenumber="28"> + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="29"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="30"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="38"> + <li class="never" data-hits="" data-linenumber="31"> + <code class="ruby">end</code> + </li> + + </ol> + </pre> +</div> + + <div class="source_table" id="844842835a3c9ba296ba1e91954dcd0979df99b4"> + <div class="header"> + <h3>spec/vagrant-windows/winrmcommunicator_spec.rb</h3> + <h4><span class="green">100.0 %</span> covered</h4> + <div> + <b>14</b> relevant lines. + <span class="green"><b>14</b> lines covered</span> and + <span class="red"><b>0</b> lines missed.</span> + </div> + </div> + + <pre> + <ol> + + <li class="covered" data-hits="1" data-linenumber="1"> + <span class="hits">1</span> + + <code class="ruby">require 'spec_helper'</code> + </li> + + <li class="never" data-hits="" data-linenumber="2"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="3"> + <span class="hits">1</span> + + <code class="ruby">describe VagrantWindows::Communication::WinRMCommunicator, :integration =&gt; true do</code> + </li> + + <li class="never" data-hits="" data-linenumber="4"> + + <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="39"> + <li class="covered" data-hits="1" data-linenumber="5"> <span class="hits">1</span> - <code class="ruby"> describe &quot;is_vmware&quot; do</code> + <code class="ruby"> before(:all) do</code> </li> - <li class="covered" data-hits="1" data-linenumber="40"> + <li class="never" data-hits="" data-linenumber="6"> + + + <code class="ruby"> # This test requires you already have a running Windows Server 2008 R2 Vagrant VM</code> + </li> + + <li class="never" data-hits="" data-linenumber="7"> + + + <code class="ruby"> # Not ideal, but you have to start somewhere</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="8"> <span class="hits">1</span> - <code class="ruby"> it &quot;should be true for vmware_fusion&quot; do</code> + <code class="ruby"> @shell = VagrantWindows::Communication::WinRMShell.new(&quot;localhost&quot;, &quot;vagrant&quot;, &quot;vagrant&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="41"> + <li class="covered" data-hits="1" data-linenumber="9"> <span class="hits">1</span> - <code class="ruby"> machine = stub(:provider_name =&gt; :vmware_fusion)</code> + <code class="ruby"> @communicator = VagrantWindows::Communication::WinRMCommunicator.new({})</code> </li> - <li class="covered" data-hits="1" data-linenumber="42"> + <li class="covered" data-hits="1" data-linenumber="10"> <span class="hits">1</span> - <code class="ruby"> expect(@dummy.is_vmware(machine)).to be_true</code> + <code class="ruby"> @communicator.set_winrmshell(@shell)</code> </li> - <li class="never" data-hits="" data-linenumber="43"> + <li class="never" data-hits="" data-linenumber="11"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="44"> + <li class="never" data-hits="" data-linenumber="12"> - <code class="ruby"> </code> + <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="45"> + <li class="covered" data-hits="1" data-linenumber="13"> <span class="hits">1</span> - <code class="ruby"> it &quot;should be true for vmware_workstation&quot; do</code> + <code class="ruby"> describe &quot;execute&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="46"> + <li class="covered" data-hits="1" data-linenumber="14"> <span class="hits">1</span> - <code class="ruby"> machine = stub(:provider_name =&gt; :vmware_workstation)</code> + <code class="ruby"> it &quot;should return 1 when error_check is false&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="47"> + <li class="covered" data-hits="1" data-linenumber="15"> <span class="hits">1</span> - <code class="ruby"> expect(@dummy.is_vmware(machine)).to be_true</code> + <code class="ruby"> expect(@communicator.execute(&quot;exit 1&quot;, { :error_check =&gt; false })).to eq(1)</code> </li> - <li class="never" data-hits="" data-linenumber="48"> + <li class="never" data-hits="" data-linenumber="16"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="49"> + <li class="never" data-hits="" data-linenumber="17"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="50"> + <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> - <code class="ruby"> it &quot;should be false for virtual_box&quot; do</code> + <code class="ruby"> it &quot;should raise WinRMExecutionError when error_check is true&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="51"> + <li class="covered" data-hits="2" data-linenumber="19"> + <span class="hits">2</span> + + <code class="ruby"> expect { @communicator.execute(&quot;exit 1&quot;) }.to raise_error(VagrantWindows::Errors::WinRMExecutionError)</code> + </li> + + <li class="never" data-hits="" data-linenumber="20"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="21"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="22"> <span class="hits">1</span> - <code class="ruby"> machine = stub(:provider_name =&gt; :virtual_box)</code> + <code class="ruby"> it &quot;should raise specified error type when specified and error_check is true&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="52"> + <li class="covered" data-hits="1" data-linenumber="23"> <span class="hits">1</span> - <code class="ruby"> expect(@dummy.is_vmware(machine)).to be_false</code> + <code class="ruby"> opts = { :error_class =&gt; VagrantWindows::Errors::WinRMInvalidShell }</code> </li> - <li class="never" data-hits="" data-linenumber="53"> + <li class="covered" data-hits="2" data-linenumber="24"> + <span class="hits">2</span> - - <code class="ruby"> end</code> + <code class="ruby"> expect { @communicator.execute(&quot;exit 1&quot;, opts) }.to raise_error(VagrantWindows::Errors::WinRMInvalidShell)</code> </li> - <li class="never" data-hits="" data-linenumber="54"> + <li class="never" data-hits="" data-linenumber="25"> - <code class="ruby"></code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="55"> + <li class="never" data-hits="" data-linenumber="26"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="56"> + <li class="never" data-hits="" data-linenumber="27"> <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="57"> + <li class="never" data-hits="" data-linenumber="28"> <code class="ruby">end</code> </li> </ol> </pre> </div> - <div class="source_table" id="95c59faf2db79996a63e1d2688128ac8dab33b79"> + <div class="source_table" id="5bf85486dfa43acdf015a1bc09ffbc798937c5ed"> <div class="header"> - <h3>spec/vagrant-windows/mount_shared_folder_spec.rb</h3> + <h3>spec/vagrant-windows/winrmfinder_spec.rb</h3> <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>17</b> relevant lines. - <span class="green"><b>17</b> lines covered</span> and + <b>24</b> relevant lines. + <span class="green"><b>24</b> lines covered</span> and <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> @@ -8384,20 +9050,20 @@ <span class="hits">1</span> <code class="ruby">require 'spec_helper'</code> </li> - <li class="covered" data-hits="1" data-linenumber="2"> - <span class="hits">1</span> + <li class="never" data-hits="" data-linenumber="2"> - <code class="ruby">require 'mocha/api'</code> + + <code class="ruby"></code> </li> <li class="covered" data-hits="1" data-linenumber="3"> <span class="hits">1</span> - <code class="ruby">require 'vagrant-windows/guest/cap/mount_shared_folder'</code> + <code class="ruby">describe VagrantWindows::Communication::WinRMFinder, :unit =&gt; true do</code> </li> <li class="never" data-hits="" data-linenumber="4"> @@ -8405,199 +9071,259 @@ </li> <li class="covered" data-hits="1" data-linenumber="5"> <span class="hits">1</span> - <code class="ruby">describe VagrantWindows::Guest::Cap::MountSharedFolder, :unit =&gt; true do</code> + <code class="ruby"> before(:each) do</code> </li> - <li class="never" data-hits="" data-linenumber="6"> + <li class="covered" data-hits="3" data-linenumber="6"> + <span class="hits">3</span> + <code class="ruby"> @machine = stub()</code> + </li> + + <li class="covered" data-hits="3" data-linenumber="7"> + <span class="hits">3</span> - <code class="ruby"> </code> + <code class="ruby"> @winrmfinder = VagrantWindows::Communication::WinRMFinder.new(@machine)</code> </li> - <li class="covered" data-hits="1" data-linenumber="7"> + <li class="never" data-hits="" data-linenumber="8"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="9"> + + + <code class="ruby"></code> + </li> + + <li class="covered" data-hits="1" data-linenumber="10"> <span class="hits">1</span> - <code class="ruby"> before(:each) do</code> + <code class="ruby"> describe 'winrm_host_address' do</code> </li> - <li class="covered" data-hits="2" data-linenumber="8"> - <span class="hits">2</span> + <li class="covered" data-hits="1" data-linenumber="11"> + <span class="hits">1</span> - <code class="ruby"> @communicator = mock()</code> + <code class="ruby"> it 'should raise WinRMNotReady exception when ssh_info is nil' do</code> </li> - <li class="covered" data-hits="2" data-linenumber="9"> + <li class="covered" data-hits="1" data-linenumber="12"> + <span class="hits">1</span> + + <code class="ruby"> @machine.stubs(:ssh_info).returns(nil)</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="13"> <span class="hits">2</span> - <code class="ruby"> @machine = stub(:communicate =&gt; @communicator)</code> + <code class="ruby"> expect { @winrmfinder.winrm_host_address() }.to raise_error(VagrantWindows::Errors::WinRMNotReady)</code> </li> - <li class="never" data-hits="" data-linenumber="10"> + <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> end</code> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="11"> + <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"></code> + <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="12"> + <li class="covered" data-hits="1" data-linenumber="16"> <span class="hits">1</span> - <code class="ruby"> describe &quot;mount_virtualbox_shared_folder&quot; do</code> + <code class="ruby"> it 'should return ssh_info host if config host has no value' do</code> </li> - <li class="covered" data-hits="1" data-linenumber="13"> + <li class="never" data-hits="" data-linenumber="17"> + + + <code class="ruby"> # setup the winrm config to return nil for the host (i.e. the default)</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="18"> <span class="hits">1</span> - <code class="ruby"> it &quot;should run script with vbox paths&quot; do</code> + <code class="ruby"> winrm_config = VagrantWindows::Config::WinRM.new()</code> </li> - <li class="covered" data-hits="1" data-linenumber="14"> + <li class="covered" data-hits="1" data-linenumber="19"> <span class="hits">1</span> - <code class="ruby"> @communicator.expects(:execute).with do |script, options|</code> + <code class="ruby"> winrm_config.finalize!()</code> </li> - <li class="covered" data-hits="1" data-linenumber="15"> + <li class="covered" data-hits="1" data-linenumber="20"> <span class="hits">1</span> - <code class="ruby"> expect(script).to include(&quot;$VmProviderUncPath = \&quot;\\\\vboxsrv\\vagrant\&quot;&quot;)</code> + <code class="ruby"> machine_config = stub(:winrm =&gt; winrm_config)</code> </li> - <li class="never" data-hits="" data-linenumber="16"> + <li class="covered" data-hits="1" data-linenumber="21"> + <span class="hits">1</span> + <code class="ruby"> @machine.stubs(:config).returns(machine_config)</code> + </li> + + <li class="never" data-hits="" data-linenumber="22"> - <code class="ruby"> end </code> + + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="never" data-hits="" data-linenumber="23"> - <code class="ruby"></code> + <code class="ruby"> # setup the machine ssh_info to return a 10.0.0.1</code> </li> - <li class="covered" data-hits="1" data-linenumber="18"> + <li class="covered" data-hits="1" data-linenumber="24"> <span class="hits">1</span> - <code class="ruby"> VagrantWindows::Guest::Cap::MountSharedFolder.mount_virtualbox_shared_folder(</code> + <code class="ruby"> @machine.stubs(:ssh_info).returns({ :host =&gt; '10.0.0.1' })</code> </li> - <li class="never" data-hits="" data-linenumber="19"> + <li class="never" data-hits="" data-linenumber="25"> - <code class="ruby"> @machine, &quot;vagrant&quot;, &quot;/tmp/vagrant&quot;, {})</code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="20"> + <li class="covered" data-hits="1" data-linenumber="26"> + <span class="hits">1</span> + <code class="ruby"> expect(@winrmfinder.winrm_host_address()).to eq('10.0.0.1')</code> + </li> + + <li class="never" data-hits="" data-linenumber="27"> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="21"> + <li class="never" data-hits="" data-linenumber="28"> - <code class="ruby"> end</code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="22"> + <li class="covered" data-hits="1" data-linenumber="29"> + <span class="hits">1</span> + <code class="ruby"> it 'should return host config if set (issue 104)' do</code> + </li> + + <li class="never" data-hits="" data-linenumber="30"> - <code class="ruby"> </code> + + <code class="ruby"> # setup the winrm config to return nil for the host (i.e. the default)</code> </li> - <li class="covered" data-hits="1" data-linenumber="23"> + <li class="covered" data-hits="1" data-linenumber="31"> <span class="hits">1</span> - <code class="ruby"> describe &quot;mount_vmware_shared_folder&quot; do</code> + <code class="ruby"> winrm_config = VagrantWindows::Config::WinRM.new()</code> </li> - <li class="covered" data-hits="1" data-linenumber="24"> + <li class="covered" data-hits="1" data-linenumber="32"> <span class="hits">1</span> - <code class="ruby"> it &quot;should run script with vmware paths&quot; do</code> + <code class="ruby"> winrm_config.host = '10.0.0.1'</code> </li> - <li class="covered" data-hits="1" data-linenumber="25"> + <li class="covered" data-hits="1" data-linenumber="33"> <span class="hits">1</span> - <code class="ruby"> @communicator.expects(:execute).with do |script, options|</code> + <code class="ruby"> winrm_config.finalize!()</code> </li> - <li class="covered" data-hits="1" data-linenumber="26"> + <li class="covered" data-hits="1" data-linenumber="34"> <span class="hits">1</span> - <code class="ruby"> expect(script).to include(&quot;$VmProviderUncPath = \&quot;\\\\vmware-host\\Shared Folders\\vagrant\&quot;&quot;)</code> + <code class="ruby"> machine_config = stub(:winrm =&gt; winrm_config)</code> </li> - <li class="never" data-hits="" data-linenumber="27"> + <li class="covered" data-hits="1" data-linenumber="35"> + <span class="hits">1</span> - - <code class="ruby"> end</code> + <code class="ruby"> @machine.stubs(:config).returns(machine_config)</code> </li> - <li class="never" data-hits="" data-linenumber="28"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="29"> + <li class="never" data-hits="" data-linenumber="37"> + + + <code class="ruby"> # setup the machine ssh_info to return a 10.0.0.1</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="38"> <span class="hits">1</span> - <code class="ruby"> VagrantWindows::Guest::Cap::MountSharedFolder.mount_vmware_shared_folder(</code> + <code class="ruby"> @machine.stubs(:ssh_info).returns({ :host =&gt; '127.0.0.1' })</code> </li> - <li class="never" data-hits="" data-linenumber="30"> + <li class="never" data-hits="" data-linenumber="39"> - <code class="ruby"> @machine, &quot;vagrant&quot;, &quot;/tmp/vagrant&quot;, {})</code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="31"> + <li class="covered" data-hits="1" data-linenumber="40"> + <span class="hits">1</span> + <code class="ruby"> expect(@winrmfinder.winrm_host_address()).to eq('10.0.0.1')</code> + </li> + + <li class="never" data-hits="" data-linenumber="41"> + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="32"> + <li class="never" data-hits="" data-linenumber="42"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="33"> + <li class="never" data-hits="" data-linenumber="43"> - <code class="ruby"> </code> + <code class="ruby"></code> </li> - <li class="never" data-hits="" data-linenumber="34"> + <li class="never" data-hits="" data-linenumber="44"> <code class="ruby">end</code> </li> </ol> </pre> </div> - <div class="source_table" id="844842835a3c9ba296ba1e91954dcd0979df99b4"> + <div class="source_table" id="25447093b9cbe29e6009455b5e95c517f212a004"> <div class="header"> - <h3>spec/vagrant-windows/winrmcommunicator_spec.rb</h3> - <h4><span class="green">92.31 %</span> covered</h4> + <h3>spec/vagrant-windows/winrmshell_spec.rb</h3> + <h4><span class="green">100.0 %</span> covered</h4> <div> - <b>13</b> relevant lines. - <span class="green"><b>12</b> lines covered</span> and - <span class="red"><b>1</b> lines missed.</span> + <b>20</b> relevant lines. + <span class="green"><b>20</b> lines covered</span> and + <span class="red"><b>0</b> lines missed.</span> </div> </div> <pre> <ol> @@ -8615,11 +9341,11 @@ </li> <li class="covered" data-hits="1" data-linenumber="3"> <span class="hits">1</span> - <code class="ruby">describe VagrantWindows::Communication::WinRMCommunicator, :integration =&gt; true do</code> + <code class="ruby">describe VagrantWindows::Communication::WinRMShell, :integration =&gt; true do</code> </li> <li class="never" data-hits="" data-linenumber="4"> @@ -8648,112 +9374,190 @@ <span class="hits">1</span> <code class="ruby"> @shell = VagrantWindows::Communication::WinRMShell.new(&quot;localhost&quot;, &quot;vagrant&quot;, &quot;vagrant&quot;)</code> </li> - <li class="covered" data-hits="1" data-linenumber="9"> + <li class="never" data-hits="" data-linenumber="9"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="10"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="11"> <span class="hits">1</span> - <code class="ruby"> @communicator = VagrantWindows::Communication::WinRMCommunicator.new({})</code> + <code class="ruby"> describe &quot;powershell&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="10"> + <li class="covered" data-hits="1" data-linenumber="12"> <span class="hits">1</span> - <code class="ruby"> @communicator.set_winrmshell(@shell)</code> + <code class="ruby"> it &quot;should return exit code of 0&quot; do</code> </li> - <li class="never" data-hits="" data-linenumber="11"> + <li class="covered" data-hits="1" data-linenumber="13"> + <span class="hits">1</span> + <code class="ruby"> expect(@shell.powershell(&quot;exit 0&quot;)[:exitcode]).to eq(0)</code> + </li> + + <li class="never" data-hits="" data-linenumber="14"> - <code class="ruby"> end</code> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="12"> + <li class="never" data-hits="" data-linenumber="15"> - <code class="ruby"> </code> + <code class="ruby"> </code> </li> - <li class="covered" data-hits="1" data-linenumber="13"> + <li class="covered" data-hits="1" data-linenumber="16"> <span class="hits">1</span> - <code class="ruby"> describe &quot;execute&quot; do</code> + <code class="ruby"> it &quot;should return exit code greater than 0&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="14"> + <li class="covered" data-hits="1" data-linenumber="17"> <span class="hits">1</span> - <code class="ruby"> it &quot;should return 1&quot; do</code> + <code class="ruby"> expect(@shell.powershell(&quot;exit 1&quot;)[:exitcode]).to eq(1)</code> </li> - <li class="covered" data-hits="1" data-linenumber="15"> + <li class="never" data-hits="" data-linenumber="18"> + + + <code class="ruby"> end</code> + </li> + + <li class="never" data-hits="" data-linenumber="19"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="20"> <span class="hits">1</span> - <code class="ruby"> expect(@communicator.execute(&quot;exit 1&quot;)).to eq(1)</code> + <code class="ruby"> it &quot;should return stdout&quot; do</code> </li> - <li class="never" data-hits="" data-linenumber="16"> + <li class="covered" data-hits="1" data-linenumber="21"> + <span class="hits">1</span> + <code class="ruby"> result = @shell.powershell(&quot;dir&quot;) do |type, line|</code> + </li> + + <li class="covered" data-hits="4" data-linenumber="22"> + <span class="hits">4</span> + <code class="ruby"> expect(type).to eq(:stdout)</code> + </li> + + <li class="covered" data-hits="4" data-linenumber="23"> + <span class="hits">4</span> + + <code class="ruby"> expect(line.length).to be &gt; 1 </code> + </li> + + <li class="never" data-hits="" data-linenumber="24"> + + + <code class="ruby"> end</code> + </li> + + <li class="covered" data-hits="1" data-linenumber="25"> + <span class="hits">1</span> + + <code class="ruby"> expect(result[:exitcode]).to eq(0)</code> + </li> + + <li class="never" data-hits="" data-linenumber="26"> + + <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="17"> + <li class="never" data-hits="" data-linenumber="27"> - <code class="ruby"> </code> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="18"> + <li class="never" data-hits="" data-linenumber="28"> + + + <code class="ruby"> </code> + </li> + + <li class="covered" data-hits="1" data-linenumber="29"> <span class="hits">1</span> - <code class="ruby"> it &quot;should return 1 with block&quot; do</code> + <code class="ruby"> describe &quot;cmd&quot; do</code> </li> - <li class="covered" data-hits="1" data-linenumber="19"> + <li class="covered" data-hits="1" data-linenumber="30"> <span class="hits">1</span> - <code class="ruby"> exit_code = @communicator.sudo(&quot;exit 1&quot;, {}) do |type, line|</code> + <code class="ruby"> it &quot;should return stdout&quot; do</code> </li> - <li class="missed" data-hits="0" data-linenumber="20"> + <li class="covered" data-hits="1" data-linenumber="31"> + <span class="hits">1</span> + <code class="ruby"> result = @shell.cmd(&quot;dir&quot;) do |type, line|</code> + </li> + + <li class="covered" data-hits="2" data-linenumber="32"> + <span class="hits">2</span> - <code class="ruby"> puts line</code> + <code class="ruby"> expect(type).to eq(:stdout)</code> </li> - <li class="never" data-hits="" data-linenumber="21"> + <li class="covered" data-hits="2" data-linenumber="33"> + <span class="hits">2</span> + <code class="ruby"> expect(line.length).to be &gt; 1 </code> + </li> + + <li class="never" data-hits="" data-linenumber="34"> + <code class="ruby"> end</code> </li> - <li class="covered" data-hits="1" data-linenumber="22"> + <li class="covered" data-hits="1" data-linenumber="35"> <span class="hits">1</span> - <code class="ruby"> expect(exit_code).to eq(1)</code> + <code class="ruby"> expect(result[:exitcode]).to eq(0)</code> </li> - <li class="never" data-hits="" data-linenumber="23"> + <li class="never" data-hits="" data-linenumber="36"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="24"> + <li class="never" data-hits="" data-linenumber="37"> <code class="ruby"> end</code> </li> - <li class="never" data-hits="" data-linenumber="25"> + <li class="never" data-hits="" data-linenumber="38"> - <code class="ruby"></code> + <code class="ruby"> </code> </li> - <li class="never" data-hits="" data-linenumber="26"> + <li class="never" data-hits="" data-linenumber="39"> <code class="ruby">end</code> </li>