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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +58 -1
- data/Gemfile.lock +9 -5
- data/contrib/bash/completion.sh +16 -2
- data/contrib/sudoers/osx +1 -1
- data/lib/vagrant/environment.rb +16 -21
- data/lib/vagrant/errors.rb +28 -0
- data/lib/vagrant/machine.rb +1 -1
- data/lib/vagrant/plugin/manager.rb +35 -1
- data/lib/vagrant/plugin/v2/trigger.rb +23 -0
- data/lib/vagrant/util/curl_helper.rb +96 -0
- data/lib/vagrant/util/downloader.rb +2 -79
- data/lib/vagrant/util/guest_inspection.rb +18 -5
- data/lib/vagrant/util/platform.rb +33 -8
- data/lib/vagrant/util/uploader.rb +103 -0
- data/lib/vagrant/vagrantfile.rb +5 -1
- data/lib/vagrant.rb +39 -13
- data/plugins/commands/cloud/auth/login.rb +90 -0
- data/plugins/commands/cloud/auth/logout.rb +42 -0
- data/plugins/commands/cloud/auth/plugin.rb +20 -0
- data/plugins/commands/cloud/auth/root.rb +73 -0
- data/plugins/commands/cloud/auth/whoami.rb +62 -0
- data/plugins/commands/cloud/box/create.rb +75 -0
- data/plugins/commands/cloud/box/delete.rb +65 -0
- data/plugins/commands/cloud/box/plugin.rb +19 -0
- data/plugins/commands/cloud/box/root.rb +77 -0
- data/plugins/commands/cloud/box/show.rb +74 -0
- data/plugins/commands/cloud/box/update.rb +71 -0
- data/plugins/commands/cloud/client/client.rb +264 -0
- data/plugins/commands/cloud/errors.rb +28 -0
- data/plugins/commands/cloud/list.rb +52 -0
- data/plugins/commands/cloud/locales/en.yml +159 -0
- data/plugins/commands/cloud/plugin.rb +30 -0
- data/plugins/commands/cloud/provider/create.rb +73 -0
- data/plugins/commands/cloud/provider/delete.rb +70 -0
- data/plugins/commands/cloud/provider/plugin.rb +19 -0
- data/plugins/commands/cloud/provider/root.rb +77 -0
- data/plugins/commands/cloud/provider/update.rb +73 -0
- data/plugins/commands/cloud/provider/upload.rb +75 -0
- data/plugins/commands/cloud/publish.rb +165 -0
- data/plugins/commands/cloud/root.rb +104 -0
- data/plugins/commands/cloud/search.rb +83 -0
- data/plugins/commands/cloud/util.rb +206 -0
- data/plugins/commands/cloud/version/create.rb +69 -0
- data/plugins/commands/cloud/version/delete.rb +68 -0
- data/plugins/commands/cloud/version/plugin.rb +19 -0
- data/plugins/commands/cloud/version/release.rb +69 -0
- data/plugins/commands/cloud/version/revoke.rb +69 -0
- data/plugins/commands/cloud/version/root.rb +81 -0
- data/plugins/commands/cloud/version/update.rb +69 -0
- data/plugins/commands/init/command.rb +1 -1
- data/plugins/commands/login/plugin.rb +4 -3
- data/plugins/commands/powershell/command.rb +3 -0
- data/plugins/commands/powershell/plugin.rb +1 -0
- data/plugins/commands/upload/command.rb +236 -0
- data/plugins/commands/upload/plugin.rb +17 -0
- data/plugins/commands/winrm/command.rb +69 -0
- data/plugins/commands/winrm/plugin.rb +17 -0
- data/plugins/commands/winrm_config/command.rb +125 -0
- data/plugins/commands/winrm_config/plugin.rb +17 -0
- data/plugins/guests/bsd/cap/file_system.rb +77 -0
- data/plugins/guests/bsd/plugin.rb +15 -0
- data/plugins/guests/linux/cap/file_system.rb +79 -0
- data/plugins/guests/linux/cap/network_interfaces.rb +13 -2
- data/plugins/guests/linux/plugin.rb +15 -0
- data/plugins/guests/redhat/cap/change_host_name.rb +21 -13
- data/plugins/guests/solaris/cap/file_system.rb +77 -0
- data/plugins/guests/solaris/plugin.rb +15 -0
- data/plugins/guests/windows/cap/file_system.rb +65 -0
- data/plugins/guests/windows/cap/mount_shared_folder.rb +1 -1
- data/plugins/guests/windows/plugin.rb +10 -0
- data/plugins/kernel_v2/config/vm.rb +3 -0
- data/plugins/kernel_v2/config/vm_trigger.rb +49 -1
- data/plugins/providers/docker/action/build.rb +23 -8
- data/plugins/providers/docker/action/is_build.rb +1 -1
- data/plugins/providers/docker/config.rb +50 -10
- data/plugins/providers/hyperv/scripts/configure_vm.ps1 +16 -2
- data/plugins/providers/virtualbox/action/match_mac_address.rb +8 -5
- data/plugins/providers/virtualbox/driver/version_5_0.rb +1 -0
- data/plugins/provisioners/ansible/provisioner/guest.rb +2 -8
- data/plugins/provisioners/puppet/provisioner/puppet.rb +4 -2
- data/plugins/provisioners/salt/bootstrap-salt.sh +1 -1
- data/plugins/provisioners/salt/provisioner.rb +19 -4
- data/plugins/synced_folders/rsync/helper.rb +2 -1
- data/templates/commands/ssh_config/config.erb +1 -1
- data/templates/commands/winrm_config/config.erb +11 -0
- data/templates/guests/openbsd/network_static6.erb +1 -0
- data/templates/locales/en.yml +60 -1
- data/templates/locales/providers_docker.yml +11 -3
- data/vagrant.gemspec +3 -1
- data/vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-94a9d31ba18b/vagrant-spec.gemspec +1 -1
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/LICENSE +22 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/README.md +67 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/bin/vagrant_cloud +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/account.rb +190 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/box.rb +185 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/client.rb +73 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/errors.rb +25 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/provider.rb +149 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/search.rb +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud/version.rb +188 -0
- data/vendor/bundle/ruby/2.5.0/gems/vagrant_cloud-2.0.1/lib/vagrant_cloud.rb +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.gitignore +10 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.rubocop.yml +38 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/.travis.yml +10 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Gemfile +2 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/LICENSE +202 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/README.md +276 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Rakefile +33 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/Vagrantfile +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/WinrmAppveyor.psm1 +32 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/appveyor.yml +50 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/bin/rwinrm +90 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/changelog.md +133 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/connection.rb +84 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/connection_opts.rb +90 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/exceptions.rb +88 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/response_handler.rb +127 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/transport.rb +462 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/http/transport_factory.rb +64 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/output.rb +58 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/create_pipeline.xml.erb +167 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/fragment.rb +68 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/init_runspace_pool.xml.erb +224 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message.rb +128 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/base.rb +47 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/error_record.rb +66 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_host_call.rb +30 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_output.rb +48 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/pipeline_state.rb +38 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/runspacepool_host_call.rb +30 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/runspacepool_state.rb +37 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data/session_capability.rb +34 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_data.rb +40 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_defragmenter.rb +62 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_factory.rb +74 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/message_fragmenter.rb +58 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/powershell_output_decoder.rb +142 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/receive_response_reader.rb +95 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/session_capability.xml.erb +7 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/psrp/uuid.rb +39 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/base.rb +187 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/cmd.rb +63 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/power_shell.rb +207 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/retryable.rb +44 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/shells/shell_factory.rb +56 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/version.rb +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/base.rb +57 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/cleanup_command.rb +60 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/close_shell.rb +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command.rb +100 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command_output.rb +75 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/command_output_decoder.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/configuration.rb +44 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/create_pipeline.rb +64 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/create_shell.rb +115 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/header.rb +213 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/init_runspace_pool.rb +96 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/iso8601_duration.rb +58 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/keep_alive.rb +66 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/receive_response_reader.rb +128 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/send_data.rb +66 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/soap.rb +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/wql_pull.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/wql_query.rb +98 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm/wsmv/write_stdin.rb +86 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/lib/winrm.rb +37 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/preamble +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/auth_timeout_spec.rb +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/cmd_spec.rb +130 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/config-example.yml +16 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/issue_59_spec.rb +25 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/powershell_spec.rb +164 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/spec_helper.rb +62 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/transport_spec.rb +98 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/integration/wql_spec.rb +33 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/matchers.rb +59 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/configuration_spec.rb +183 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/connection_spec.rb +37 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/exception_spec.rb +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/http/transport_factory_spec.rb +66 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/http/transport_spec.rb +43 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/output_spec.rb +128 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/fragment_spec.rb +60 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/base_spec.rb +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/error_record_spec.rb +39 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_host_call_spec.rb +23 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_output_spec.rb +30 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/pipeline_state_spec.rb +38 -0
- 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
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/runspacepool_state_spec.rb +14 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data/session_capability_spec.rb +28 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_data_spec.rb +33 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_defragmenter_spec.rb +45 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/message_fragmenter_spec.rb +103 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/powershell_output_decoder_spec.rb +98 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/psrp_message_spec.rb +73 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/recieve_response_reader_spec.rb +170 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/psrp/uuid_spec.rb +28 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/response_handler_spec.rb +69 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/base_spec.rb +227 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/cmd_spec.rb +75 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/shells/powershell_spec.rb +221 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/spec_helper.rb +46 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/clixml/error_record.xml.erb +84 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/clixml/pipeline_state.xml.erb +88 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_command_output_response.xml.erb +13 -0
- 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
- 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
- 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
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_omi_config_response.xml +45 -0
- 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
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_keepalive_response.xml.erb +10 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/get_powershell_output_response.xml.erb +12 -0
- 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
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_omi.xml +43 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_v1.xml +19 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/open_shell_v2.xml +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_omi.xml +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_v1.xml +36 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/soap_fault_v2.xml +42 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/stubs/responses/wmi_error_v2.xml +41 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/cleanup_command_spec.rb +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/close_shell_spec.rb +15 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_output_decoder_spec.rb +35 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_output_spec.rb +43 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/command_spec.rb +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/configuration_spec.rb +15 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/create_pipeline_spec.rb +30 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/create_shell_spec.rb +39 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/init_runspace_pool_spec.rb +38 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/keep_alive_spec.rb +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/receive_response_reader_spec.rb +124 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/send_data_spec.rb +30 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/wql_query_spec.rb +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/tests/spec/wsmv/write_stdin_spec.rb +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-2.3.0/winrm.gemspec +46 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.gitignore +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rspec +2 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rubocop.yml +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.rubocop_todo.yml +65 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/.travis.yml +10 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Gemfile +4 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/LICENSE +202 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/README.md +82 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Rakefile +27 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/VERSION +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/Vagrantfile +8 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/appveyor.yml +38 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/bin/rwinrmcp +85 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/changelog.md +74 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/core/file_transporter.rb +566 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/core/tmp_zip.rb +176 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/exceptions.rb +27 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/file_manager.rb +156 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/check_files.ps1.erb +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/checksum.ps1.erb +13 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/create_dir.ps1.erb +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/delete.ps1.erb +6 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/download.ps1.erb +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/exists.ps1.erb +10 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/extract_files.ps1.erb +52 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs/scripts/scripts.rb +31 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/lib/winrm-fs.rb +27 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/config-example.yml +3 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/integration/file_manager_spec.rb +303 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/integration/tmp_zip_spec.rb +26 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/matchers.rb +57 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/spec_helper.rb +66 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/spec/unit/tmp_zip_spec.rb +78 -0
- data/vendor/bundle/ruby/2.5.0/gems/winrm-fs-1.3.1/winrm-fs.gemspec +36 -0
- data/vendor/bundle/ruby/2.5.0/specifications/vagrant_cloud-2.0.1.gemspec +45 -0
- data/vendor/bundle/ruby/2.5.0/specifications/winrm-2.3.0.gemspec +73 -0
- data/vendor/bundle/ruby/2.5.0/specifications/winrm-fs-1.3.1.gemspec +57 -0
- data/version.txt +1 -1
- metadata +268 -4
@@ -0,0 +1,165 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require "vagrant/util/uploader"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module CloudCommand
|
6
|
+
module Command
|
7
|
+
class Publish < Vagrant.plugin("2", :command)
|
8
|
+
def execute
|
9
|
+
options = {}
|
10
|
+
|
11
|
+
opts = OptionParser.new do |o|
|
12
|
+
o.banner = "Usage: vagrant cloud publish [options] organization/box-name version provider-name [provider-file]"
|
13
|
+
o.separator ""
|
14
|
+
o.separator "Create and release a new Vagrant Box on Vagrant Cloud"
|
15
|
+
o.separator ""
|
16
|
+
o.separator "Options:"
|
17
|
+
o.separator ""
|
18
|
+
|
19
|
+
o.on("--box-version VERSION", String, "Version of box to create") do |v|
|
20
|
+
options[:box_version] = v
|
21
|
+
end
|
22
|
+
o.on("--url URL", String, "Remote URL to download this provider") do |u|
|
23
|
+
options[:url] = u
|
24
|
+
end
|
25
|
+
o.on("-d", "--description DESCRIPTION", String, "Full description of box") do |d|
|
26
|
+
options[:description] = d
|
27
|
+
end
|
28
|
+
o.on("--version-description DESCRIPTION", String, "Description of the version to create") do |v|
|
29
|
+
options[:version_description] = v
|
30
|
+
end
|
31
|
+
o.on("-f", "--force", "Disables confirmation to create or update box") do |f|
|
32
|
+
options[:force] = f
|
33
|
+
end
|
34
|
+
o.on("-p", "--private", "Makes box private") do |p|
|
35
|
+
options[:private] = p
|
36
|
+
end
|
37
|
+
o.on("-r", "--release", "Releases box") do |p|
|
38
|
+
options[:release] = p
|
39
|
+
end
|
40
|
+
o.on("-s", "--short-description DESCRIPTION", String, "Short description of the box") do |s|
|
41
|
+
options[:short_description] = s
|
42
|
+
end
|
43
|
+
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
|
44
|
+
options[:username] = u
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Parse the options
|
49
|
+
argv = parse_options(opts)
|
50
|
+
return if !argv
|
51
|
+
if argv.empty? || argv.length > 4 || argv.length < 3
|
52
|
+
raise Vagrant::Errors::CLIInvalidUsage,
|
53
|
+
help: opts.help.chomp
|
54
|
+
end
|
55
|
+
|
56
|
+
@client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:username])
|
57
|
+
|
58
|
+
box = argv.first.split('/', 2)
|
59
|
+
org = box[0]
|
60
|
+
box_name = box[1]
|
61
|
+
version = argv[1]
|
62
|
+
provider_name = argv[2]
|
63
|
+
box_file = argv[3] # path expand
|
64
|
+
publish_box(org, box_name, version, provider_name, box_file, options, @client.token)
|
65
|
+
end
|
66
|
+
|
67
|
+
def publish_box(org, box_name, version, provider_name, box_file, options, access_token)
|
68
|
+
server_url = VagrantPlugins::CloudCommand::Util.api_server_url
|
69
|
+
|
70
|
+
@env.ui.warn(I18n.t("cloud_command.publish.confirm.warn"))
|
71
|
+
|
72
|
+
@env.ui.info(I18n.t("cloud_command.publish.confirm.box", org: org,
|
73
|
+
box_name: box_name, version: version, provider_name: provider_name))
|
74
|
+
@env.ui.info(I18n.t("cloud_command.publish.confirm.private")) if options[:private]
|
75
|
+
@env.ui.info(I18n.t("cloud_command.publish.confirm.release")) if options[:release]
|
76
|
+
@env.ui.info(I18n.t("cloud_command.publish.confirm.box_url",
|
77
|
+
url: options[:url])) if options[:url]
|
78
|
+
@env.ui.info(I18n.t("cloud_command.publish.confirm.box_description",
|
79
|
+
description: options[:description])) if options[:description]
|
80
|
+
@env.ui.info(I18n.t("cloud_command.publish.confirm.box_short_desc",
|
81
|
+
short_description: options[:short_description])) if options[:short_description]
|
82
|
+
@env.ui.info(I18n.t("cloud_command.publish.confirm.version_desc",
|
83
|
+
version_description: options[:version_description])) if options[:version_description]
|
84
|
+
|
85
|
+
if !options[:force]
|
86
|
+
cont = @env.ui.ask(I18n.t("cloud_command.continue"))
|
87
|
+
return 1 if cont.strip.downcase != "y"
|
88
|
+
end
|
89
|
+
|
90
|
+
account = VagrantPlugins::CloudCommand::Util.account(org, access_token, server_url)
|
91
|
+
box = VagrantCloud::Box.new(account, box_name, nil, options[:short_description], options[:description], access_token)
|
92
|
+
cloud_version = VagrantCloud::Version.new(box, version, nil, options[:version_description], access_token)
|
93
|
+
provider = VagrantCloud::Provider.new(cloud_version, provider_name, nil, options[:url], org, box_name, access_token)
|
94
|
+
|
95
|
+
ui = Vagrant::UI::Prefixed.new(@env.ui, "cloud")
|
96
|
+
|
97
|
+
begin
|
98
|
+
ui.info(I18n.t("cloud_command.publish.box_create"))
|
99
|
+
box.create
|
100
|
+
rescue VagrantCloud::ClientError => e
|
101
|
+
if e.error_code == 422
|
102
|
+
ui.warn(I18n.t("cloud_command.publish.update_continue", obj: "Box"))
|
103
|
+
box.update(options)
|
104
|
+
else
|
105
|
+
@env.ui.error(I18n.t("cloud_command.errors.publish.fail", org: org, box_name: box_name))
|
106
|
+
@env.ui.error(e)
|
107
|
+
return 1
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
begin
|
112
|
+
ui.info(I18n.t("cloud_command.publish.version_create"))
|
113
|
+
cloud_version.create_version
|
114
|
+
rescue VagrantCloud::ClientError => e
|
115
|
+
if e.error_code == 422
|
116
|
+
ui.warn(I18n.t("cloud_command.publish.update_continue", obj: "Version"))
|
117
|
+
cloud_version.update
|
118
|
+
else
|
119
|
+
@env.ui.error(I18n.t("cloud_command.errors.publish.fail", org: org, box_name: box_name))
|
120
|
+
@env.ui.error(e)
|
121
|
+
return 1
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
begin
|
126
|
+
ui.info(I18n.t("cloud_command.publish.provider_create"))
|
127
|
+
provider.create_provider
|
128
|
+
rescue VagrantCloud::ClientError => e
|
129
|
+
if e.error_code == 422
|
130
|
+
ui.warn(I18n.t("cloud_command.publish.update_continue", obj: "Provider"))
|
131
|
+
provider.update
|
132
|
+
else
|
133
|
+
@env.ui.error(I18n.t("cloud_command.errors.publish.fail", org: org, box_name: box_name))
|
134
|
+
@env.ui.error(e)
|
135
|
+
return 1
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
begin
|
140
|
+
if !options[:url]
|
141
|
+
box_file = File.absolute_path(box_file)
|
142
|
+
ui.info(I18n.t("cloud_command.publish.upload_provider", file: box_file))
|
143
|
+
ul = Vagrant::Util::Uploader.new(provider.upload_url, box_file, ui: @env.ui)
|
144
|
+
ul.upload!
|
145
|
+
end
|
146
|
+
if options[:release]
|
147
|
+
ui.info(I18n.t("cloud_command.publish.release"))
|
148
|
+
cloud_version.release
|
149
|
+
end
|
150
|
+
@env.ui.success(I18n.t("cloud_command.publish.complete", org: org, box_name: box_name))
|
151
|
+
success = box.read(org, box_name)
|
152
|
+
success = success.delete_if{|_, v|v.nil?}
|
153
|
+
VagrantPlugins::CloudCommand::Util.format_box_results(success, @env)
|
154
|
+
return 0
|
155
|
+
rescue Vagrant::Errors::UploaderError, VagrantCloud::ClientError => e
|
156
|
+
@env.ui.error(I18n.t("cloud_command.errors.publish.fail", org: org, box_name: box_name))
|
157
|
+
@env.ui.error(e)
|
158
|
+
return 1
|
159
|
+
end
|
160
|
+
return 1
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module CloudCommand
|
3
|
+
module Command
|
4
|
+
class Root < Vagrant.plugin("2", :command)
|
5
|
+
def self.synopsis
|
6
|
+
"manages everything related to Vagrant Cloud"
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(argv, env)
|
10
|
+
super
|
11
|
+
|
12
|
+
@main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
13
|
+
@subcommands = Vagrant::Registry.new
|
14
|
+
@subcommand_helptext = {}
|
15
|
+
|
16
|
+
@subcommands.register(:auth) do
|
17
|
+
require File.expand_path("../auth/root", __FILE__)
|
18
|
+
AuthCommand::Command::Root
|
19
|
+
end
|
20
|
+
@subcommand_helptext[:auth] = "For various authorization operations on Vagrant Cloud"
|
21
|
+
|
22
|
+
@subcommands.register(:box) do
|
23
|
+
require File.expand_path("../box/root", __FILE__)
|
24
|
+
BoxCommand::Command::Root
|
25
|
+
end
|
26
|
+
@subcommand_helptext[:box] = "For managing a Vagrant box entry on Vagrant Cloud"
|
27
|
+
|
28
|
+
# TODO: Uncomment this when API endpoint exists
|
29
|
+
#@subcommands.register(:list) do
|
30
|
+
# require File.expand_path("../list", __FILE__)
|
31
|
+
# List
|
32
|
+
#end
|
33
|
+
#@subcommand_helptext[:list] = "Displays a list of Vagrant boxes that the current user manages"
|
34
|
+
|
35
|
+
@subcommands.register(:search) do
|
36
|
+
require File.expand_path("../search", __FILE__)
|
37
|
+
Search
|
38
|
+
end
|
39
|
+
@subcommand_helptext[:search] = "Search Vagrant Cloud for available boxes"
|
40
|
+
|
41
|
+
@subcommands.register(:provider) do
|
42
|
+
require File.expand_path("../provider/root", __FILE__)
|
43
|
+
ProviderCommand::Command::Root
|
44
|
+
end
|
45
|
+
@subcommand_helptext[:provider] = "For managing a Vagrant box's provider options"
|
46
|
+
|
47
|
+
@subcommands.register(:publish) do
|
48
|
+
require File.expand_path("../publish", __FILE__)
|
49
|
+
Publish
|
50
|
+
end
|
51
|
+
@subcommand_helptext[:publish] = "A complete solution for creating or updating a new box on Vagrant Cloud"
|
52
|
+
|
53
|
+
@subcommands.register(:version) do
|
54
|
+
require File.expand_path("../version/root", __FILE__)
|
55
|
+
VersionCommand::Command::Root
|
56
|
+
end
|
57
|
+
@subcommand_helptext[:version] = "For managing a Vagrant box's versions"
|
58
|
+
end
|
59
|
+
|
60
|
+
def execute
|
61
|
+
if @main_args.include?("-h") || @main_args.include?("--help")
|
62
|
+
# Print the help for all the box commands.
|
63
|
+
return help
|
64
|
+
end
|
65
|
+
|
66
|
+
# If we reached this far then we must have a subcommand. If not,
|
67
|
+
# then we also just print the help and exit.
|
68
|
+
command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
|
69
|
+
return help if !command_class || !@sub_command
|
70
|
+
@logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
|
71
|
+
|
72
|
+
# Initialize and execute the command class
|
73
|
+
command_class.new(@sub_args, @env).execute
|
74
|
+
end
|
75
|
+
|
76
|
+
# Prints the help out for this command
|
77
|
+
def help
|
78
|
+
opts = OptionParser.new do |opts|
|
79
|
+
opts.banner = "Usage: vagrant cloud <subcommand> [<args>]"
|
80
|
+
opts.separator ""
|
81
|
+
opts.separator "The cloud command can be used for taking actions against"
|
82
|
+
opts.separator "Vagrant Cloud like searching or uploading a Vagrant Box"
|
83
|
+
opts.separator ""
|
84
|
+
opts.separator "Available subcommands:"
|
85
|
+
|
86
|
+
# Add the available subcommands as separators in order to print them
|
87
|
+
# out as well.
|
88
|
+
keys = []
|
89
|
+
@subcommands.each { |key, value| keys << key.to_s }
|
90
|
+
|
91
|
+
keys.sort.each do |key|
|
92
|
+
opts.separator " #{key.ljust(15)} #{@subcommand_helptext[key.to_sym]}"
|
93
|
+
end
|
94
|
+
|
95
|
+
opts.separator ""
|
96
|
+
opts.separator "For help on any individual subcommand run `vagrant cloud <subcommand> -h`"
|
97
|
+
end
|
98
|
+
|
99
|
+
@env.ui.info(opts.help, prefix: false)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module CloudCommand
|
5
|
+
module Command
|
6
|
+
class Search < Vagrant.plugin("2", :command)
|
7
|
+
def execute
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
opts = OptionParser.new do |o|
|
11
|
+
o.banner = "Usage: vagrant cloud search [options] query"
|
12
|
+
o.separator ""
|
13
|
+
o.separator "Search for boxes managed by a specific"
|
14
|
+
o.separator "user/organization on Vagrant Cloud"
|
15
|
+
o.separator ""
|
16
|
+
o.separator "Options:"
|
17
|
+
o.separator ""
|
18
|
+
|
19
|
+
o.on("-j", "--json", "Formats results in JSON") do |j|
|
20
|
+
options[:json] = j
|
21
|
+
end
|
22
|
+
o.on("-p", "--page PAGE", Integer, "The page to display Default: 1") do |j|
|
23
|
+
options[:page] = j
|
24
|
+
end
|
25
|
+
o.on("-s", "--short", "Shows a simple list of box names") do |s|
|
26
|
+
options[:short] = s
|
27
|
+
end
|
28
|
+
o.on("-o", "--order ORDER", String, "Order to display results ('desc' or 'asc') Default: 'desc'") do |o|
|
29
|
+
options[:order] = o
|
30
|
+
end
|
31
|
+
o.on("-l", "--limit LIMIT", Integer, "Max number of search results Default: 25") do |l|
|
32
|
+
options[:limit] = l
|
33
|
+
end
|
34
|
+
o.on("-p", "--provider PROVIDER", String, "Filter search results to a single provider. Defaults to all.") do |p|
|
35
|
+
options[:provider] = p
|
36
|
+
end
|
37
|
+
o.on("--sort-by SORT", "Field to sort results on (created, downloads, updated) Default: downloads") do |s|
|
38
|
+
options[:sort] = s
|
39
|
+
end
|
40
|
+
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
|
41
|
+
options[:username] = u
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Parse the options
|
46
|
+
argv = parse_options(opts)
|
47
|
+
return if !argv
|
48
|
+
if argv.length > 1
|
49
|
+
raise Vagrant::Errors::CLIInvalidUsage,
|
50
|
+
help: opts.help.chomp
|
51
|
+
end
|
52
|
+
|
53
|
+
@client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:username])
|
54
|
+
query = argv.first
|
55
|
+
|
56
|
+
options[:limit] = 25 if !(options[:limit].to_i < 1) && !options[:limit]
|
57
|
+
|
58
|
+
search(query, options, @client.token)
|
59
|
+
end
|
60
|
+
|
61
|
+
def search(query, options, access_token)
|
62
|
+
server_url = VagrantPlugins::CloudCommand::Util.api_server_url
|
63
|
+
search = VagrantCloud::Search.new(access_token, server_url)
|
64
|
+
|
65
|
+
begin
|
66
|
+
search_results = search.search(query, options[:provider], options[:sort], options[:order], options[:limit], options[:page])
|
67
|
+
if !search_results["boxes"].empty?
|
68
|
+
VagrantPlugins::CloudCommand::Util.format_search_results(search_results["boxes"], options[:short], options[:json], @env)
|
69
|
+
else
|
70
|
+
@env.ui.warn(I18n.t("cloud_command.search.no_results", query: query))
|
71
|
+
end
|
72
|
+
return 0
|
73
|
+
rescue VagrantCloud::ClientError => e
|
74
|
+
@env.ui.error(I18n.t("cloud_command.errors.search.fail"))
|
75
|
+
@env.ui.error(e)
|
76
|
+
return 1
|
77
|
+
end
|
78
|
+
return 1
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module CloudCommand
|
3
|
+
class Util
|
4
|
+
class << self
|
5
|
+
# @param [String] username - Vagrant Cloud username
|
6
|
+
# @param [String] access_token - Vagrant Cloud Token used to authenticate
|
7
|
+
# @param [String] vagrant_cloud_server - Vagrant Cloud server to make API request
|
8
|
+
# @return [VagrantCloud::Account]
|
9
|
+
def account(username, access_token, vagrant_cloud_server)
|
10
|
+
if !defined?(@_account)
|
11
|
+
@_account = VagrantCloud::Account.new(username, access_token, vagrant_cloud_server)
|
12
|
+
end
|
13
|
+
@_account
|
14
|
+
end
|
15
|
+
|
16
|
+
def api_server_url
|
17
|
+
if Vagrant.server_url == Vagrant::DEFAULT_SERVER_URL
|
18
|
+
return "#{Vagrant.server_url}/api/v1"
|
19
|
+
else
|
20
|
+
return Vagrant.server_url
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param [Vagrant::Environment] env
|
25
|
+
# @param [Hash] options
|
26
|
+
# @returns [VagrantPlugins::CloudCommand::Client]
|
27
|
+
def client_login(env, options)
|
28
|
+
if !defined?(@_client)
|
29
|
+
@_client = Client.new(env)
|
30
|
+
return @_client if @_client.logged_in?
|
31
|
+
|
32
|
+
# Let the user know what is going on.
|
33
|
+
env.ui.output(I18n.t("cloud_command.command_header") + "\n")
|
34
|
+
|
35
|
+
# If it is a private cloud installation, show that
|
36
|
+
if Vagrant.server_url != Vagrant::DEFAULT_SERVER_URL
|
37
|
+
env.ui.output("Vagrant Cloud URL: #{Vagrant.server_url}")
|
38
|
+
end
|
39
|
+
|
40
|
+
options = {} if !options
|
41
|
+
# Ask for the username
|
42
|
+
if options[:login]
|
43
|
+
@_client.username_or_email = options[:login]
|
44
|
+
env.ui.output("Vagrant Cloud username or email: #{@_client.username_or_email}")
|
45
|
+
else
|
46
|
+
@_client.username_or_email = env.ui.ask("Vagrant Cloud username or email: ")
|
47
|
+
end
|
48
|
+
|
49
|
+
@_client.password = env.ui.ask("Password (will be hidden): ", echo: false)
|
50
|
+
|
51
|
+
description_default = "Vagrant login from #{Socket.gethostname}"
|
52
|
+
if !options[:description]
|
53
|
+
description = env.ui.ask("Token description (Defaults to #{description_default.inspect}): ")
|
54
|
+
else
|
55
|
+
description = options[:description]
|
56
|
+
env.ui.output("Token description: #{description}")
|
57
|
+
end
|
58
|
+
|
59
|
+
description = description_default if description.empty?
|
60
|
+
|
61
|
+
code = nil
|
62
|
+
|
63
|
+
begin
|
64
|
+
token = @_client.login(description: description, code: code)
|
65
|
+
rescue Errors::TwoFactorRequired
|
66
|
+
until code
|
67
|
+
code = env.ui.ask("2FA code: ")
|
68
|
+
|
69
|
+
if @_client.two_factor_delivery_methods.include?(code.downcase)
|
70
|
+
delivery_method, code = code, nil
|
71
|
+
@_client.request_code delivery_method
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
retry
|
76
|
+
end
|
77
|
+
|
78
|
+
@_client.store_token(token)
|
79
|
+
Vagrant::Util::CredentialScrubber.sensitive(token)
|
80
|
+
env.ui.success(I18n.t("cloud_command.logged_in"))
|
81
|
+
@_client
|
82
|
+
end
|
83
|
+
@_client
|
84
|
+
end
|
85
|
+
|
86
|
+
# ===================================================
|
87
|
+
# Modified from https://stackoverflow.com/a/28685559
|
88
|
+
# for printing arrays of hashes in formatted tables
|
89
|
+
# ===================================================
|
90
|
+
|
91
|
+
# @param [Vagrant::Environment] - env
|
92
|
+
# @param [Hash] - column_labels - A hash of key values for table labels (i.e. {:col1=>"COL1", :col2=>"COL2"})
|
93
|
+
# @param [Array] - results - An array of hashes
|
94
|
+
# @param [Array] - to_jrust_keys - An array of column keys that should be right justified (default is left justified for all columns)
|
95
|
+
def print_search_table(env, column_labels, results, to_rjust_keys)
|
96
|
+
columns = column_labels.each_with_object({}) { |(col,label),h|
|
97
|
+
h[col] = { label: label,
|
98
|
+
width: [results.map { |g| g[col].size }.max, label.size].max
|
99
|
+
}}
|
100
|
+
|
101
|
+
write_header(env, columns)
|
102
|
+
write_divider(env, columns)
|
103
|
+
results.each { |h| write_line(env, columns, h,to_rjust_keys) }
|
104
|
+
write_divider(env, columns)
|
105
|
+
end
|
106
|
+
|
107
|
+
def write_header(env, columns)
|
108
|
+
env.ui.info "| #{ columns.map { |_,g| g[:label].ljust(g[:width]) }.join(' | ') } |"
|
109
|
+
end
|
110
|
+
|
111
|
+
def write_divider(env, columns)
|
112
|
+
env.ui.info "+-#{ columns.map { |_,g| "-"*g[:width] }.join("-+-") }-+"
|
113
|
+
end
|
114
|
+
|
115
|
+
def write_line(env, columns,h,to_rjust_keys)
|
116
|
+
str = h.keys.map { |k|
|
117
|
+
if to_rjust_keys.include?(k)
|
118
|
+
h[k].rjust(columns[k][:width])
|
119
|
+
else
|
120
|
+
h[k].ljust(columns[k][:width])
|
121
|
+
end
|
122
|
+
}.join(" | ")
|
123
|
+
env.ui.info "| #{str} |"
|
124
|
+
end
|
125
|
+
|
126
|
+
# ===================================================
|
127
|
+
# ===================================================
|
128
|
+
|
129
|
+
# Takes a "mostly" flat key=>value hash from Vagrant Cloud
|
130
|
+
# and prints its results in a list
|
131
|
+
#
|
132
|
+
# @param [Hash] - results - A response hash from vagrant cloud
|
133
|
+
# @param [Vagrant::Environment] - env
|
134
|
+
def format_box_results(results, env)
|
135
|
+
# TODO: remove other description fields? Maybe leave "short"?
|
136
|
+
results.delete("description_html")
|
137
|
+
|
138
|
+
if results["current_version"]
|
139
|
+
versions = results.delete("versions")
|
140
|
+
results["providers"] = results["current_version"]["providers"]
|
141
|
+
|
142
|
+
results["old_versions"] = versions.map{ |v| v["version"] }[1..5].join(", ") + "..."
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
width = results.keys.map{|k| k.size}.max
|
147
|
+
results.each do |k,v|
|
148
|
+
if k == "versions"
|
149
|
+
v = v.map{ |ver| ver["version"] }.join(", ")
|
150
|
+
elsif k == "current_version"
|
151
|
+
v = v["version"]
|
152
|
+
elsif k == "providers"
|
153
|
+
v = v.map{ |p| p["name"] }.join(", ")
|
154
|
+
elsif k == "downloads"
|
155
|
+
v = format_downloads(v.to_s)
|
156
|
+
end
|
157
|
+
|
158
|
+
whitespace = width-k.size
|
159
|
+
env.ui.info "#{k}:" + "".ljust(whitespace) + " #{v}"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Converts a string of numbers into a formatted number
|
164
|
+
#
|
165
|
+
# 1234 -> 1,234
|
166
|
+
#
|
167
|
+
# @param [String] - download_string
|
168
|
+
def format_downloads(download_string)
|
169
|
+
return download_string.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
# @param [Array] search_results - Box search results from Vagrant Cloud
|
174
|
+
# @param [String,nil] short - determines if short version will be printed
|
175
|
+
# @param [String,nil] json - determines if json version will be printed
|
176
|
+
# @param [Vagrant::Environment] - env
|
177
|
+
def format_search_results(search_results, short, json, env)
|
178
|
+
result = []
|
179
|
+
search_results.each do |b|
|
180
|
+
box = {}
|
181
|
+
box = {
|
182
|
+
name: b["tag"],
|
183
|
+
version: b["current_version"]["version"],
|
184
|
+
downloads: format_downloads(b["downloads"].to_s),
|
185
|
+
providers: b["current_version"]["providers"].map{ |p| p["name"] }.join(",")
|
186
|
+
}
|
187
|
+
result << box
|
188
|
+
end
|
189
|
+
|
190
|
+
if short
|
191
|
+
result.map {|b| env.ui.info(b[:name])}
|
192
|
+
elsif json
|
193
|
+
env.ui.info(result.to_json)
|
194
|
+
else
|
195
|
+
column_labels = {}
|
196
|
+
columns = result.first.keys
|
197
|
+
columns.each do |c|
|
198
|
+
column_labels[c] = c.to_s.upcase
|
199
|
+
end
|
200
|
+
print_search_table(env, column_labels, result, [:downloads])
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module CloudCommand
|
5
|
+
module VersionCommand
|
6
|
+
module Command
|
7
|
+
class Create < Vagrant.plugin("2", :command)
|
8
|
+
def execute
|
9
|
+
options = {}
|
10
|
+
|
11
|
+
opts = OptionParser.new do |o|
|
12
|
+
o.banner = "Usage: vagrant cloud version create [options] organization/box-name version"
|
13
|
+
o.separator ""
|
14
|
+
o.separator "Creates a version entry on Vagrant Cloud"
|
15
|
+
o.separator ""
|
16
|
+
o.separator "Options:"
|
17
|
+
o.separator ""
|
18
|
+
|
19
|
+
o.on("-d", "--description DESCRIPTION", String, "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
|
+
create_version(org, box_name, version, @client.token, options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_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.create_version
|
54
|
+
@env.ui.success(I18n.t("cloud_command.version.create_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.create_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
|