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,69 @@
1
+ require 'optparse'
2
+
3
+ require "vagrant/util/safe_puts"
4
+
5
+ module VagrantPlugins
6
+ module CommandWinRM
7
+ class Command < Vagrant.plugin("2", :command)
8
+ include Vagrant::Util::SafePuts
9
+
10
+ def self.synopsis
11
+ "executes commands on a machine via WinRM"
12
+ end
13
+
14
+ def execute
15
+ options = {
16
+ command: [],
17
+ shell: :powershell
18
+ }
19
+
20
+ opts = OptionParser.new do |o|
21
+ o.banner = "Usage: vagrant winrm [options] [name|id]"
22
+ o.separator ""
23
+ o.separator "Options:"
24
+ o.separator ""
25
+
26
+ o.on("-c", "--command COMMAND", "Execute a WinRM command directly") do |c|
27
+ options[:command] << c
28
+ end
29
+
30
+ o.on("-e", "--elevated", "Run with elevated credentials") do |e|
31
+ options[:elevated] = true
32
+ end
33
+
34
+ o.on("-s", "--shell SHELL", [:powershell, :cmd], "Use specified shell (powershell, cmd)") do |s|
35
+ options[:shell] = s
36
+ end
37
+ end
38
+
39
+ argv = parse_options(opts)
40
+ return if !argv
41
+
42
+ with_target_vms(argv, single_target: true) do |machine|
43
+ if machine.config.vm.communicator != :winrm
44
+ raise Vagrant::Errors::WinRMInvalidCommunicator
45
+ end
46
+
47
+ opts = {
48
+ shell: options[:shell],
49
+ elevated: !!options[:elevated]
50
+ }
51
+
52
+ options[:command].each do |cmd|
53
+ begin
54
+ machine.communicate.execute(cmd, opts) do |type, data|
55
+ io = type == :stderr ? $stderr : $stdout
56
+ safe_puts(data, io: io, printer: :print)
57
+ end
58
+ rescue VagrantPlugins::CommunicatorWinRM::Errors::WinRMBadExitStatus
59
+ return 1
60
+ end
61
+ end
62
+ end
63
+
64
+ # Success, exit status 0
65
+ 0
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,17 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module CommandWinRM
5
+ class Plugin < Vagrant.plugin("2")
6
+ name "winrm command"
7
+ description <<-DESC
8
+ The `winrm` command executes commands on a machine via WinRM
9
+ DESC
10
+
11
+ command("winrm") do
12
+ require File.expand_path("../command", __FILE__)
13
+ Command
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,125 @@
1
+ require 'optparse'
2
+ require "vagrant/util/safe_puts"
3
+ require_relative "../../communicators/winrm/helper"
4
+
5
+ module VagrantPlugins
6
+ module CommandWinRMConfig
7
+ class Command < Vagrant.plugin("2", :command)
8
+ include Vagrant::Util::SafePuts
9
+
10
+ def self.synopsis
11
+ "outputs WinRM configuration to connect to the machine"
12
+ end
13
+
14
+ def convert_win_paths(paths)
15
+ paths.map! { |path| Vagrant::Util::Platform.format_windows_path(path, :disable_unc) }
16
+ end
17
+
18
+ def execute
19
+ options = {}
20
+
21
+ opts = OptionParser.new do |o|
22
+ o.banner = "Usage: vagrant winrm-config [options] [name|id]"
23
+ o.separator ""
24
+ o.separator "Options:"
25
+ o.separator ""
26
+
27
+ o.on("--host NAME", "Name the host for the config") do |h|
28
+ options[:host] = h
29
+ end
30
+ end
31
+
32
+ argv = parse_options(opts)
33
+ return if !argv
34
+
35
+ with_target_vms(argv) do |machine|
36
+ winrm_info = CommunicatorWinRM::Helper.winrm_info(machine)
37
+ raise Vagrant::Errors::WinRMNotRead if winrm_info.nil?
38
+
39
+ rdp_info = get_rdp_info(machine) || {}
40
+
41
+ variables = {
42
+ host_key: options[:host] || machine.name || "vagrant",
43
+ rdp_host: rdp_info[:host] || winrm_info[:host],
44
+ rdp_port: rdp_info[:port],
45
+ rdp_user: rdp_info[:username],
46
+ rdp_pass: rdp_info[:password],
47
+ winrm_host: winrm_info[:host],
48
+ winrm_port: winrm_info[:port],
49
+ winrm_user: machine.config.winrm.username,
50
+ winrm_password: machine.config.winrm.password
51
+ }
52
+
53
+ template = "commands/winrm_config/config"
54
+ config = Vagrant::Util::TemplateRenderer.render(template, variables)
55
+ machine.ui.machine("winrm-config", config)
56
+ safe_puts(config)
57
+ safe_puts
58
+ end
59
+
60
+ # Success, exit status 0
61
+ 0
62
+ end
63
+
64
+ protected
65
+
66
+ # Generate RDP information for machine
67
+ #
68
+ # @param [Vagrant::Machine] machine Guest machine
69
+ # @return [Hash, nil]
70
+ def get_rdp_info(machine)
71
+ rdp_info = {}
72
+ if machine.provider.capability?(:rdp_info)
73
+ rdp_info = machine.provider.capability(:rdp_info)
74
+ rdp_info ||= {}
75
+ end
76
+
77
+ ssh_info = machine.ssh_info || {}
78
+
79
+ if !rdp_info[:username]
80
+ username = ssh_info[:username]
81
+ if machine.config.vm.communicator == :winrm
82
+ username = machine.config.winrm.username
83
+ end
84
+ rdp_info[:username] = username
85
+ end
86
+
87
+ if !rdp_info[:password]
88
+ password = ssh_info[:password]
89
+ if machine.config.vm.communicator == :winrm
90
+ password = machine.config.winrm.password
91
+ end
92
+ rdp_info[:password] = password
93
+ end
94
+
95
+ rdp_info[:host] ||= ssh_info[:host]
96
+ rdp_info[:port] ||= machine.config.rdp.port
97
+ rdp_info[:username] ||= machine.config.rdp.username
98
+
99
+ if rdp_info[:host] == "127.0.0.1"
100
+ # We need to find a forwarded port...
101
+ search_port = machine.config.rdp.search_port
102
+ ports = nil
103
+ if machine.provider.capability?(:forwarded_ports)
104
+ ports = machine.provider.capability(:forwarded_ports)
105
+ else
106
+ ports = {}.tap do |result|
107
+ machine.config.vm.networks.each do |type, netopts|
108
+ next if type != :forwarded_port
109
+ next if !netopts[:host]
110
+ result[netopts[:host]] = netopts[:guest]
111
+ end
112
+ end
113
+ end
114
+
115
+ ports = ports.invert
116
+ port = ports[search_port]
117
+ rdp_info[:port] = port
118
+ return nil if !port
119
+ end
120
+
121
+ rdp_info
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,17 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module CommandWinRMConfig
5
+ class Plugin < Vagrant.plugin("2")
6
+ name "winrm-config command"
7
+ description <<-DESC
8
+ The `winrm-config` command dumps WinRM configuration information
9
+ DESC
10
+
11
+ command("winrm-config") do
12
+ require File.expand_path("../command", __FILE__)
13
+ Command
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,77 @@
1
+ module VagrantPlugins
2
+ module GuestBSD
3
+ module Cap
4
+ class FileSystem
5
+ # Create a temporary file or directory on the guest
6
+ #
7
+ # @param [Vagrant::Machine] machine Vagrant guest machine
8
+ # @param [Hash] opts Path options
9
+ # @return [String] path to temporary file or directory
10
+ def self.create_tmp_path(machine, opts)
11
+ template = "vagrant"
12
+ cmd = ["mktemp"]
13
+ if opts[:type] == :directory
14
+ cmd << "-d"
15
+ end
16
+ cmd << "-t"
17
+ cmd << template
18
+ tmp_path = ""
19
+ machine.communicate.execute(cmd.join(" ")) do |type, data|
20
+ if type == :stdout
21
+ tmp_path << data
22
+ end
23
+ end
24
+ tmp_path.strip
25
+ end
26
+
27
+ # Decompress tgz file on guest to given location
28
+ #
29
+ # @param [Vagrant::Machine] machine Vagrant guest machine
30
+ # @param [String] compressed_file Path to compressed file on guest
31
+ # @param [String] destination Path for decompressed files on guest
32
+ def self.decompress_tgz(machine, compressed_file, destination, opts={})
33
+ comm = machine.communicate
34
+ extract_dir = create_tmp_path(machine, type: :directory)
35
+ cmds = []
36
+ if opts[:type] == :directory
37
+ cmds << "mkdir -p '#{destination}'"
38
+ else
39
+ cmds << "mkdir -p '#{File.dirname(destination)}'"
40
+ end
41
+ cmds += [
42
+ "tar -C '#{extract_dir}' -xzf '#{compressed_file}'",
43
+ "mv '#{extract_dir}'/* '#{destination}'",
44
+ "rm -f '#{compressed_file}'",
45
+ "rm -rf '#{extract_dir}'"
46
+ ]
47
+ cmds.each{ |cmd| comm.execute(cmd) }
48
+ true
49
+ end
50
+
51
+ # Decompress zip file on guest to given location
52
+ #
53
+ # @param [Vagrant::Machine] machine Vagrant guest machine
54
+ # @param [String] compressed_file Path to compressed file on guest
55
+ # @param [String] destination Path for decompressed files on guest
56
+ def self.decompress_zip(machine, compressed_file, destination, opts={})
57
+ comm = machine.communicate
58
+ extract_dir = create_tmp_path(machine, type: :directory)
59
+ cmds = []
60
+ if opts[:type] == :directory
61
+ cmds << "mkdir -p '#{destination}'"
62
+ else
63
+ cmds << "mkdir -p '#{File.dirname(destination)}'"
64
+ end
65
+ cmds += [
66
+ "unzip '#{compressed_file}' -d '#{extract_dir}'",
67
+ "mv '#{extract_dir}'/* '#{destination}'",
68
+ "rm -f '#{compressed_file}'",
69
+ "rm -rf '#{extract_dir}'"
70
+ ]
71
+ cmds.each{ |cmd| comm.execute(cmd) }
72
+ true
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -11,6 +11,21 @@ module VagrantPlugins
11
11
  Guest
12
12
  end
13
13
 
14
+ guest_capability(:bsd, :create_tmp_path) do
15
+ require_relative "cap/file_system"
16
+ Cap::FileSystem
17
+ end
18
+
19
+ guest_capability(:bsd, :decompress_tgz) do
20
+ require_relative "cap/file_system"
21
+ Cap::FileSystem
22
+ end
23
+
24
+ guest_capability(:bsd, :decompress_zip) do
25
+ require_relative "cap/file_system"
26
+ Cap::FileSystem
27
+ end
28
+
14
29
  guest_capability(:bsd, :halt) do
15
30
  require_relative "cap/halt"
16
31
  Cap::Halt
@@ -0,0 +1,79 @@
1
+ module VagrantPlugins
2
+ module GuestLinux
3
+ module Cap
4
+ class FileSystem
5
+ # Create a temporary file or directory on the guest
6
+ #
7
+ # @param [Vagrant::Machine] machine Vagrant guest machine
8
+ # @param [Hash] opts Path options
9
+ # @return [String] path to temporary file or directory
10
+ def self.create_tmp_path(machine, opts)
11
+ template = "vagrant-XXXXXX"
12
+ if opts[:extension]
13
+ template << opts[:extension].to_s
14
+ end
15
+ cmd = ["mktemp", "--tmpdir"]
16
+ if opts[:type] == :directory
17
+ cmd << "-d"
18
+ end
19
+ cmd << template
20
+ tmp_path = ""
21
+ machine.communicate.execute(cmd.join(" ")) do |type, data|
22
+ if type == :stdout
23
+ tmp_path << data
24
+ end
25
+ end
26
+ tmp_path.strip
27
+ end
28
+
29
+ # Decompress tgz file on guest to given location
30
+ #
31
+ # @param [Vagrant::Machine] machine Vagrant guest machine
32
+ # @param [String] compressed_file Path to compressed file on guest
33
+ # @param [String] destination Path for decompressed files on guest
34
+ def self.decompress_tgz(machine, compressed_file, destination, opts={})
35
+ comm = machine.communicate
36
+ extract_dir = create_tmp_path(machine, type: :directory)
37
+ cmds = []
38
+ if opts[:type] == :directory
39
+ cmds << "mkdir -p '#{destination}'"
40
+ else
41
+ cmds << "mkdir -p '#{File.dirname(destination)}'"
42
+ end
43
+ cmds += [
44
+ "tar -C '#{extract_dir}' -xzf '#{compressed_file}'",
45
+ "mv '#{extract_dir}'/* '#{destination}'",
46
+ "rm -f '#{compressed_file}'",
47
+ "rm -rf '#{extract_dir}'"
48
+ ]
49
+ cmds.each{ |cmd| comm.execute(cmd) }
50
+ true
51
+ end
52
+
53
+ # Decompress zip file on guest to given location
54
+ #
55
+ # @param [Vagrant::Machine] machine Vagrant guest machine
56
+ # @param [String] compressed_file Path to compressed file on guest
57
+ # @param [String] destination Path for decompressed files on guest
58
+ def self.decompress_zip(machine, compressed_file, destination, opts={})
59
+ comm = machine.communicate
60
+ extract_dir = create_tmp_path(machine, type: :directory)
61
+ cmds = []
62
+ if opts[:type] == :directory
63
+ cmds << "mkdir -p '#{destination}'"
64
+ else
65
+ cmds << "mkdir -p '#{File.dirname(destination)}'"
66
+ end
67
+ cmds += [
68
+ "unzip '#{compressed_file}' -d '#{extract_dir}'",
69
+ "mv '#{extract_dir}'/* '#{destination}'",
70
+ "rm -f '#{compressed_file}'",
71
+ "rm -rf '#{extract_dir}'"
72
+ ]
73
+ cmds.each{ |cmd| comm.execute(cmd) }
74
+ true
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -19,6 +19,7 @@ module VagrantPlugins
19
19
  machine.communicate.sudo("#{path} -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://'") do |type, data|
20
20
  s << data if type == :stdout
21
21
  end
22
+
22
23
  # In some cases net devices may be added to the guest and will not
23
24
  # properly show up when using `ip`. This pulls any device information
24
25
  # that can be found in /proc and adds it to the list of interfaces
@@ -26,7 +27,17 @@ module VagrantPlugins
26
27
  machine.communicate.sudo("cat /proc/net/dev | grep -E '^[a-z0-9 ]+:' | awk '{print $1}' | sed 's/://'", error_check: false) do |type, data|
27
28
  s << data if type == :stdout
28
29
  end
29
- ifaces = s.split("\n")
30
+
31
+ # Collect all loopback interfaces
32
+ los = ""
33
+ machine.communicate.sudo("#{path} -o -0 addr | grep LOOPBACK | awk '{print $2}' | sed 's/://'") do |type, data|
34
+ los << data if type == :stdout
35
+ end
36
+ loifaces = los.split("\n")
37
+ @@logger.debug("loopback interfaces: #{loifaces.inspect}")
38
+
39
+ ifaces = s.split("\n").reject { |x| x.empty? or loifaces.include?(x) }
40
+
30
41
  @@logger.debug("Unsorted list: #{ifaces.inspect}")
31
42
  # Break out integers from strings and sort the arrays to provide
32
43
  # a natural sort for the interface names
@@ -34,7 +45,7 @@ module VagrantPlugins
34
45
  # as expected. This is generally seen with veth* devices, and proper ordering
35
46
  # is currently not required
36
47
  ifaces = ifaces.map do |iface|
37
- iface.scan(/(.+?)(\d+)/).flatten.map do |iface_part|
48
+ iface.scan(/(.+?)(\d+)?/).flatten.map do |iface_part|
38
49
  if iface_part.to_i.to_s == iface_part
39
50
  iface_part.to_i
40
51
  else
@@ -16,6 +16,21 @@ module VagrantPlugins
16
16
  Cap::ChooseAddressableIPAddr
17
17
  end
18
18
 
19
+ guest_capability(:linux, :create_tmp_path) do
20
+ require_relative "cap/file_system"
21
+ Cap::FileSystem
22
+ end
23
+
24
+ guest_capability(:linux, :decompress_tgz) do
25
+ require_relative "cap/file_system"
26
+ Cap::FileSystem
27
+ end
28
+
29
+ guest_capability(:linux, :decompress_zip) do
30
+ require_relative "cap/file_system"
31
+ Cap::FileSystem
32
+ end
33
+
19
34
  guest_capability(:linux, :halt) do
20
35
  require_relative "cap/halt"
21
36
  Cap::Halt
@@ -2,6 +2,9 @@ module VagrantPlugins
2
2
  module GuestRedHat
3
3
  module Cap
4
4
  class ChangeHostName
5
+
6
+ extend Vagrant::Util::GuestInspection::Linux
7
+
5
8
  def self.change_host_name(machine, name)
6
9
  comm = machine.communicate
7
10
 
@@ -10,27 +13,32 @@ module VagrantPlugins
10
13
  comm.sudo <<-EOH.gsub(/^ {14}/, '')
11
14
  # Update sysconfig
12
15
  sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network
13
-
14
16
  # Update DNS
15
17
  sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{basename}\"/' /etc/sysconfig/network-scripts/ifcfg-*
16
-
17
18
  # Set the hostname - use hostnamectl if available
18
19
  echo '#{name}' > /etc/hostname
19
- if command -v hostnamectl; then
20
- hostnamectl set-hostname --static '#{name}'
21
- hostnamectl set-hostname --transient '#{name}'
22
- else
23
- hostname -F /etc/hostname
24
- fi
25
-
26
- # Prepend ourselves to /etc/hosts
27
20
  grep -w '#{name}' /etc/hosts || {
28
21
  sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts
29
22
  }
30
-
31
- # Restart network
32
- service network restart
33
23
  EOH
24
+
25
+ if hostnamectl?(comm)
26
+ comm.sudo("hostnamectl set-hostname --static '#{name}' ; " \
27
+ "hostnamectl set-hostname --transient '#{name}'")
28
+ else
29
+ comm.sudo("hostname -F /etc/hostname")
30
+ end
31
+
32
+ restart_command = "service network restart"
33
+
34
+ if systemd?(comm)
35
+ if systemd_networkd?(comm)
36
+ restart_command = "systemctl restart systemd-networkd.service"
37
+ elsif systemd_controlled?(comm, "NetworkManager.service")
38
+ restart_command = "systemctl restart NetworkManager.service"
39
+ end
40
+ end
41
+ comm.sudo(restart_command)
34
42
  end
35
43
  end
36
44
  end
@@ -0,0 +1,77 @@
1
+ module VagrantPlugins
2
+ module GuestSolaris
3
+ module Cap
4
+ class FileSystem
5
+ # Create a temporary file or directory on the guest
6
+ #
7
+ # @param [Vagrant::Machine] machine Vagrant guest machine
8
+ # @param [Hash] opts Path options
9
+ # @return [String] path to temporary file or directory
10
+ def self.create_tmp_path(machine, opts)
11
+ template = "vagrant-XXXXXX"
12
+ cmd = ["mktemp"]
13
+ if opts[:type] == :directory
14
+ cmd << "-d"
15
+ end
16
+ cmd << "-t"
17
+ cmd << template
18
+ tmp_path = ""
19
+ machine.communicate.execute(cmd.join(" ")) do |type, data|
20
+ if type == :stdout
21
+ tmp_path << data
22
+ end
23
+ end
24
+ tmp_path.strip
25
+ end
26
+
27
+ # Decompress tgz file on guest to given location
28
+ #
29
+ # @param [Vagrant::Machine] machine Vagrant guest machine
30
+ # @param [String] compressed_file Path to compressed file on guest
31
+ # @param [String] destination Path for decompressed files on guest
32
+ def self.decompress_tgz(machine, compressed_file, destination, opts={})
33
+ comm = machine.communicate
34
+ extract_dir = create_tmp_path(machine, type: :directory)
35
+ cmds = []
36
+ if opts[:type] == :directory
37
+ cmds << "mkdir -p '#{destination}'"
38
+ else
39
+ cmds << "mkdir -p '#{File.dirname(destination)}'"
40
+ end
41
+ cmds += [
42
+ "tar xzf '#{compressed_file}' -C '#{extract_dir}'",
43
+ "mv '#{extract_dir}'/* '#{destination}'",
44
+ "rm -f '#{compressed_file}'",
45
+ "rm -rf '#{extract_dir}'"
46
+ ]
47
+ cmds.each{ |cmd| comm.execute(cmd) }
48
+ true
49
+ end
50
+
51
+ # Decompress zip file on guest to given location
52
+ #
53
+ # @param [Vagrant::Machine] machine Vagrant guest machine
54
+ # @param [String] compressed_file Path to compressed file on guest
55
+ # @param [String] destination Path for decompressed files on guest
56
+ def self.decompress_zip(machine, compressed_file, destination, opts={})
57
+ comm = machine.communicate
58
+ extract_dir = create_tmp_path(machine, type: :directory)
59
+ cmds = []
60
+ if opts[:type] == :directory
61
+ cmds << "mkdir -p '#{destination}'"
62
+ else
63
+ cmds << "mkdir -p '#{File.dirname(destination)}'"
64
+ end
65
+ cmds += [
66
+ "unzip '#{compressed_file}' -d '#{extract_dir}'",
67
+ "mv '#{extract_dir}'/* '#{destination}'",
68
+ "rm -f '#{compressed_file}'",
69
+ "rm -rf '#{extract_dir}'"
70
+ ]
71
+ cmds.each{ |cmd| comm.execute(cmd) }
72
+ true
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -16,6 +16,21 @@ module VagrantPlugins
16
16
  Guest
17
17
  end
18
18
 
19
+ guest_capability(:solaris, :create_tmp_path) do
20
+ require_relative "cap/file_system"
21
+ Cap::FileSystem
22
+ end
23
+
24
+ guest_capability(:solaris, :decompress_tgz) do
25
+ require_relative "cap/file_system"
26
+ Cap::FileSystem
27
+ end
28
+
29
+ guest_capability(:solaris, :decompress_zip) do
30
+ require_relative "cap/file_system"
31
+ Cap::FileSystem
32
+ end
33
+
19
34
  guest_capability(:solaris, :change_host_name) do
20
35
  require_relative "cap/change_host_name"
21
36
  Cap::ChangeHostName