vagrant-unbundled 2.1.4.0 → 2.2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +58 -1
  3. data/Gemfile.lock +9 -5
  4. data/contrib/bash/completion.sh +16 -2
  5. data/contrib/sudoers/osx +1 -1
  6. data/lib/vagrant/environment.rb +16 -21
  7. data/lib/vagrant/errors.rb +28 -0
  8. data/lib/vagrant/machine.rb +1 -1
  9. data/lib/vagrant/plugin/manager.rb +35 -1
  10. data/lib/vagrant/plugin/v2/trigger.rb +23 -0
  11. data/lib/vagrant/util/curl_helper.rb +96 -0
  12. data/lib/vagrant/util/downloader.rb +2 -79
  13. data/lib/vagrant/util/guest_inspection.rb +18 -5
  14. data/lib/vagrant/util/platform.rb +33 -8
  15. data/lib/vagrant/util/uploader.rb +103 -0
  16. data/lib/vagrant/vagrantfile.rb +5 -1
  17. data/lib/vagrant.rb +39 -13
  18. data/plugins/commands/cloud/auth/login.rb +90 -0
  19. data/plugins/commands/cloud/auth/logout.rb +42 -0
  20. data/plugins/commands/cloud/auth/plugin.rb +20 -0
  21. data/plugins/commands/cloud/auth/root.rb +73 -0
  22. data/plugins/commands/cloud/auth/whoami.rb +62 -0
  23. data/plugins/commands/cloud/box/create.rb +75 -0
  24. data/plugins/commands/cloud/box/delete.rb +65 -0
  25. data/plugins/commands/cloud/box/plugin.rb +19 -0
  26. data/plugins/commands/cloud/box/root.rb +77 -0
  27. data/plugins/commands/cloud/box/show.rb +74 -0
  28. data/plugins/commands/cloud/box/update.rb +71 -0
  29. data/plugins/commands/cloud/client/client.rb +264 -0
  30. data/plugins/commands/cloud/errors.rb +28 -0
  31. data/plugins/commands/cloud/list.rb +52 -0
  32. data/plugins/commands/cloud/locales/en.yml +159 -0
  33. data/plugins/commands/cloud/plugin.rb +30 -0
  34. data/plugins/commands/cloud/provider/create.rb +73 -0
  35. data/plugins/commands/cloud/provider/delete.rb +70 -0
  36. data/plugins/commands/cloud/provider/plugin.rb +19 -0
  37. data/plugins/commands/cloud/provider/root.rb +77 -0
  38. data/plugins/commands/cloud/provider/update.rb +73 -0
  39. data/plugins/commands/cloud/provider/upload.rb +75 -0
  40. data/plugins/commands/cloud/publish.rb +165 -0
  41. data/plugins/commands/cloud/root.rb +104 -0
  42. data/plugins/commands/cloud/search.rb +83 -0
  43. data/plugins/commands/cloud/util.rb +206 -0
  44. data/plugins/commands/cloud/version/create.rb +69 -0
  45. data/plugins/commands/cloud/version/delete.rb +68 -0
  46. data/plugins/commands/cloud/version/plugin.rb +19 -0
  47. data/plugins/commands/cloud/version/release.rb +69 -0
  48. data/plugins/commands/cloud/version/revoke.rb +69 -0
  49. data/plugins/commands/cloud/version/root.rb +81 -0
  50. data/plugins/commands/cloud/version/update.rb +69 -0
  51. data/plugins/commands/init/command.rb +1 -1
  52. data/plugins/commands/login/plugin.rb +4 -3
  53. data/plugins/commands/powershell/command.rb +3 -0
  54. data/plugins/commands/powershell/plugin.rb +1 -0
  55. data/plugins/commands/upload/command.rb +236 -0
  56. data/plugins/commands/upload/plugin.rb +17 -0
  57. data/plugins/commands/winrm/command.rb +69 -0
  58. data/plugins/commands/winrm/plugin.rb +17 -0
  59. data/plugins/commands/winrm_config/command.rb +125 -0
  60. data/plugins/commands/winrm_config/plugin.rb +17 -0
  61. data/plugins/guests/bsd/cap/file_system.rb +77 -0
  62. data/plugins/guests/bsd/plugin.rb +15 -0
  63. data/plugins/guests/linux/cap/file_system.rb +79 -0
  64. data/plugins/guests/linux/cap/network_interfaces.rb +13 -2
  65. data/plugins/guests/linux/plugin.rb +15 -0
  66. data/plugins/guests/redhat/cap/change_host_name.rb +21 -13
  67. data/plugins/guests/solaris/cap/file_system.rb +77 -0
  68. data/plugins/guests/solaris/plugin.rb +15 -0
  69. data/plugins/guests/windows/cap/file_system.rb +65 -0
  70. data/plugins/guests/windows/cap/mount_shared_folder.rb +1 -1
  71. data/plugins/guests/windows/plugin.rb +10 -0
  72. data/plugins/kernel_v2/config/vm.rb +3 -0
  73. data/plugins/kernel_v2/config/vm_trigger.rb +49 -1
  74. data/plugins/providers/docker/action/build.rb +23 -8
  75. data/plugins/providers/docker/action/is_build.rb +1 -1
  76. data/plugins/providers/docker/config.rb +50 -10
  77. data/plugins/providers/hyperv/scripts/configure_vm.ps1 +16 -2
  78. data/plugins/providers/virtualbox/action/match_mac_address.rb +8 -5
  79. data/plugins/providers/virtualbox/driver/version_5_0.rb +1 -0
  80. data/plugins/provisioners/ansible/provisioner/guest.rb +2 -8
  81. data/plugins/provisioners/puppet/provisioner/puppet.rb +4 -2
  82. data/plugins/provisioners/salt/bootstrap-salt.sh +1 -1
  83. data/plugins/provisioners/salt/provisioner.rb +19 -4
  84. data/plugins/synced_folders/rsync/helper.rb +2 -1
  85. data/templates/commands/ssh_config/config.erb +1 -1
  86. data/templates/commands/winrm_config/config.erb +11 -0
  87. data/templates/guests/openbsd/network_static6.erb +1 -0
  88. data/templates/locales/en.yml +60 -1
  89. data/templates/locales/providers_docker.yml +11 -3
  90. data/vagrant.gemspec +3 -1
  91. data/vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/vagrant-spec.gemspec +1 -1
  92. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/LICENSE +22 -0
  93. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/README.md +67 -0
  94. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/bin/vagrant_cloud +5 -0
  95. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/account.rb +190 -0
  96. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/box.rb +185 -0
  97. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/client.rb +73 -0
  98. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/errors.rb +25 -0
  99. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/provider.rb +149 -0
  100. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/search.rb +31 -0
  101. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/version.rb +188 -0
  102. data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud.rb +11 -0
  103. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.gitignore +10 -0
  104. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.rubocop.yml +38 -0
  105. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.travis.yml +10 -0
  106. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Gemfile +2 -0
  107. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/LICENSE +202 -0
  108. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/README.md +276 -0
  109. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Rakefile +33 -0
  110. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Vagrantfile +6 -0
  111. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/WinrmAppveyor.psm1 +32 -0
  112. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/appveyor.yml +50 -0
  113. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/bin/rwinrm +90 -0
  114. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/changelog.md +133 -0
  115. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/connection.rb +84 -0
  116. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/connection_opts.rb +90 -0
  117. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/exceptions.rb +88 -0
  118. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/response_handler.rb +127 -0
  119. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/transport.rb +462 -0
  120. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/transport_factory.rb +64 -0
  121. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/output.rb +58 -0
  122. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/create_pipeline.xml.erb +167 -0
  123. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/fragment.rb +68 -0
  124. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/init_runspace_pool.xml.erb +224 -0
  125. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message.rb +128 -0
  126. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/base.rb +47 -0
  127. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/error_record.rb +66 -0
  128. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_host_call.rb +30 -0
  129. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_output.rb +48 -0
  130. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_state.rb +38 -0
  131. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/runspacepool_host_call.rb +30 -0
  132. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/runspacepool_state.rb +37 -0
  133. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/session_capability.rb +34 -0
  134. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data.rb +40 -0
  135. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_defragmenter.rb +62 -0
  136. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_factory.rb +74 -0
  137. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_fragmenter.rb +58 -0
  138. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/powershell_output_decoder.rb +142 -0
  139. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/receive_response_reader.rb +95 -0
  140. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/session_capability.xml.erb +7 -0
  141. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/uuid.rb +39 -0
  142. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/base.rb +187 -0
  143. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/cmd.rb +63 -0
  144. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/power_shell.rb +207 -0
  145. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/retryable.rb +44 -0
  146. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/shell_factory.rb +56 -0
  147. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/version.rb +5 -0
  148. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/base.rb +57 -0
  149. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/cleanup_command.rb +60 -0
  150. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/close_shell.rb +49 -0
  151. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command.rb +100 -0
  152. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command_output.rb +75 -0
  153. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command_output_decoder.rb +54 -0
  154. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/configuration.rb +44 -0
  155. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/create_pipeline.rb +64 -0
  156. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/create_shell.rb +115 -0
  157. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/header.rb +213 -0
  158. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/init_runspace_pool.rb +96 -0
  159. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/iso8601_duration.rb +58 -0
  160. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/keep_alive.rb +66 -0
  161. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/receive_response_reader.rb +128 -0
  162. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/send_data.rb +66 -0
  163. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/soap.rb +49 -0
  164. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/wql_pull.rb +54 -0
  165. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/wql_query.rb +98 -0
  166. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/write_stdin.rb +86 -0
  167. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm.rb +37 -0
  168. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/preamble +17 -0
  169. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/auth_timeout_spec.rb +17 -0
  170. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/cmd_spec.rb +130 -0
  171. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/config-example.yml +16 -0
  172. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/issue_59_spec.rb +25 -0
  173. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/powershell_spec.rb +164 -0
  174. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/spec_helper.rb +62 -0
  175. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/transport_spec.rb +98 -0
  176. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/wql_spec.rb +33 -0
  177. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/matchers.rb +59 -0
  178. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/configuration_spec.rb +183 -0
  179. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/connection_spec.rb +37 -0
  180. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/exception_spec.rb +49 -0
  181. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/http/transport_factory_spec.rb +66 -0
  182. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/http/transport_spec.rb +43 -0
  183. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/output_spec.rb +128 -0
  184. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/fragment_spec.rb +60 -0
  185. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/base_spec.rb +11 -0
  186. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/error_record_spec.rb +39 -0
  187. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_host_call_spec.rb +23 -0
  188. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_output_spec.rb +30 -0
  189. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_state_spec.rb +38 -0
  190. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/runspace_pool_host_call_spec.rb +23 -0
  191. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/runspacepool_state_spec.rb +14 -0
  192. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/session_capability_spec.rb +28 -0
  193. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data_spec.rb +33 -0
  194. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_defragmenter_spec.rb +45 -0
  195. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_fragmenter_spec.rb +103 -0
  196. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/powershell_output_decoder_spec.rb +98 -0
  197. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/psrp_message_spec.rb +73 -0
  198. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/recieve_response_reader_spec.rb +170 -0
  199. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/uuid_spec.rb +28 -0
  200. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/response_handler_spec.rb +69 -0
  201. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/base_spec.rb +227 -0
  202. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/cmd_spec.rb +75 -0
  203. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/powershell_spec.rb +221 -0
  204. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/spec_helper.rb +46 -0
  205. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/clixml/error_record.xml.erb +84 -0
  206. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/clixml/pipeline_state.xml.erb +88 -0
  207. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_command_output_response.xml.erb +13 -0
  208. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_command_output_response_not_done.xml.erb +10 -0
  209. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_command_output_response.xml.erb +23 -0
  210. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_command_output_response_not_done.xml.erb +24 -0
  211. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_config_response.xml +45 -0
  212. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_powershell_keepalive_response.xml.erb +33 -0
  213. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_keepalive_response.xml.erb +10 -0
  214. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_output_response.xml.erb +12 -0
  215. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_output_response_not_done.xml.erb +9 -0
  216. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_omi.xml +43 -0
  217. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_v1.xml +19 -0
  218. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_v2.xml +20 -0
  219. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_omi.xml +31 -0
  220. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_v1.xml +36 -0
  221. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_v2.xml +42 -0
  222. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/wmi_error_v2.xml +41 -0
  223. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/cleanup_command_spec.rb +20 -0
  224. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/close_shell_spec.rb +15 -0
  225. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_output_decoder_spec.rb +35 -0
  226. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_output_spec.rb +43 -0
  227. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_spec.rb +17 -0
  228. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/configuration_spec.rb +15 -0
  229. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/create_pipeline_spec.rb +30 -0
  230. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/create_shell_spec.rb +39 -0
  231. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/init_runspace_pool_spec.rb +38 -0
  232. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/keep_alive_spec.rb +21 -0
  233. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/receive_response_reader_spec.rb +124 -0
  234. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/send_data_spec.rb +30 -0
  235. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/wql_query_spec.rb +11 -0
  236. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/write_stdin_spec.rb +20 -0
  237. data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/winrm.gemspec +46 -0
  238. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.gitignore +11 -0
  239. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rspec +2 -0
  240. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rubocop.yml +17 -0
  241. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rubocop_todo.yml +65 -0
  242. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.travis.yml +10 -0
  243. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Gemfile +4 -0
  244. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/LICENSE +202 -0
  245. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/README.md +82 -0
  246. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Rakefile +27 -0
  247. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/VERSION +1 -0
  248. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Vagrantfile +8 -0
  249. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/appveyor.yml +38 -0
  250. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/bin/rwinrmcp +85 -0
  251. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/changelog.md +74 -0
  252. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/core/file_transporter.rb +566 -0
  253. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/core/tmp_zip.rb +176 -0
  254. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/exceptions.rb +27 -0
  255. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/file_manager.rb +156 -0
  256. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/check_files.ps1.erb +49 -0
  257. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/checksum.ps1.erb +13 -0
  258. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -0
  259. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/delete.ps1.erb +6 -0
  260. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/download.ps1.erb +17 -0
  261. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/exists.ps1.erb +10 -0
  262. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/extract_files.ps1.erb +52 -0
  263. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/scripts.rb +31 -0
  264. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs.rb +27 -0
  265. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/config-example.yml +3 -0
  266. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/integration/file_manager_spec.rb +303 -0
  267. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/integration/tmp_zip_spec.rb +26 -0
  268. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/matchers.rb +57 -0
  269. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/spec_helper.rb +66 -0
  270. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/unit/tmp_zip_spec.rb +78 -0
  271. data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/winrm-fs.gemspec +36 -0
  272. data/vendor/bundle/ruby/2.5.0/specifications/vagrant_cloud-2.0.1.gemspec +45 -0
  273. data/vendor/bundle/ruby/2.5.0/specifications/winrm-2.3.0.gemspec +73 -0
  274. data/vendor/bundle/ruby/2.5.0/specifications/winrm-fs-1.3.1.gemspec +57 -0
  275. data/version.txt +1 -1
  276. metadata +268 -4
@@ -0,0 +1,176 @@
1
+ #
2
+ # Author:: Fletcher (<fnichol@nichol.ca>)
3
+ #
4
+ # Copyright (C) 2015, Fletcher Nichol
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require 'delegate'
19
+ require 'pathname'
20
+ require 'tempfile'
21
+ require 'zip'
22
+
23
+ module WinRM
24
+ module FS
25
+ module Core
26
+ # A temporary Zip file for a given directory.
27
+ #
28
+ # @author Fletcher Nichol <fnichol@nichol.ca>
29
+ class TmpZip
30
+ # Contructs a new Zip file for the given directory.
31
+ #
32
+ # There are 2 ways to interpret the directory path:
33
+ #
34
+ # * If the directory has no path separator terminator, then the
35
+ # directory basename will be used as the base directory in the
36
+ # resulting zip file.
37
+ # * If the directory has a path separator terminator (such as `/` or
38
+ # `\\`), then the entries under the directory will be added to the
39
+ # resulting zip file.
40
+ #
41
+ # The following emaples assume a directory tree structure of:
42
+ #
43
+ # src
44
+ # |-- alpha.txt
45
+ # |-- beta.txt
46
+ # \-- sub
47
+ # \-- charlie.txt
48
+ #
49
+ # @example Including the base directory in the zip file
50
+ #
51
+ # TmpZip.new("/path/to/src")
52
+ # # produces a zip file with entries:
53
+ # # - src/alpha.txt
54
+ # # - src/beta.txt
55
+ # # - src/sub/charlie.txt
56
+ #
57
+ # @example Excluding the base directory in the zip file
58
+ #
59
+ # TmpZip.new("/path/to/src/")
60
+ # # produces a zip file with entries:
61
+ # # - alpha.txt
62
+ # # - beta.txt
63
+ # # - sub/charlie.txt
64
+ #
65
+ # @param dir [String,Pathname,#to_s] path to the directory
66
+ # @param logger [#debug,#debug?] an optional logger/ui object that
67
+ # responds to `#debug` and `#debug?` (default `nil`)
68
+ def initialize(dir, logger = nil)
69
+ @logger = logger || Logging.logger[self]
70
+ @dir = clean_dirname(dir)
71
+ @zip_io = Tempfile.open(['tmpzip-', '.zip'], binmode: true)
72
+ write_zip
73
+ @zip_io.close
74
+ end
75
+
76
+ # @return [Pathname] path to zip file
77
+ def path
78
+ Pathname.new(zip_io.path) if zip_io.path
79
+ end
80
+
81
+ # Unlinks (deletes) the zip file from the filesystem.
82
+ def unlink
83
+ zip_io.unlink
84
+ end
85
+
86
+ private
87
+
88
+ # @return [Pathname] the directory used to create the Zip file
89
+ # @api private
90
+ attr_reader :dir
91
+
92
+ # @return [#debug] the logger
93
+ # @api private
94
+ attr_reader :logger
95
+
96
+ # @return [IO] the Zip file IO
97
+ # @api private
98
+ attr_reader :zip_io
99
+
100
+ # @return [Pathname] the pathname object representing dirname that
101
+ # doesn't have any of those ~ in it
102
+ # @api private
103
+ def clean_dirname(dir)
104
+ paths = Pathname.glob(dir)
105
+ raise "Expected Pathname.glob(dir) to return only dir, got #{paths}" if paths.length != 1
106
+
107
+ paths.first
108
+ end
109
+
110
+ # @return [Array<Pathname] all recursive files under the base
111
+ # directory, excluding directories
112
+ # @api private
113
+ def entries
114
+ Pathname.glob(dir.join('**/*')).delete_if(&:directory?).sort
115
+ end
116
+
117
+ # (see Logging.log_subject)
118
+ # @api private
119
+ def log_subject
120
+ @log_subject ||= [self.class.to_s.split('::').last, path].join('::')
121
+ end
122
+
123
+ # Adds all file entries to the Zip output stream.
124
+ #
125
+ # @param zos [Zip::OutputStream] zip output stream
126
+ # @api private
127
+ def produce_zip_entries(zos)
128
+ entries.each do |entry|
129
+ entry_path = entry.relative_path_from(dir)
130
+ logger.debug "+++ Adding #{entry_path}"
131
+ zos.put_next_entry(
132
+ zip_entry(entry_path),
133
+ nil, nil, ::Zip::Entry::DEFLATED, Zlib::BEST_COMPRESSION
134
+ )
135
+ entry.open('rb') { |src| IO.copy_stream(src, zos) }
136
+ end
137
+ logger.debug '=== All files added.'
138
+ end
139
+
140
+ # Writes out a temporary Zip file.
141
+ #
142
+ # @api private
143
+ def write_zip
144
+ logger.debug 'Populating files'
145
+ Zip::OutputStream.write_buffer(NoDupIO.new(zip_io)) do |zos|
146
+ produce_zip_entries(zos)
147
+ end
148
+ end
149
+
150
+ def zip_entry(entry_path)
151
+ Zip::Entry.new(
152
+ zip_io.path,
153
+ entry_path.to_s,
154
+ nil, nil, nil, nil, nil, nil,
155
+ ::Zip::DOSTime.new(2000)
156
+ )
157
+ end
158
+
159
+ # Simple delegate wrapper to prevent `#dup` calls being made on IO
160
+ # objects. This is used to bypass an issue in the `Zip::Outputstream`
161
+ # constructor where an incoming IO is duplicated, leading to races
162
+ # on flushing the final stream to disk.
163
+ #
164
+ # @author Fletcher Nichol <fnichol@nichol.ca>
165
+ # @api private
166
+ class NoDupIO < SimpleDelegator
167
+ # @return [self] returns self and does *not* return a duplicate
168
+ # object
169
+ def dup
170
+ self
171
+ end
172
+ end
173
+ end
174
+ end
175
+ end
176
+ end
@@ -0,0 +1,27 @@
1
+ #
2
+ # Copyright 2015 Shawn Neal <sneal@sneal.net>
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ module WinRM
17
+ module FS
18
+ # WinRM-FS base class for errors
19
+ class WinRMFSError < StandardError; end
20
+
21
+ # Error that occurs when a file upload fails
22
+ class WinRMUploadError < WinRMFSError; end
23
+
24
+ # Error that occurs when a file download fails
25
+ class WinRMDownloadError < WinRMFSError; end
26
+ end
27
+ end
@@ -0,0 +1,156 @@
1
+ #
2
+ # Copyright 2015 Shawn Neal <sneal@sneal.net>
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require 'winrm'
17
+ require_relative 'scripts/scripts'
18
+ require_relative 'core/file_transporter'
19
+
20
+ module WinRM
21
+ module FS
22
+ # Perform file transfer operations between a local machine and winrm endpoint
23
+ class FileManager
24
+ # Creates a new FileManager instance
25
+ # @param [WinRM::Connection] WinRM web connection client
26
+ def initialize(connection)
27
+ @connection = connection
28
+ @logger = connection.logger
29
+ end
30
+
31
+ # Gets the SHA1 checksum of the specified file if it exists,
32
+ # otherwise ''
33
+ # @param [String] The remote file path
34
+ # @parms [String] The digest method
35
+ def checksum(path, digest = 'SHA1')
36
+ @logger.debug("checksum with #{digest}: #{path}")
37
+ script = WinRM::FS::Scripts.render('checksum', path: path, digest: digest)
38
+ @connection.shell(:powershell) { |e| e.run(script).stdout.chomp }
39
+ end
40
+
41
+ # Create the specifed directory recursively
42
+ # @param [String] The remote dir to create
43
+ # @return [Boolean] True if successful, otherwise false
44
+ def create_dir(path)
45
+ @logger.debug("create_dir: #{path}")
46
+ script = WinRM::FS::Scripts.render('create_dir', path: path)
47
+ @connection.shell(:powershell) { |e| e.run(script).exitcode == 0 }
48
+ end
49
+
50
+ # Deletes the file or directory at the specified path
51
+ # @param [String] The path to remove
52
+ # @return [Boolean] True if successful, otherwise False
53
+ def delete(path)
54
+ @logger.debug("deleting: #{path}")
55
+ script = WinRM::FS::Scripts.render('delete', path: path)
56
+ @connection.shell(:powershell) { |e| e.run(script).exitcode == 0 }
57
+ end
58
+
59
+ # Downloads the specified remote file to the specified local path
60
+ # @param [String] The full path on the remote machine
61
+ # @param [String] The full path to write the file to locally
62
+ # rubocop:disable Metrics/MethodLength
63
+ def download(remote_path, local_path, chunk_size = 1024 * 1024, first = true)
64
+ @logger.debug("downloading: #{remote_path} -> #{local_path} #{chunk_size}")
65
+ index = 0
66
+ output = _output_from_file(remote_path, chunk_size, index)
67
+ return download_dir(remote_path, local_path, chunk_size, first) if output.exitcode == 2
68
+
69
+ return false if output.exitcode >= 1
70
+
71
+ File.open(local_path, 'wb') do |fd|
72
+ out = _write_file(fd, output)
73
+ index += out.length
74
+ until out.empty?
75
+ output = _output_from_file(remote_path, chunk_size, index)
76
+ return false if output.exitcode >= 1
77
+
78
+ out = _write_file(fd, output)
79
+ index += out.length
80
+ end
81
+ end
82
+ true
83
+ end
84
+ # rubocop:enable Metrics/MethodLength
85
+
86
+ def _output_from_file(remote_path, chunk_size, index)
87
+ script = WinRM::FS::Scripts.render('download', path: remote_path, chunk_size: chunk_size, index: index)
88
+ @connection.shell(:powershell) { |e| e.run(script) }
89
+ end
90
+
91
+ def _write_file(tofd, output)
92
+ contents = output.stdout.gsub('\n\r', '')
93
+ out = Base64.decode64(contents)
94
+ out = out[0, out.length - 1] if out.end_with? "\x00"
95
+ return out if out.empty?
96
+
97
+ tofd.write(out)
98
+ out
99
+ end
100
+
101
+ # Checks to see if the given path exists on the target file system.
102
+ # @param [String] The full path to the directory or file
103
+ # @return [Boolean] True if the file/dir exists, otherwise false.
104
+ def exists?(path)
105
+ @logger.debug("exists?: #{path}")
106
+ script = WinRM::FS::Scripts.render('exists', path: path)
107
+ @connection.shell(:powershell) { |e| e.run(script).exitcode == 0 }
108
+ end
109
+
110
+ # Gets the current user's TEMP directory on the remote system, for example
111
+ # 'C:/Windows/Temp'
112
+ # @return [String] Full path to the temp directory
113
+ def temp_dir
114
+ @temp_dir ||= begin
115
+ (@connection.shell(:powershell) { |e| e.run('$env:TEMP') }).stdout.chomp.tr('\\', '/')
116
+ end
117
+ end
118
+
119
+ # Upload one or more local files and directories to a remote directory
120
+ # @example copy a single file to a winrm endpoint
121
+ #
122
+ # file_manager.upload('/Users/sneal/myfile.txt', 'c:/foo/myfile.txt')
123
+ #
124
+ # @example copy a single directory to a winrm endpoint
125
+ #
126
+ # file_manager.upload('c:/dev/my_dir', '$env:AppData')
127
+ #
128
+ # @param [String] A path to a local directory or file that will be copied
129
+ # to the remote Windows box.
130
+ # @param [String] The target directory or file
131
+ # This path may contain powershell style environment variables
132
+ # @yieldparam [Fixnum] Number of bytes copied in current payload sent to the winrm endpoint
133
+ # @yieldparam [Fixnum] The total number of bytes to be copied
134
+ # @yieldparam [String] Path of file being copied
135
+ # @yieldparam [String] Target path on the winrm endpoint
136
+ # @return [Fixnum] The total number of bytes copied
137
+ def upload(local_path, remote_path, &block)
138
+ @connection.shell(:powershell) do |shell|
139
+ file_transporter ||= WinRM::FS::Core::FileTransporter.new(shell)
140
+ file_transporter.upload(local_path, remote_path, &block)[0]
141
+ end
142
+ end
143
+
144
+ private
145
+
146
+ def download_dir(remote_path, local_path, chunk_size, first)
147
+ local_path = File.join(local_path, File.basename(remote_path.to_s)) if first
148
+ FileUtils.mkdir_p(local_path) unless File.directory?(local_path)
149
+ command = "Get-ChildItem #{remote_path} | Select-Object Name"
150
+ @connection.shell(:powershell) { |e| e.run(command) }.stdout.strip.split(/\n/).drop(2).each do |file|
151
+ download(File.join(remote_path.to_s, file.strip), File.join(local_path, file.strip), chunk_size, false)
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,49 @@
1
+ $hash_file = <%= hash_file %>
2
+
3
+ Function Cleanup($disposable) {
4
+ if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) {
5
+ $disposable.Dispose()
6
+ }
7
+ }
8
+
9
+ Function Check-Files($h) {
10
+ return $h.GetEnumerator() | ForEach-Object {
11
+ $dst = Unresolve-Path $_.Value.target
12
+ $dst_changed = $false
13
+ if(Test-Path $dst -PathType Container) {
14
+ $dst_changed = $true
15
+ $dst = Join-Path $dst $_.Value.src_basename
16
+ }
17
+ New-Object psobject -Property @{
18
+ chk_exists = ($exists = Test-Path $dst -PathType Leaf)
19
+ src_sha1 = ($sMd5 = $_.Key)
20
+ dst_sha1 = ($dMd5 = if ($exists) { Get-SHA1Sum $dst } else { $null })
21
+ chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false })
22
+ verifies = if ($dirty -eq $false) { $true } else { $false }
23
+ target_is_folder = $dst_changed
24
+ }
25
+ } | Select-Object -Property chk_exists,src_sha1,dst_sha1,chk_dirty,verifies,target_is_folder
26
+ }
27
+
28
+ Function Get-SHA1Sum($src) {
29
+ Try {
30
+ $c = [System.Security.Cryptography.SHA1]::Create()
31
+ $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
32
+ return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
33
+ }
34
+ Finally {
35
+ Cleanup $c
36
+ Cleanup $in
37
+ }
38
+ }
39
+
40
+ Function Unresolve-Path($path) {
41
+ if ($path -eq $null) {
42
+ return $null
43
+ }
44
+ else {
45
+ return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
46
+ }
47
+ }
48
+
49
+ Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation
@@ -0,0 +1,13 @@
1
+ $p = $ExecutionContext.SessionState.Path
2
+ $path = $p.GetUnresolvedProviderPathFromPSPath("<%= path %>")
3
+
4
+ if (Test-Path $path -PathType Leaf) {
5
+ $cryptoProv = [System.Security.Cryptography.<%= digest %>]::Create()
6
+ $file = [System.IO.File]::Open($path,
7
+ [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read)
8
+ $digest = ([System.BitConverter]::ToString($cryptoProv.ComputeHash($file)))
9
+ $digest = $digest.Replace("-","").ToLower()
10
+ $file.Close()
11
+
12
+ Write-Output $digest
13
+ }
@@ -0,0 +1,6 @@
1
+ $p = $ExecutionContext.SessionState.Path
2
+ $path = $p.GetUnresolvedProviderPathFromPSPath("<%= path %>")
3
+ if (!(Test-Path $path)) {
4
+ New-Item -ItemType Directory -Force -Path $path | Out-Null
5
+ }
6
+ exit 0
@@ -0,0 +1,6 @@
1
+ $p = $ExecutionContext.SessionState.Path
2
+ $path = $p.GetUnresolvedProviderPathFromPSPath("<%= path %>")
3
+ if (Test-Path $path) {
4
+ Remove-Item $path -Force -Recurse
5
+ }
6
+ exit 0
@@ -0,0 +1,17 @@
1
+ $p = $ExecutionContext.SessionState.Path
2
+ $path = $p.GetUnresolvedProviderPathFromPSPath("<%= path %>")
3
+ $index = <%= index %>
4
+ $chunkSize = <%= chunk_size %>
5
+ if (Test-Path $path -PathType Leaf) {
6
+ $file = [System.IO.File]::OpenRead($path)
7
+ $seekedTo = $file.Seek($index, [System.IO.SeekOrigin]::Begin)
8
+ $chunk = New-Object byte[] $chunkSize
9
+ $bytesRead = $file.Read($chunk, 0, $chunkSize)
10
+ $bytes = [System.convert]::ToBase64String($chunk[0..$bytesRead])
11
+ Write-Host $bytes
12
+ exit 0
13
+ }
14
+ ElseIf (Test-Path $path -PathType Container) {
15
+ exit 2
16
+ }
17
+ exit 1
@@ -0,0 +1,10 @@
1
+ $p = $ExecutionContext.SessionState.Path
2
+ $path = $p.GetUnresolvedProviderPathFromPSPath("<%= path %>")
3
+ if (Test-Path $path) {
4
+ $true
5
+ exit 0
6
+ }
7
+ else {
8
+ $false
9
+ exit 1
10
+ }
@@ -0,0 +1,52 @@
1
+ trap {
2
+ $e = $_.Exception
3
+ $e.InvocationInfo.ScriptName
4
+ do {
5
+ $e.Message
6
+ $e = $e.InnerException
7
+ } while ($e)
8
+ break
9
+ }
10
+
11
+ function folder($path){
12
+ $path | ? {-not (test-path $_)} | % {$null = mkdir $_}
13
+ }
14
+
15
+ Function Decode-Files($hash) {
16
+ foreach ($key in $hash.keys) {
17
+ $value = $hash[$key]
18
+ $tzip, $dst = $Value["tmpzip"], $Value["dst"]
19
+ if ($tzip) {Unzip-File $tzip $dst}
20
+ New-Object psobject -Property @{dst=$dst;src_sha1=$key;tmpzip=$tzip}
21
+ }
22
+ }
23
+
24
+ Function Unzip-File($src, $dst) {
25
+ $unpack = $src -replace '\.zip'
26
+ $dst_parent = Split-Path -Path $dst -Parent
27
+ if(!(Test-Path $dst_parent)) { $dst = $dst_parent }
28
+ folder $unpack, $dst
29
+ try {
30
+ try{
31
+ [IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack)
32
+ }
33
+ catch {
34
+ Add-Type -AssemblyName System.IO.Compression.FileSystem -ErrorAction Stop
35
+ [IO.Compression.ZipFile]::ExtractToDirectory($src, $unpack)
36
+ }
37
+ }
38
+ catch {
39
+ Try {
40
+ $s = New-Object -ComObject Shell.Application
41
+ ($s.NameSpace($unpack)).CopyHere(($s.NameSpace($src)).Items(), 0x610) | Out-Null
42
+ }
43
+ Finally {
44
+ [void][Runtime.Interopservices.Marshal]::ReleaseComObject($s)
45
+ }
46
+ }
47
+ dir $unpack | cp -dest "$dst/" -force -recurse
48
+ rm $unpack -recurse -force
49
+ }
50
+
51
+ $hash_file = <%= hash_file %>
52
+ Decode-Files $hash_file | ConvertTo-Csv -NoTypeInformation
@@ -0,0 +1,31 @@
1
+ #
2
+ # Copyright 2015 Shawn Neal <sneal@sneal.net>
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require 'erubis'
17
+
18
+ module WinRM
19
+ module FS
20
+ # PS1 scripts
21
+ module Scripts
22
+ def self.render(template, context)
23
+ template_path = File.expand_path(
24
+ "#{File.dirname(__FILE__)}/#{template}.ps1.erb"
25
+ )
26
+ template = File.read(template_path)
27
+ Erubis::Eruby.new(template).result(context)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ #
2
+ # Copyright 2015 Shawn Neal <sneal@sneal.net>
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ require 'winrm'
17
+ require 'logger'
18
+ require 'pathname'
19
+ require_relative 'winrm-fs/exceptions'
20
+ require_relative 'winrm-fs/file_manager'
21
+
22
+ module WinRM
23
+ # WinRM File System
24
+ module FS
25
+ # Top level module code
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ endpoint: "http://localhost:55985/wsman"
2
+ user: vagrant
3
+ password: vagrant