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,68 @@
1
+ require 'optparse'
2
+
3
+ module VagrantPlugins
4
+ module CloudCommand
5
+ module VersionCommand
6
+ module Command
7
+ class Delete < Vagrant.plugin("2", :command)
8
+ def execute
9
+ options = {}
10
+
11
+ opts = OptionParser.new do |o|
12
+ o.banner = "Usage: vagrant cloud version delete [options] organization/box-name version"
13
+ o.separator ""
14
+ o.separator "Deletes a version entry on Vagrant Cloud"
15
+ o.separator ""
16
+ o.separator "Options:"
17
+ o.separator ""
18
+ o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
19
+ options[:username] = u
20
+ end
21
+ end
22
+
23
+ # Parse the options
24
+ argv = parse_options(opts)
25
+ return if !argv
26
+ if argv.empty? || argv.length > 2
27
+ raise Vagrant::Errors::CLIInvalidUsage,
28
+ help: opts.help.chomp
29
+ end
30
+
31
+ box = argv.first.split('/', 2)
32
+ org = box[0]
33
+ box_name = box[1]
34
+ version = argv[1]
35
+
36
+ @env.ui.warn(I18n.t("cloud_command.version.delete_warn", version: version, box: argv.first))
37
+ cont = @env.ui.ask(I18n.t("cloud_command.continue"))
38
+ return 1 if cont.strip.downcase != "y"
39
+
40
+ @client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:username])
41
+
42
+ delete_version(org, box_name, version, options, @client.token)
43
+ end
44
+
45
+ def delete_version(org, box_name, box_version, options, access_token)
46
+ org = options[:username] if options[:username]
47
+
48
+ server_url = VagrantPlugins::CloudCommand::Util.api_server_url
49
+ account = VagrantPlugins::CloudCommand::Util.account(org, access_token, server_url)
50
+ box = VagrantCloud::Box.new(account, box_name, nil, nil, nil, access_token)
51
+ version = VagrantCloud::Version.new(box, box_version, nil, nil, access_token)
52
+
53
+ begin
54
+ success = version.delete
55
+ @env.ui.success(I18n.t("cloud_command.version.delete_success", version: box_version, org: org, box_name: box_name))
56
+ return 0
57
+ rescue VagrantCloud::ClientError => e
58
+ @env.ui.error(I18n.t("cloud_command.errors.version.delete_fail", version: box_version, org: org, box_name: box_name))
59
+ @env.ui.error(e)
60
+ return 1
61
+ end
62
+ return 1
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,19 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module CloudCommand
5
+ module VersionCommand
6
+ class Plugin < Vagrant.plugin("2")
7
+ name "vagrant cloud version"
8
+ description <<-DESC
9
+ Version life cycle commands for Vagrant Cloud
10
+ DESC
11
+
12
+ command(:version) do
13
+ require_relative "root"
14
+ Command::Root
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,69 @@
1
+ require 'optparse'
2
+
3
+ module VagrantPlugins
4
+ module CloudCommand
5
+ module VersionCommand
6
+ module Command
7
+ class Release < Vagrant.plugin("2", :command)
8
+ def execute
9
+ options = {}
10
+
11
+ opts = OptionParser.new do |o|
12
+ o.banner = "Usage: vagrant cloud version release [options] organization/box-name version"
13
+ o.separator ""
14
+ o.separator "Releases a version entry on Vagrant Cloud"
15
+ o.separator ""
16
+ o.separator "Options:"
17
+ o.separator ""
18
+ o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
19
+ options[:username] = u
20
+ end
21
+ end
22
+
23
+ # Parse the options
24
+ argv = parse_options(opts)
25
+ return if !argv
26
+ if argv.empty? || argv.length > 2
27
+ raise Vagrant::Errors::CLIInvalidUsage,
28
+ help: opts.help.chomp
29
+ end
30
+
31
+ @env.ui.warn(I18n.t("cloud_command.version.release_warn", version: argv[1], box: argv.first))
32
+ cont = @env.ui.ask(I18n.t("cloud_command.continue"))
33
+ return 1 if cont.strip.downcase != "y"
34
+
35
+ @client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:username])
36
+ box = argv.first.split('/', 2)
37
+ org = box[0]
38
+ box_name = box[1]
39
+ version = argv[1]
40
+
41
+ release_version(org, box_name, version, @client.token, options)
42
+ end
43
+
44
+ def release_version(org, box_name, version, access_token, options)
45
+ org = options[:username] if options[:username]
46
+
47
+ server_url = VagrantPlugins::CloudCommand::Util.api_server_url
48
+ account = VagrantPlugins::CloudCommand::Util.account(org, access_token, server_url)
49
+ box = VagrantCloud::Box.new(account, box_name, nil, nil, nil, access_token)
50
+ version = VagrantCloud::Version.new(box, version, nil, nil, access_token)
51
+
52
+ begin
53
+ success = version.release
54
+ @env.ui.success(I18n.t("cloud_command.version.release_success", version: version, org: org, box_name: box_name))
55
+ success = success.delete_if{|_, v|v.nil?}
56
+ VagrantPlugins::CloudCommand::Util.format_box_results(success, @env)
57
+ return 0
58
+ rescue VagrantCloud::ClientError => e
59
+ @env.ui.error(I18n.t("cloud_command.errors.version.release_fail", version: version, org: org, box_name: box_name))
60
+ @env.ui.error(e)
61
+ return 1
62
+ end
63
+ return 1
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,69 @@
1
+ require 'optparse'
2
+
3
+ module VagrantPlugins
4
+ module CloudCommand
5
+ module VersionCommand
6
+ module Command
7
+ class Revoke < Vagrant.plugin("2", :command)
8
+ def execute
9
+ options = {}
10
+
11
+ opts = OptionParser.new do |o|
12
+ o.banner = "Usage: vagrant cloud version revoke [options] organization/box-name version"
13
+ o.separator ""
14
+ o.separator "Revokes a version entry on Vagrant Cloud"
15
+ o.separator ""
16
+ o.separator "Options:"
17
+ o.separator ""
18
+ o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
19
+ options[:username] = u
20
+ end
21
+ end
22
+
23
+ # Parse the options
24
+ argv = parse_options(opts)
25
+ return if !argv
26
+ if argv.empty? || argv.length > 2
27
+ raise Vagrant::Errors::CLIInvalidUsage,
28
+ help: opts.help.chomp
29
+ end
30
+
31
+ @env.ui.warn(I18n.t("cloud_command.version.revoke_warn", version: argv[1], box: argv.first))
32
+ cont = @env.ui.ask(I18n.t("cloud_command.continue"))
33
+ return 1 if cont.strip.downcase != "y"
34
+
35
+ @client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:username])
36
+ box = argv.first.split('/', 2)
37
+ org = box[0]
38
+ box_name = box[1]
39
+ version = argv[1]
40
+
41
+ revoke_version(org, box_name, version, @client.token, options)
42
+ end
43
+
44
+ def revoke_version(org, box_name, box_version, access_token, options)
45
+ org = options[:username] if options[:username]
46
+
47
+ server_url = VagrantPlugins::CloudCommand::Util.api_server_url
48
+ account = VagrantPlugins::CloudCommand::Util.account(org, access_token, server_url)
49
+ box = VagrantCloud::Box.new(account, box_name, nil, nil, nil, access_token)
50
+ version = VagrantCloud::Version.new(box, box_version, nil, nil, access_token)
51
+
52
+ begin
53
+ success = version.revoke
54
+ @env.ui.success(I18n.t("cloud_command.version.revoke_success", version: box_version, org: org, box_name: box_name))
55
+ success = success.delete_if{|_, v|v.nil?}
56
+ VagrantPlugins::CloudCommand::Util.format_box_results(success, @env)
57
+ return 0
58
+ rescue VagrantCloud::ClientError => e
59
+ @env.ui.error(I18n.t("cloud_command.errors.version.revoke_fail", version: box_version, org: org, box_name: box_name))
60
+ @env.ui.error(e)
61
+ return 1
62
+ end
63
+ return 1
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,81 @@
1
+ module VagrantPlugins
2
+ module CloudCommand
3
+ module VersionCommand
4
+ module Command
5
+ class Root < Vagrant.plugin("2", :command)
6
+ def self.synopsis
7
+ "Version commands"
8
+ end
9
+
10
+ def initialize(argv, env)
11
+ super
12
+
13
+ @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
14
+ @subcommands = Vagrant::Registry.new
15
+ @subcommands.register(:create) do
16
+ require File.expand_path("../create", __FILE__)
17
+ Command::Create
18
+ end
19
+ @subcommands.register(:delete) do
20
+ require File.expand_path("../delete", __FILE__)
21
+ Command::Delete
22
+ end
23
+ @subcommands.register(:revoke) do
24
+ require File.expand_path("../revoke", __FILE__)
25
+ Command::Revoke
26
+ end
27
+ @subcommands.register(:release) do
28
+ require File.expand_path("../release", __FILE__)
29
+ Command::Release
30
+ end
31
+ @subcommands.register(:update) do
32
+ require File.expand_path("../update", __FILE__)
33
+ Command::Update
34
+ end
35
+ end
36
+
37
+ def execute
38
+ if @main_args.include?("-h") || @main_args.include?("--help")
39
+ # Print the help for all the version commands.
40
+ return help
41
+ end
42
+
43
+ # If we reached this far then we must have a subcommand. If not,
44
+ # then we also just print the help and exit.
45
+ command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
46
+ return help if !command_class || !@sub_command
47
+ @logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
48
+
49
+ # Initialize and execute the command class
50
+ command_class.new(@sub_args, @env).execute
51
+ end
52
+
53
+ # Prints the help out for this command
54
+ def help
55
+ opts = OptionParser.new do |opts|
56
+ opts.banner = "Usage: vagrant cloud version <subcommand> [<args>]"
57
+ opts.separator ""
58
+ opts.separator "For taking various actions against a Vagrant box's version attribute on Vagrant Cloud"
59
+ opts.separator ""
60
+ opts.separator "Available subcommands:"
61
+
62
+ # Add the available subcommands as separators in order to print them
63
+ # out as well.
64
+ keys = []
65
+ @subcommands.each { |key, value| keys << key.to_s }
66
+
67
+ keys.sort.each do |key|
68
+ opts.separator " #{key}"
69
+ end
70
+
71
+ opts.separator ""
72
+ opts.separator "For help on any individual subcommand run `vagrant cloud version <subcommand> -h`"
73
+ end
74
+
75
+ @env.ui.info(opts.help, prefix: false)
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,69 @@
1
+ require 'optparse'
2
+
3
+ module VagrantPlugins
4
+ module CloudCommand
5
+ module VersionCommand
6
+ module Command
7
+ class Update < Vagrant.plugin("2", :command)
8
+ def execute
9
+ options = {}
10
+
11
+ opts = OptionParser.new do |o|
12
+ o.banner = "Usage: vagrant cloud version update [options] organization/box-name version"
13
+ o.separator ""
14
+ o.separator "Updates a version entry on Vagrant Cloud"
15
+ o.separator ""
16
+ o.separator "Options:"
17
+ o.separator ""
18
+
19
+ o.on("-d", "--description DESCRIPTION", "A description for this version") do |d|
20
+ options[:description] = d
21
+ end
22
+ o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
23
+ options[:username] = u
24
+ end
25
+ end
26
+
27
+ # Parse the options
28
+ argv = parse_options(opts)
29
+ return if !argv
30
+ if argv.empty? || argv.length > 2
31
+ raise Vagrant::Errors::CLIInvalidUsage,
32
+ help: opts.help.chomp
33
+ end
34
+
35
+ @client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:username])
36
+ box = argv.first.split('/', 2)
37
+ org = box[0]
38
+ box_name = box[1]
39
+ version = argv[1]
40
+
41
+ update_version(org, box_name, version, @client.token, options)
42
+ end
43
+
44
+ def update_version(org, box_name, box_version, access_token, options)
45
+ org = options[:username] if options[:username]
46
+
47
+ server_url = VagrantPlugins::CloudCommand::Util.api_server_url
48
+ account = VagrantPlugins::CloudCommand::Util.account(org, access_token, server_url)
49
+ box = VagrantCloud::Box.new(account, box_name, nil, nil, nil, access_token)
50
+ version = VagrantCloud::Version.new(box, box_version, nil, options[:description], access_token)
51
+
52
+ begin
53
+ success = version.update
54
+ @env.ui.success(I18n.t("cloud_command.version.update_success", version: box_version, org: org, box_name: box_name))
55
+ success = success.delete_if{|_, v|v.nil?}
56
+ VagrantPlugins::CloudCommand::Util.format_box_results(success, @env)
57
+ return 0
58
+ rescue VagrantCloud::ClientError => e
59
+ @env.ui.error(I18n.t("cloud_command.errors.version.update_fail", version: box_version, org: org, box_name: box_name))
60
+ @env.ui.error(e)
61
+ return 1
62
+ end
63
+ return 1
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -14,7 +14,7 @@ module VagrantPlugins
14
14
  force: false,
15
15
  minimal: false,
16
16
  output: "Vagrantfile",
17
- template: nil
17
+ template: ENV["VAGRANT_DEFAULT_TEMPLATE"]
18
18
  }
19
19
 
20
20
  opts = OptionParser.new do |o|
@@ -12,9 +12,10 @@ module VagrantPlugins
12
12
  DESC
13
13
 
14
14
  command(:login) do
15
- require_relative "command"
15
+ require File.expand_path("../../cloud/auth/login", __FILE__)
16
16
  init!
17
- Command
17
+ $stderr.puts "WARNING: This command has been deprecated in favor of `vagrant cloud auth login`"
18
+ VagrantPlugins::CloudCommand::AuthCommand::Command::Login
18
19
  end
19
20
 
20
21
  action_hook(:cloud_authenticated_boxes, :authenticate_box_url) do |hook|
@@ -26,7 +27,7 @@ module VagrantPlugins
26
27
 
27
28
  def self.init!
28
29
  return if defined?(@_init)
29
- I18n.load_path << File.expand_path("../locales/en.yml", __FILE__)
30
+ I18n.load_path << File.expand_path("../../cloud/locales/en.yml", __FILE__)
30
31
  I18n.reload!
31
32
  @_init = true
32
33
  end
@@ -16,6 +16,9 @@ module VagrantPlugins
16
16
  opts = OptionParser.new do |o|
17
17
  o.banner = "Usage: vagrant powershell [-- extra powershell args]"
18
18
 
19
+ o.separator ""
20
+ o.separator "Opens a PowerShell session on the host to the guest"
21
+ o.separator "machine if both support powershell remoting."
19
22
  o.separator ""
20
23
  o.separator "Options:"
21
24
  o.separator ""
@@ -22,6 +22,7 @@ module VagrantPlugins
22
22
  def self.init!
23
23
  return if defined?(@_init)
24
24
  I18n.load_path << File.expand_path("templates/locales/command_ps.yml", Vagrant.source_root)
25
+ I18n.load_path << File.expand_path("templates/locales/comm_winrm.yml", Vagrant.source_root)
25
26
  I18n.reload!
26
27
  @_init = true
27
28
  end
@@ -0,0 +1,236 @@
1
+ require 'optparse'
2
+ require "rubygems/package"
3
+
4
+ module VagrantPlugins
5
+ module CommandUpload
6
+ class Command < Vagrant.plugin("2", :command)
7
+
8
+ VALID_COMPRESS_TYPES = [:tgz, :zip].freeze
9
+
10
+ def self.synopsis
11
+ "upload to machine via communicator"
12
+ end
13
+
14
+ def execute
15
+ options = {}
16
+
17
+ opts = OptionParser.new do |o|
18
+ o.banner = "Usage: vagrant upload [options] <source> [destination] [name|id]"
19
+ o.separator ""
20
+ o.separator "Options:"
21
+ o.separator ""
22
+
23
+ o.on("-t", "--temporary", "Upload source to temporary directory") do |t|
24
+ options[:temporary] = t
25
+ end
26
+
27
+ o.on("-c", "--compress", "Use gzip compression for upload") do |c|
28
+ options[:compress] = c
29
+ end
30
+
31
+ o.on("-C", "--compression-type=TYPE", "Type of compression to use (#{VALID_COMPRESS_TYPES.join(", ")})") do |c|
32
+ options[:compression_type] = c.to_sym
33
+ options[:compress] = true
34
+ end
35
+ end
36
+
37
+ argv = parse_options(opts)
38
+ return if !argv
39
+
40
+ case argv.size
41
+ when 3
42
+ source, destination, guest = argv
43
+ when 2, 1
44
+ source = argv[0]
45
+ if @env.active_machines.map(&:first).map(&:to_s).include?(argv[1])
46
+ guest = argv[1]
47
+ else
48
+ destination = argv[1]
49
+ end
50
+ else
51
+ raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp
52
+ end
53
+
54
+ # NOTE: We do this to handle paths on Windows like: "..\space dir\"
55
+ # because the final separater acts to escape the quote and ends up
56
+ # in the source value.
57
+ source = source.sub(/["']$/, "")
58
+ destination ||= File.basename(source)
59
+
60
+ if File.file?(source)
61
+ type = :file
62
+ elsif File.directory?(source)
63
+ type = :directory
64
+ else
65
+ raise Vagrant::Errors::UploadSourceMissing,
66
+ source: source
67
+ end
68
+
69
+ with_target_vms(guest, single_target: true) do |machine|
70
+ if options[:temporary]
71
+ if !machine.guest.capability?(:create_tmp_path)
72
+ raise Vagrant::Errors::UploadMissingTempCapability
73
+ end
74
+ extension = File.extname(source) if type == :file
75
+ destination = machine.guest.capability(:create_tmp_path, type: type, extension: extension)
76
+ end
77
+
78
+ if options[:compress]
79
+ compression_setup!(machine, options)
80
+ @env.ui.info(I18n.t("vagrant.commands.upload.compress",
81
+ source: source,
82
+ type: options[:compression_type]
83
+ ))
84
+ destination_decompressed = destination
85
+ destination = machine.guest.capability(:create_tmp_path, type: :file, extension: ".#{options[:compression_type]}")
86
+ source_display = source
87
+ source = options[:compression_type] == :zip ? compress_source_zip(source) : compress_source_tgz(source)
88
+ end
89
+
90
+ @env.ui.info(I18n.t("vagrant.commands.upload.start",
91
+ source: source,
92
+ destination: destination
93
+ ))
94
+
95
+ # If the source is a directory, attach a `/.` to the end so we
96
+ # upload the contents to the destination instead of within a
97
+ # folder at the destination
98
+ if File.directory?(source) && !source.end_with?(".")
99
+ upload_source = File.join(source, ".")
100
+ else
101
+ upload_source = source
102
+ end
103
+
104
+ machine.communicate.upload(upload_source, destination)
105
+
106
+ if options[:compress]
107
+ @env.ui.info(I18n.t("vagrant.commands.upload.decompress",
108
+ destination: destination_decompressed,
109
+ type: options[:compression_type]
110
+ ))
111
+ machine.guest.capability(options[:decompression_method], destination, destination_decompressed, type: type)
112
+ destination = destination_decompressed
113
+ FileUtils.rm(source)
114
+ source = source_display
115
+ end
116
+ end
117
+
118
+ @env.ui.info(I18n.t("vagrant.commands.upload.complete",
119
+ source: source,
120
+ destination: destination
121
+ ))
122
+
123
+ # Success, exit status 0
124
+ 0
125
+ end
126
+
127
+ # Setup compression options and validate host and guest have capability
128
+ # to handle compression
129
+ #
130
+ # @param [Vagrant::Machine] machine Vagrant guest machine
131
+ # @param [Hash] options Command options
132
+ def compression_setup!(machine, options)
133
+ if !options[:compression_type]
134
+ if machine.guest.capability_host_chain.first[0] == :windows
135
+ options[:compression_type] = :zip
136
+ else
137
+ options[:compression_type] = :tgz
138
+ end
139
+ end
140
+ if !VALID_COMPRESS_TYPES.include?(options[:compression_type])
141
+ raise Vagrant::Errors::UploadInvalidCompressionType,
142
+ type: options[:compression_type],
143
+ valid_types: VALID_COMPRESS_TYPES.join(", ")
144
+ end
145
+ options[:decompression_method] = "decompress_#{options[:compression_type]}".to_sym
146
+ if !machine.guest.capability?(options[:decompression_method])
147
+ raise Vagrant::Errors::UploadMissingExtractCapability,
148
+ type: options[:compression_type]
149
+ end
150
+ end
151
+
152
+ # Compress path using zip into temporary file
153
+ #
154
+ # @param [String] path Path to compress
155
+ # @return [String] path to compressed file
156
+ def compress_source_zip(path)
157
+ require "zip"
158
+ zipfile = Tempfile.create(["vagrant", ".zip"])
159
+ zipfile.close
160
+ if File.file?(path)
161
+ source_items = [path]
162
+ else
163
+ source_items = Dir.glob(File.join(path, "**", "**", "*"))
164
+ end
165
+ c_dir = nil
166
+ Zip::File.open(zipfile.path, Zip::File::CREATE) do |zip|
167
+ source_items.each do |source_item|
168
+ next if File.directory?(source_item)
169
+ trim_item = source_item.sub(path, "").sub(%r{^[/\\]}, "")
170
+ dirname = File.dirname(trim_item)
171
+ zip.mkdir dirname if c_dir != dirname
172
+ c_dir = dirname
173
+ zip.get_output_stream(trim_item) do |f|
174
+ source_file = File.open(source_item, "rb")
175
+ while data = source_file.read(2048)
176
+ f.write(data)
177
+ end
178
+ end
179
+ end
180
+ end
181
+ zipfile.path
182
+ end
183
+
184
+ # Compress path using tar and gzip into temporary file
185
+ #
186
+ # @param [String] path Path to compress
187
+ # @return [String] path to compressed file
188
+ def compress_source_tgz(path)
189
+ tarfile = Tempfile.create(["vagrant", ".tar"])
190
+ tarfile.close
191
+ tarfile = File.open(tarfile.path, "wb+")
192
+ tgzfile = Tempfile.create(["vagrant", ".tgz"])
193
+ tgzfile.close
194
+ tgzfile = File.open(tgzfile.path, "wb")
195
+ tar = Gem::Package::TarWriter.new(tarfile)
196
+ tgz = Zlib::GzipWriter.new(tgzfile)
197
+ if File.file?(path)
198
+ tar.add_file(File.basename(path), File.stat(path).mode) do |io|
199
+ File.open(path, "rb") do |file|
200
+ while bytes = file.read(4096)
201
+ io.write(bytes)
202
+ end
203
+ end
204
+ end
205
+ else
206
+ Dir.glob(File.join(path, "**/**/*")).each do |item|
207
+ rel_path = item.sub(path, "")
208
+ item_mode = File.stat(item).mode
209
+
210
+ if File.directory?(item)
211
+ tar.mkdir(rel_path, item_mode)
212
+ else
213
+ tar.add_file(rel_path, item_mode) do |io|
214
+ File.open(item, "rb") do |file|
215
+ while bytes = file.read(4096)
216
+ io.write(bytes)
217
+ end
218
+ end
219
+ end
220
+ end
221
+ end
222
+ end
223
+ tar.close
224
+ tarfile.rewind
225
+ while bytes = tarfile.read(4096)
226
+ tgz.write bytes
227
+ end
228
+ tgz.close
229
+ tgzfile.close
230
+ tarfile.close
231
+ File.delete(tarfile.path)
232
+ tgzfile.path
233
+ end
234
+ end
235
+ end
236
+ end
@@ -0,0 +1,17 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module CommandUpload
5
+ class Plugin < Vagrant.plugin("2")
6
+ name "upload command"
7
+ description <<-DESC
8
+ The `upload` command uploads files to guest via communicator
9
+ DESC
10
+
11
+ command("upload") do
12
+ require File.expand_path("../command", __FILE__)
13
+ Command
14
+ end
15
+ end
16
+ end
17
+ end