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
data/templates/locales/en.yml
CHANGED
@@ -287,6 +287,8 @@ en:
|
|
287
287
|
trigger:
|
288
288
|
on_error_continue: |-
|
289
289
|
Trigger configured to continue on error...
|
290
|
+
abort: |-
|
291
|
+
Vagrant has been configured to abort. Terminating now...
|
290
292
|
start: |-
|
291
293
|
Running triggers %{stage} %{action} ...
|
292
294
|
fire_with_name: |-
|
@@ -419,6 +421,9 @@ en:
|
|
419
421
|
%{plugins}
|
420
422
|
request_plugin_install: |-
|
421
423
|
Install local plugins (Y/N)
|
424
|
+
install_rerun_command: |-
|
425
|
+
Vagrant has completed installing local plugins for the current Vagrant
|
426
|
+
project directory. Please run the requested command again.
|
422
427
|
|
423
428
|
install_all: |-
|
424
429
|
Vagrant will now install the following plugins to the local project
|
@@ -1457,6 +1462,8 @@ en:
|
|
1457
1462
|
your current setup. Please verify you have all the proper
|
1458
1463
|
prerequisites for using this shared folder type and try again.
|
1459
1464
|
|
1465
|
+
test_key: |-
|
1466
|
+
test value
|
1460
1467
|
triggers_run_fail: |-
|
1461
1468
|
Trigger run failed
|
1462
1469
|
triggers_guest_not_running: |-
|
@@ -1484,6 +1491,34 @@ en:
|
|
1484
1491
|
'%{provider}', but this provider doesn't support this action. This
|
1485
1492
|
is probably a bug in either the provider or the plugin calling this
|
1486
1493
|
action, and should be reported.
|
1494
|
+
upload_invalid_compression_type: |-
|
1495
|
+
The compression type requested for upload (`%{type}`) is not a
|
1496
|
+
supported value. Try uploading again using a valid compression
|
1497
|
+
type.
|
1498
|
+
|
1499
|
+
Supported types: %{valid_types}
|
1500
|
+
upload_missing_extract_capability: |-
|
1501
|
+
The guest does not provide extraction capability for the requested
|
1502
|
+
compression type (`%{type}`). Try a different compression type or
|
1503
|
+
upload without compression.
|
1504
|
+
upload_missing_temp_capability: |-
|
1505
|
+
The guest does not provide temporary path capabilities. Please
|
1506
|
+
try the upload again without requesting a temporary path.
|
1507
|
+
upload_source_missing: |-
|
1508
|
+
The source path provided for upload cannot be found. Please validate
|
1509
|
+
the source location for upload an try again.
|
1510
|
+
|
1511
|
+
Source Path: %{source}
|
1512
|
+
uploader_error: |-
|
1513
|
+
An error occurred while uploading the file. The error
|
1514
|
+
message, if any, is reproduced below. Please fix this error and try
|
1515
|
+
again.
|
1516
|
+
|
1517
|
+
exit code: %{exit_code}
|
1518
|
+
%{message}
|
1519
|
+
uploader_interrupted: |-
|
1520
|
+
The upload was interrupted by an external signal. It did not
|
1521
|
+
complete.
|
1487
1522
|
vagrantfile_exists: |-
|
1488
1523
|
`Vagrantfile` already exists in this directory. Remove it before
|
1489
1524
|
running `vagrant init`.
|
@@ -1680,7 +1715,9 @@ en:
|
|
1680
1715
|
vm_not_running: |-
|
1681
1716
|
VM must be running to open SSH connection. Run `vagrant up`
|
1682
1717
|
to start the virtual machine.
|
1683
|
-
|
1718
|
+
winrm_invalid_communicator: |-
|
1719
|
+
The winrm command requires a WinRM communicator to be used when connecting
|
1720
|
+
to the guest. Please update your configuration and try the command again.
|
1684
1721
|
wsl_vagrant_version_mismatch: |-
|
1685
1722
|
Vagrant cannot currently enable access to manage machines within the Windows
|
1686
1723
|
environment because the version of Vagrant installed on Windows does not
|
@@ -1765,11 +1802,20 @@ en:
|
|
1765
1802
|
on_error_bad_type: |-
|
1766
1803
|
Invalid type set for `on_error` on trigger for command '%{cmd}'. `on_error` can
|
1767
1804
|
only be `:halt` (default) or `:continue`.
|
1805
|
+
abort_bad_type: |-
|
1806
|
+
Trigger option `abort` for command '%{cmd}' must be either set to
|
1807
|
+
`true` (defaults to exit code 1) or an integer to use as an exit code.
|
1808
|
+
abort_false_type: |-
|
1809
|
+
`false` is not a valid option for the `abort` option for a trigger. This
|
1810
|
+
will be ignored...
|
1768
1811
|
exit_codes_bad_type: |-
|
1769
1812
|
Invalid type set for `exit_codes` on trigger for command '%{cmd}'. `exit_codes` can
|
1770
1813
|
only be a single integer or an array of integers.
|
1771
1814
|
only_on_bad_type: |-
|
1772
1815
|
Invalid type found for `only_on`. All values must be a `String` or `Regexp`.
|
1816
|
+
ruby_bad_type: |-
|
1817
|
+
Invalid type for `ruby` option on trigger for command '%{cmd}'. Only `proc`
|
1818
|
+
types are allowed.
|
1773
1819
|
privileged_ignored: |-
|
1774
1820
|
The `privileged` setting for option `run` for trigger command '%{command}' will be ignored and set to false.
|
1775
1821
|
powershell_args_ignored: |-
|
@@ -2011,6 +2057,18 @@ en:
|
|
2011
2057
|
up:
|
2012
2058
|
upping: |-
|
2013
2059
|
Bringing machine '%{name}' up with '%{provider}' provider...
|
2060
|
+
upload:
|
2061
|
+
compress: |-
|
2062
|
+
Compressing %{source} to %{type} for upload...
|
2063
|
+
complete: |-
|
2064
|
+
Upload has completed successfully!
|
2065
|
+
|
2066
|
+
Source: %{source}
|
2067
|
+
Destination: %{destination}
|
2068
|
+
decompress: |-
|
2069
|
+
Decompressing %{type} upload to %{destination}...
|
2070
|
+
start: |-
|
2071
|
+
Uploading %{source} to %{destination}
|
2014
2072
|
validate:
|
2015
2073
|
success: |-
|
2016
2074
|
Vagrantfile validated successfully.
|
@@ -2166,6 +2224,7 @@ en:
|
|
2166
2224
|
manually for more verbose error output.
|
2167
2225
|
match_mac:
|
2168
2226
|
matching: Matching MAC address for NAT networking...
|
2227
|
+
generating: Generating MAC address for NAT networking...
|
2169
2228
|
no_base_mac: |-
|
2170
2229
|
No base MAC address was specified. This is required for the NAT networking
|
2171
2230
|
to work properly (and hence port forwarding, SSH, etc.). Specifying this
|
@@ -12,8 +12,12 @@ en:
|
|
12
12
|
Build image no longer exists. Rebuilding...
|
13
13
|
building: |-
|
14
14
|
Building the container from a Dockerfile...
|
15
|
+
building_git_repo: |-
|
16
|
+
Building the container from the git repository: %{repo}...
|
15
17
|
building_named_dockerfile: |-
|
16
18
|
Building the container from the named Dockerfile: %{file}...
|
19
|
+
building_git_repo_named_dockerfile: |-
|
20
|
+
Building the container from the named Dockerfile: %{file} in the git repository: %{repo}...
|
17
21
|
creating: |-
|
18
22
|
Creating the container...
|
19
23
|
created: |-
|
@@ -137,16 +141,20 @@ en:
|
|
137
141
|
and notify them to not use this communicator for anything except the
|
138
142
|
"docker" provider.
|
139
143
|
config:
|
140
|
-
|
141
|
-
Only one of "build_dir" or "image" can be set
|
144
|
+
both_build_and_image_and_git: |-
|
145
|
+
Only one of "build_dir", "git_repo" or "image" can be set
|
142
146
|
build_dir_invalid: |-
|
143
147
|
"build_dir" must exist and contain a Dockerfile
|
148
|
+
git_repo_invalid: |-
|
149
|
+
"git_repo" must be a valid repository URL
|
144
150
|
build_dir_or_image: |-
|
145
|
-
One of "build_dir" or "image" must be set
|
151
|
+
One of "build_dir", "git_repo" or "image" must be set
|
146
152
|
compose_configuration_hash: |-
|
147
153
|
"compose_configuration" must be a hash
|
148
154
|
compose_force_vm: |-
|
149
155
|
Docker compose is not currently supported from within proxy VM.
|
156
|
+
git_repo_invalid: |-
|
157
|
+
"git_repo" must be a valid git URL
|
150
158
|
create_args_array: |-
|
151
159
|
"create_args" must be an array
|
152
160
|
invalid_link: |-
|
data/vagrant.gemspec
CHANGED
@@ -25,11 +25,13 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_dependency "net-sftp", "~> 2.1"
|
26
26
|
s.add_dependency "net-scp", "~> 1.2.0"
|
27
27
|
s.add_dependency "rb-kqueue", "~> 0.2.0"
|
28
|
-
s.add_dependency "rest-client", "
|
28
|
+
s.add_dependency "rest-client", ">= 1.6.0", "< 3.0"
|
29
|
+
s.add_dependency "rubyzip", "~> 1.2.2"
|
29
30
|
s.add_dependency "wdm", "~> 0.1.0"
|
30
31
|
s.add_dependency "winrm", "~> 2.1"
|
31
32
|
s.add_dependency "winrm-fs", "~> 1.0"
|
32
33
|
s.add_dependency "winrm-elevated", "~> 1.1"
|
34
|
+
s.add_dependency "vagrant_cloud", "~> 2.0.0"
|
33
35
|
|
34
36
|
# NOTE: The ruby_dep gem is an implicit dependency from the listen gem. Later versions
|
35
37
|
# of the ruby_dep gem impose an aggressive constraint on the required ruby version (>= 2.2.5).
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Mitchell Hashimoto".freeze]
|
11
|
-
s.date = "2018-
|
11
|
+
s.date = "2018-11-12"
|
12
12
|
s.description = "Tool and library for testing Vagrant plugins".freeze
|
13
13
|
s.email = ["mitchell.hashimoto@gmail.com".freeze]
|
14
14
|
s.executables = ["vagrant-spec".freeze]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Cargo Media
|
4
|
+
Copyright (c) 2017 HashiCorp
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
@@ -0,0 +1,67 @@
|
|
1
|
+
vagrant_cloud
|
2
|
+
=============
|
3
|
+
Ruby client for the [Vagrant Cloud API](https://www.vagrantup.com/docs/vagrant-cloud/api.html).
|
4
|
+
|
5
|
+
[![Build Status](https://img.shields.io/travis/hashicorp/vagrant_cloud/master.svg)](https://travis-ci.org/hashicorp/vagrant_cloud)
|
6
|
+
[![Gem Version](https://img.shields.io/gem/v/vagrant_cloud.svg)](https://rubygems.org/gems/vagrant_cloud)
|
7
|
+
|
8
|
+
|
9
|
+
This client allows to create, modify and delete *boxes*, *versions* and *providers*.
|
10
|
+
The main entry point is an object referencing your *account*.
|
11
|
+
|
12
|
+
Usage
|
13
|
+
-----
|
14
|
+
Example usage:
|
15
|
+
```ruby
|
16
|
+
account = VagrantCloud::Account.new('<username>', '<access_token>')
|
17
|
+
box = account.ensure_box('my_box')
|
18
|
+
version = box.ensure_version('0.0.1')
|
19
|
+
provider = version.ensure_provider('virtualbox', 'http://example.com/foo.box')
|
20
|
+
|
21
|
+
version.release
|
22
|
+
puts provider.download_url
|
23
|
+
```
|
24
|
+
|
25
|
+
__NOTE:__ As of version 2.0.0, the CLI has been deprecated in favor of the `vagrant cloud`
|
26
|
+
command. More information about how to use the `vagrant cloud` command can be found
|
27
|
+
on the [Vagrant documentation](https://www.vagrantup.com/docs/cli/cloud.html).
|
28
|
+
|
29
|
+
Example CLI usage:
|
30
|
+
Create a version and provider within an existing Box, upload a file to be hosted by Vagrant Cloud, and release the version
|
31
|
+
```sh
|
32
|
+
vagrant_cloud create_version --username $USERNAME --token $VAGRANT_CLOUD_TOKEN --box $BOX_NAME --version $BOX_VERSION
|
33
|
+
vagrant_cloud create_provider --username $USERNAME --token $VAGRANT_CLOUD_TOKEN --box $BOX_NAME --version $BOX_VERSION
|
34
|
+
vagrant_cloud upload_file --username $USERNAME --token $VAGRANT_CLOUD_TOKEN --box $BOX_NAME --version $BOX_VERSION --provider_file_path $PACKAGE_PATH
|
35
|
+
vagrant_cloud release_version --username $USERNAME --token $VAGRANT_CLOUD_TOKEN --box $BOX_NAME --version $BOX_VERSION
|
36
|
+
```
|
37
|
+
If you installed vagrant_cloud with bundler, then you may have to invoke using `bundle exec vagrant_cloud`
|
38
|
+
|
39
|
+
Development & Contributing
|
40
|
+
--------------------------
|
41
|
+
Pull requests are very welcome!
|
42
|
+
|
43
|
+
Install dependencies:
|
44
|
+
```
|
45
|
+
bundle install
|
46
|
+
```
|
47
|
+
|
48
|
+
Run the tests:
|
49
|
+
```
|
50
|
+
bundle exec rspec
|
51
|
+
```
|
52
|
+
|
53
|
+
Check the code syntax:
|
54
|
+
```
|
55
|
+
bundle exec rubocop
|
56
|
+
```
|
57
|
+
|
58
|
+
Release a new version:
|
59
|
+
|
60
|
+
1. Bump the version in `vagrant_cloud.gemspec`, merge to master.
|
61
|
+
2. Push a new tag to master.
|
62
|
+
3. Release to RubyGems with `bundle exec rake release`.
|
63
|
+
|
64
|
+
History
|
65
|
+
-------
|
66
|
+
This gem has been developed and maintained by [Cargo Media](https://www.cargomedia.ch) since April 2014.
|
67
|
+
HashiCorp became the official maintainer in October 2017.
|
@@ -0,0 +1,190 @@
|
|
1
|
+
module VagrantCloud
|
2
|
+
class Account
|
3
|
+
attr_accessor :username
|
4
|
+
attr_accessor :access_token
|
5
|
+
|
6
|
+
# @param [String] username
|
7
|
+
# @param [String] access_token
|
8
|
+
def initialize(username, access_token, custom_server = nil)
|
9
|
+
@username = username
|
10
|
+
@access_token = access_token
|
11
|
+
@client = Client.new(access_token, custom_server)
|
12
|
+
end
|
13
|
+
|
14
|
+
#---------------------------
|
15
|
+
# Authentication API Helpers
|
16
|
+
#---------------------------
|
17
|
+
|
18
|
+
# @param [String] password
|
19
|
+
# @param [String] description
|
20
|
+
# @param [String] 2FA code
|
21
|
+
# @return [Hash] response body
|
22
|
+
def create_token(password, description = nil, code = nil)
|
23
|
+
token_data_params = {
|
24
|
+
token: { description: description },
|
25
|
+
user: { login: @username, password: password },
|
26
|
+
two_factor: code
|
27
|
+
}.delete_if { |_, v| v.nil? }
|
28
|
+
|
29
|
+
token_response = @client.request('post', '/authenticate', token_data_params)
|
30
|
+
token_response
|
31
|
+
end
|
32
|
+
|
33
|
+
# @param [String] token
|
34
|
+
def delete_token(access_token = nil)
|
35
|
+
token_response = @client.request('delete', '/authenticate', nil, access_token)
|
36
|
+
token_response
|
37
|
+
end
|
38
|
+
|
39
|
+
# Validates a token on the account or a one-off validation token request.
|
40
|
+
# Will return nil if token is valid, otherwise will return Hash of response
|
41
|
+
# from Vagrant Cloud
|
42
|
+
#
|
43
|
+
# @param [String] access_token
|
44
|
+
# @return [Hash] response body
|
45
|
+
def validate_token(access_token = nil)
|
46
|
+
token_response = @client.request('get', '/authenticate', nil, access_token)
|
47
|
+
token_response
|
48
|
+
end
|
49
|
+
|
50
|
+
# @param [String] delivery_method
|
51
|
+
# @param [String] password
|
52
|
+
# @return [Hash] response body
|
53
|
+
def request_2fa_code(delivery_method, password)
|
54
|
+
twofa_code_params = {
|
55
|
+
two_factor: { delivery_method: delivery_method },
|
56
|
+
user: { login: @username, password: password }
|
57
|
+
}
|
58
|
+
|
59
|
+
code_response = @client.request('post', '/two-factor/request-code', twofa_code_params)
|
60
|
+
code_response
|
61
|
+
end
|
62
|
+
|
63
|
+
#---------------------------
|
64
|
+
# Organization API Helpers
|
65
|
+
#---------------------------
|
66
|
+
|
67
|
+
# @param [String] - organization
|
68
|
+
# @return [Hash]
|
69
|
+
def read_organization(org = nil)
|
70
|
+
if org
|
71
|
+
name = org
|
72
|
+
else
|
73
|
+
name = @username
|
74
|
+
end
|
75
|
+
|
76
|
+
@client.request('get', "/user/#{name}")
|
77
|
+
end
|
78
|
+
|
79
|
+
#--------------------
|
80
|
+
# Old Box API Helpers
|
81
|
+
#--------------------
|
82
|
+
|
83
|
+
# @param [String] name
|
84
|
+
# @param [Hash] data
|
85
|
+
# @return [Box]
|
86
|
+
def get_box(name, data = nil)
|
87
|
+
Box.new(self, name, data)
|
88
|
+
end
|
89
|
+
|
90
|
+
# @param [String] name
|
91
|
+
# @param [Hash] args
|
92
|
+
# @return [Box]
|
93
|
+
def create_box(name, *args)
|
94
|
+
params = box_params(*args)
|
95
|
+
params[:name] = name
|
96
|
+
|
97
|
+
data = @client.request('post', '/boxes', box: params)
|
98
|
+
get_box(name, data)
|
99
|
+
end
|
100
|
+
|
101
|
+
# @param [String] name
|
102
|
+
# @param [Hash] args
|
103
|
+
# @return [Box]
|
104
|
+
def ensure_box(name, *args)
|
105
|
+
params = box_params(*args)
|
106
|
+
|
107
|
+
begin
|
108
|
+
box = get_box(name)
|
109
|
+
box.data
|
110
|
+
rescue RestClient::ResourceNotFound
|
111
|
+
box = create_box(name, params)
|
112
|
+
# If we've just created the box, we're done.
|
113
|
+
return box
|
114
|
+
end
|
115
|
+
|
116
|
+
# Select elements from params that don't match what we have in the box
|
117
|
+
# data. These are changed parameters and should be updated.
|
118
|
+
update_params = params.select do |k, v|
|
119
|
+
box.data[box.param_name(k)] != v
|
120
|
+
end
|
121
|
+
|
122
|
+
# Update the box with any params that had changed.
|
123
|
+
box.update(update_params) unless update_params.empty?
|
124
|
+
|
125
|
+
box
|
126
|
+
end
|
127
|
+
|
128
|
+
#--------------------
|
129
|
+
# Old Box API Helpers
|
130
|
+
#--------------------
|
131
|
+
|
132
|
+
# REMOVED IN FAVOR OF CLIENT CLASS, but still exists to support any old clients
|
133
|
+
#
|
134
|
+
# @param [String] method
|
135
|
+
# @param [String] path
|
136
|
+
# @param [Hash] params
|
137
|
+
# @return [Hash]
|
138
|
+
def request(method, path, params = {})
|
139
|
+
headers = {}
|
140
|
+
|
141
|
+
headers['Authorization'] = "Bearer #{access_token}" if access_token
|
142
|
+
|
143
|
+
result = RestClient::Request.execute(
|
144
|
+
method: method,
|
145
|
+
url: url_base + path,
|
146
|
+
payload: params,
|
147
|
+
headers: headers,
|
148
|
+
ssl_version: 'TLSv1'
|
149
|
+
)
|
150
|
+
result = JSON.parse(result)
|
151
|
+
errors = result['errors']
|
152
|
+
raise "Vagrant Cloud returned error: #{errors}" if errors
|
153
|
+
|
154
|
+
result
|
155
|
+
end
|
156
|
+
|
157
|
+
private
|
158
|
+
|
159
|
+
# @return [String]
|
160
|
+
def url_base
|
161
|
+
'https://vagrantcloud.com/api/v1'
|
162
|
+
end
|
163
|
+
|
164
|
+
# @param [Array] args
|
165
|
+
# @return [Hash]
|
166
|
+
def box_params(*args)
|
167
|
+
# Prepares a hash based on the *args array passed in.
|
168
|
+
# Acceptable parameters are those documented by Hashicorp for the v1 API
|
169
|
+
# at https://vagrantcloud.com/docs
|
170
|
+
|
171
|
+
# This dance is to simulate what we could have accomplished with **args
|
172
|
+
# in Ruby 2.0+
|
173
|
+
# This will silently discard any options that are not passed in as a
|
174
|
+
# hash.
|
175
|
+
# Find and remove the first hash we find in *args. Set params to an
|
176
|
+
# empty hash if we weren't passed one.
|
177
|
+
params = args.select { |v| v.is_a?(Hash) }.first
|
178
|
+
if params.nil?
|
179
|
+
params = {}
|
180
|
+
else
|
181
|
+
args.delete_if { |v| v == params }
|
182
|
+
end
|
183
|
+
|
184
|
+
# Default boxes to public can be overridden by providing :is_private
|
185
|
+
params[:is_private] = false unless params.key?(:is_private)
|
186
|
+
|
187
|
+
params
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
module VagrantCloud
|
2
|
+
class Box
|
3
|
+
attr_accessor :account
|
4
|
+
attr_accessor :name
|
5
|
+
|
6
|
+
# @param [String] account
|
7
|
+
# @param [String] name
|
8
|
+
# @param [Hash] data
|
9
|
+
# @param [String] description
|
10
|
+
# @param [String] short_description
|
11
|
+
# @param [String] access_token
|
12
|
+
def initialize(account, name = nil, data = nil, short_description = nil, description = nil, access_token = nil, custom_server = nil)
|
13
|
+
@account = account
|
14
|
+
@name = name
|
15
|
+
@data = data
|
16
|
+
@description = description
|
17
|
+
@short_description = short_description
|
18
|
+
@client = Client.new(access_token, custom_server)
|
19
|
+
end
|
20
|
+
|
21
|
+
#--------------------
|
22
|
+
# Box API Helpers
|
23
|
+
#--------------------
|
24
|
+
|
25
|
+
# Read this box
|
26
|
+
# @return [Hash]
|
27
|
+
def data
|
28
|
+
@data ||= @client.request('get', box_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Update a box
|
32
|
+
#
|
33
|
+
# @param [Hash] args
|
34
|
+
# @param [String] org - organization of the box to read
|
35
|
+
# @param [String] box_name - name of the box to read
|
36
|
+
# @return [Hash]
|
37
|
+
def update(args = {})
|
38
|
+
# hash arguments kept for backwards compatibility
|
39
|
+
data = @client.request('put', box_path(args[:organization], args[:name]), box: args)
|
40
|
+
|
41
|
+
# Update was called on *this* object, so update
|
42
|
+
# objects data locally
|
43
|
+
@data = data if !args[:organization] && !args[:name]
|
44
|
+
data
|
45
|
+
end
|
46
|
+
|
47
|
+
# A generic function to read any box on Vagrant Cloud
|
48
|
+
# If org and box name is not supplied, it will default to
|
49
|
+
# reading the given Box object
|
50
|
+
#
|
51
|
+
# @param [String] org - organization of the box to read
|
52
|
+
# @param [String] box_name - name of the box to read
|
53
|
+
# @return [Hash]
|
54
|
+
def delete(org = nil, box_name = nil)
|
55
|
+
@client.request('delete', box_path(org, box_name))
|
56
|
+
end
|
57
|
+
|
58
|
+
# A generic function to read any box on Vagrant Cloud
|
59
|
+
#
|
60
|
+
# @param [String] org - organization of the box to read
|
61
|
+
# @param [String] box_name - name of the box to read
|
62
|
+
# @return [Hash]
|
63
|
+
def read(org = nil, box_name = nil)
|
64
|
+
@client.request('get', box_path(org, box_name))
|
65
|
+
end
|
66
|
+
|
67
|
+
# @param [String] short_description
|
68
|
+
# @param [String] description
|
69
|
+
# @param [Bool] is_private
|
70
|
+
# @return [Hash]
|
71
|
+
def create(short_description = nil, description = nil, org = nil, box_name = nil, is_private = false)
|
72
|
+
update_data = !(org && box_name)
|
73
|
+
|
74
|
+
org ||= account.username
|
75
|
+
box_name ||= @name
|
76
|
+
short_description ||= @short_description
|
77
|
+
description ||= @description
|
78
|
+
|
79
|
+
params = {
|
80
|
+
name: box_name,
|
81
|
+
username: org,
|
82
|
+
is_private: is_private,
|
83
|
+
short_description: short_description,
|
84
|
+
description: description
|
85
|
+
}.delete_if { |_, v| v.nil? }
|
86
|
+
|
87
|
+
data = @client.request('post', '/boxes', box: params)
|
88
|
+
|
89
|
+
# Create was called on *this* object, so update
|
90
|
+
# objects data locally
|
91
|
+
@data = data if update_data
|
92
|
+
data
|
93
|
+
end
|
94
|
+
|
95
|
+
#--------------------
|
96
|
+
# Metadata Helpers
|
97
|
+
#--------------------
|
98
|
+
|
99
|
+
# @return [String]
|
100
|
+
def description
|
101
|
+
data['description_markdown'].to_s
|
102
|
+
end
|
103
|
+
|
104
|
+
# @return [String]
|
105
|
+
def description_short
|
106
|
+
data['short_description'].to_s
|
107
|
+
end
|
108
|
+
|
109
|
+
# @return [TrueClass, FalseClass]
|
110
|
+
def private
|
111
|
+
!!data['private']
|
112
|
+
end
|
113
|
+
|
114
|
+
# @return [Array<Version>]
|
115
|
+
def versions
|
116
|
+
version_list = data['versions'].map { |data| VagrantCloud::Version.new(self, data['number'], data) }
|
117
|
+
version_list.sort_by { |version| Gem::Version.new(version.number) }
|
118
|
+
end
|
119
|
+
|
120
|
+
#------------------------
|
121
|
+
# Old Version API Helpers
|
122
|
+
#------------------------
|
123
|
+
|
124
|
+
# @param [Integer] number
|
125
|
+
# @param [Hash] data
|
126
|
+
# @return [Version]
|
127
|
+
def get_version(number, data = nil)
|
128
|
+
VagrantCloud::Version.new(self, number, data)
|
129
|
+
end
|
130
|
+
|
131
|
+
# @param [String] name
|
132
|
+
# @param [String] description
|
133
|
+
# @return [Version]
|
134
|
+
def create_version(name, description = nil)
|
135
|
+
params = { version: name }
|
136
|
+
params[:description] = description if description
|
137
|
+
data = @client.request('post', "#{box_path}/versions", version: params)
|
138
|
+
get_version(data['number'], data)
|
139
|
+
end
|
140
|
+
|
141
|
+
# @param [String] name
|
142
|
+
# @param [String] description
|
143
|
+
# @return [Version]
|
144
|
+
def ensure_version(name, description = nil)
|
145
|
+
version = versions.select { |v| v.version == name }.first
|
146
|
+
version ||= create_version(name, description)
|
147
|
+
if description && (description != version.description)
|
148
|
+
version.update(description)
|
149
|
+
end
|
150
|
+
version
|
151
|
+
end
|
152
|
+
|
153
|
+
# @param [Symbol]
|
154
|
+
# @return [String]
|
155
|
+
def param_name(param)
|
156
|
+
# This needs to return strings, otherwise it won't match the JSON that
|
157
|
+
# Vagrant Cloud returns.
|
158
|
+
ATTR_MAP.fetch(param, param.to_s)
|
159
|
+
end
|
160
|
+
|
161
|
+
private
|
162
|
+
|
163
|
+
# Constructs the box path based on an account and box name.
|
164
|
+
# If no params are given, it constructs a path for *this* Box object,
|
165
|
+
# but if both params are given it will construct a path for a one-off request
|
166
|
+
#
|
167
|
+
# @param [String] - username
|
168
|
+
# @param [String] - box_name
|
169
|
+
# @return [String] - API path to box
|
170
|
+
def box_path(username = nil, box_name = nil)
|
171
|
+
if username && box_name
|
172
|
+
"/box/#{username}/#{box_name}"
|
173
|
+
else
|
174
|
+
"/box/#{account.username}/#{name}"
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Vagrant Cloud returns keys different from what you set for some params.
|
179
|
+
# Values in this map should be strings.
|
180
|
+
ATTR_MAP = {
|
181
|
+
is_private: 'private',
|
182
|
+
description: 'description_markdown'
|
183
|
+
}.freeze
|
184
|
+
end
|
185
|
+
end
|