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,62 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'winrm'
|
4
|
+
require 'json'
|
5
|
+
require_relative '../matchers'
|
6
|
+
|
7
|
+
# Creates a WinRM connection for integration tests
|
8
|
+
module ConnectionHelper
|
9
|
+
def winrm_connection
|
10
|
+
WinRM::Connection.new(connection_opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
def connection_opts
|
14
|
+
@connection_opts ||= begin
|
15
|
+
cfg = symbolize_keys(YAML.safe_load(File.read(winrm_config_path)))
|
16
|
+
merge_environment(cfg)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def merge_environment(config)
|
21
|
+
merge_config_option_from_environment(config, 'user')
|
22
|
+
merge_config_option_from_environment(config, 'password')
|
23
|
+
merge_config_option_from_environment(config, 'no_ssl_peer_verification')
|
24
|
+
config[:ssl_peer_fingerprint] = ENV['winrm_cert'] if ENV['use_ssl_peer_fingerprint']
|
25
|
+
config[:endpoint] = ENV['winrm_endpoint'] if ENV['winrm_endpoint']
|
26
|
+
config
|
27
|
+
end
|
28
|
+
|
29
|
+
def merge_config_option_from_environment(config, key)
|
30
|
+
env_key = 'winrm_' + key
|
31
|
+
config[key.to_sym] = ENV[env_key] if ENV[env_key]
|
32
|
+
end
|
33
|
+
|
34
|
+
def winrm_config_path
|
35
|
+
# Copy config-example.yml to config.yml and edit for your local ConnectionOpts
|
36
|
+
path = File.expand_path("#{File.dirname(__FILE__)}/config.yml")
|
37
|
+
unless File.exist?(path)
|
38
|
+
# user hasn't done this, so use sane defaults for unit tests
|
39
|
+
path = File.expand_path("#{File.dirname(__FILE__)}/config-example.yml")
|
40
|
+
end
|
41
|
+
path
|
42
|
+
end
|
43
|
+
|
44
|
+
def symbolize_keys(hash)
|
45
|
+
hash.each_with_object({}) do |(key, value), result|
|
46
|
+
new_key = case key
|
47
|
+
when String then key.to_sym
|
48
|
+
else key
|
49
|
+
end
|
50
|
+
new_value = case value
|
51
|
+
when Hash then symbolize_keys(value)
|
52
|
+
else value
|
53
|
+
end
|
54
|
+
result[new_key] = new_value
|
55
|
+
result
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
RSpec.configure do |config|
|
61
|
+
config.include(ConnectionHelper)
|
62
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe 'WinRM connection' do
|
4
|
+
let(:connection) do
|
5
|
+
endpoint = connection_opts[:endpoint].dup
|
6
|
+
if auth_type == :ssl
|
7
|
+
endpoint.sub!('5985', '5986')
|
8
|
+
endpoint.sub!('http', 'https')
|
9
|
+
end
|
10
|
+
conn_options = {
|
11
|
+
transport: auth_type,
|
12
|
+
endpoint: endpoint
|
13
|
+
}.merge(options)
|
14
|
+
WinRM::Connection.new(conn_options).shell(:cmd)
|
15
|
+
end
|
16
|
+
let(:options) do
|
17
|
+
opts = {}
|
18
|
+
opts[:user] = connection_opts[:user]
|
19
|
+
opts[:password] = connection_opts[:password]
|
20
|
+
opts[:basic_auth_only] = basic_auth_only
|
21
|
+
opts[:no_ssl_peer_verification] = no_ssl_peer_verification
|
22
|
+
opts[:ssl_peer_fingerprint] = ssl_peer_fingerprint
|
23
|
+
opts[:client_cert] = user_cert
|
24
|
+
opts[:client_key] = user_key
|
25
|
+
opts
|
26
|
+
end
|
27
|
+
let(:basic_auth_only) { false }
|
28
|
+
let(:no_ssl_peer_verification) { false }
|
29
|
+
let(:ssl_peer_fingerprint) { nil }
|
30
|
+
let(:user_cert) { nil }
|
31
|
+
let(:user_key) { nil }
|
32
|
+
|
33
|
+
subject(:output) { connection.run('ipconfig') }
|
34
|
+
|
35
|
+
after(:each) do
|
36
|
+
connection.close
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_examples 'a valid_connection' do
|
40
|
+
it 'has a 0 exit code' do
|
41
|
+
expect(subject).to have_exit_code 0
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'includes command output' do
|
45
|
+
expect(subject).to have_stdout_match(/Windows IP Configuration/)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'has no errors' do
|
49
|
+
expect(subject).to have_no_stderr
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'HttpPlaintext' do
|
54
|
+
let(:basic_auth_only) { true }
|
55
|
+
let(:auth_type) { :plaintext }
|
56
|
+
|
57
|
+
it_behaves_like 'a valid_connection'
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'HttpNegotiate' do
|
61
|
+
let(:auth_type) { :negotiate }
|
62
|
+
|
63
|
+
it_behaves_like 'a valid_connection'
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'BasicAuthSSL', skip: ENV['winrm_cert'].nil? do
|
67
|
+
let(:basic_auth_only) { true }
|
68
|
+
let(:auth_type) { :ssl }
|
69
|
+
let(:no_ssl_peer_verification) { true }
|
70
|
+
|
71
|
+
it_behaves_like 'a valid_connection'
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'ClientCertAuthSSL', skip: ENV['user_cert'].nil? do
|
75
|
+
let(:auth_type) { :ssl }
|
76
|
+
let(:no_ssl_peer_verification) { true }
|
77
|
+
let(:user_cert) { ENV['user_cert'] }
|
78
|
+
let(:user_key) { ENV['user_key'] }
|
79
|
+
|
80
|
+
before { options[:pass] = nil }
|
81
|
+
|
82
|
+
it_behaves_like 'a valid_connection'
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'Negotiate over SSL', skip: ENV['winrm_cert'].nil? do
|
86
|
+
let(:auth_type) { :ssl }
|
87
|
+
let(:no_ssl_peer_verification) { true }
|
88
|
+
|
89
|
+
it_behaves_like 'a valid_connection'
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'SSL fingerprint', skip: ENV['winrm_cert'].nil? do
|
93
|
+
let(:auth_type) { :ssl }
|
94
|
+
let(:ssl_peer_fingerprint) { ENV['winrm_cert'] }
|
95
|
+
|
96
|
+
it_behaves_like 'a valid_connection'
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe 'winrm client wql' do
|
4
|
+
before(:all) do
|
5
|
+
@winrm = winrm_connection
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should query Win32_OperatingSystem' do
|
9
|
+
output = @winrm.run_wql('select * from Win32_OperatingSystem')
|
10
|
+
expect(output).to_not be_empty
|
11
|
+
output_caption = output[:win32_operating_system][0][:caption]
|
12
|
+
expect(output_caption).to include('Microsoft')
|
13
|
+
expect(output_caption).to include('Windows')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should query Win32_Process' do
|
17
|
+
output = @winrm.run_wql('select * from Win32_Process')
|
18
|
+
expect(output).to_not be_empty
|
19
|
+
process_count = output[:win32_process].count
|
20
|
+
expect(process_count).to be > 1
|
21
|
+
expect(output[:win32_process]).to all(include(:command_line))
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should query Win32_Process with block' do
|
25
|
+
count = 0
|
26
|
+
@winrm.run_wql('select * from Win32_Process') do |type, item|
|
27
|
+
expect(type).to eq(:win32_process)
|
28
|
+
expect(item).to include(:command_line)
|
29
|
+
count += 1
|
30
|
+
end
|
31
|
+
expect(count).to be > 1
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
# rspec matchers
|
4
|
+
RSpec::Matchers.define :have_stdout_match do |expected_stdout|
|
5
|
+
match do |actual_output|
|
6
|
+
!expected_stdout.match(actual_output.stdout).nil?
|
7
|
+
end
|
8
|
+
failure_message do |actual_output|
|
9
|
+
"expected that '#{actual_output.stdout}' would match #{expected_stdout}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
RSpec::Matchers.define :have_stderr_match do |expected_stderr|
|
14
|
+
match do |actual_output|
|
15
|
+
!expected_stderr.match(actual_output.stderr).nil?
|
16
|
+
end
|
17
|
+
failure_message do |actual_output|
|
18
|
+
"expected that '#{actual_output.stderr}' would match #{expected_stderr}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec::Matchers.define :have_no_stdout do
|
23
|
+
match do |actual_output|
|
24
|
+
stdout = actual_output.stdout
|
25
|
+
['\r\n', ''].include?(stdout)
|
26
|
+
end
|
27
|
+
failure_message do |actual_output|
|
28
|
+
"expected that '#{actual_output.stdout}' would have no stdout"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec::Matchers.define :have_no_stderr do
|
33
|
+
match do |actual_output|
|
34
|
+
stderr = actual_output.stderr
|
35
|
+
['\r\n', ''].include?(stderr)
|
36
|
+
end
|
37
|
+
failure_message do |actual_output|
|
38
|
+
"expected that '#{actual_output.stderr}' would have no stderr"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
RSpec::Matchers.define :have_exit_code do |expected_exit_code|
|
43
|
+
match do |actual_output|
|
44
|
+
expected_exit_code == actual_output.exitcode
|
45
|
+
end
|
46
|
+
failure_message do |actual_output|
|
47
|
+
"expected exit code #{expected_exit_code}, but got #{actual_output.exitcode}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
RSpec::Matchers.define :be_a_uid do
|
52
|
+
match do |actual|
|
53
|
+
# WinRM1.1 returns uuid's prefixed with 'uuid:' where as later versions do not
|
54
|
+
actual && actual.to_s.match(/^(uuid:)*\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/)
|
55
|
+
end
|
56
|
+
failure_message do |actual|
|
57
|
+
"expected a uid, but got '#{actual}'"
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
require 'winrm/connection_opts'
|
2
|
+
|
3
|
+
describe WinRM::ConnectionOpts do
|
4
|
+
shared_examples 'invalid options' do
|
5
|
+
it 'throws a validation error' do
|
6
|
+
expect { WinRM::ConnectionOpts.create_with_defaults(overrides) }.to raise_error
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'when there are no overrides' do
|
11
|
+
it_behaves_like 'invalid options'
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when there are only username and password' do
|
15
|
+
let(:overrides) do
|
16
|
+
{
|
17
|
+
user: 'Administrator',
|
18
|
+
password: 'password'
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
it_behaves_like 'invalid options'
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'when there are only username and endpoint' do
|
26
|
+
let(:overrides) do
|
27
|
+
{
|
28
|
+
user: 'Administrator',
|
29
|
+
endpoint: 'http://localhost:5985/wsman'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
it_behaves_like 'invalid options'
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'when there are only password and endpoint' do
|
37
|
+
let(:overrides) do
|
38
|
+
{
|
39
|
+
password: 'password',
|
40
|
+
endpoint: 'http://localhost:5985/wsman'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
it_behaves_like 'invalid options'
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'when there are only certificate and key' do
|
48
|
+
let(:overrides) do
|
49
|
+
{
|
50
|
+
client_cert: 'path/to/cert',
|
51
|
+
client_key: 'path/to/key'
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
it_behaves_like 'invalid options'
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'when there are only certificate and endpoint' do
|
59
|
+
let(:overrides) do
|
60
|
+
{
|
61
|
+
client_cert: 'path/to/cert',
|
62
|
+
endpoint: 'http://localhost:5985/wsman'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
it_behaves_like 'invalid options'
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'when there are only key and endpoint' do
|
70
|
+
let(:overrides) do
|
71
|
+
{
|
72
|
+
client_key: 'path/to/key',
|
73
|
+
endpoint: 'http://localhost:5985/wsman'
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
it_behaves_like 'invalid options'
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'when username, password, and endpoint are given' do
|
81
|
+
let(:overrides) do
|
82
|
+
{
|
83
|
+
user: 'Administrator',
|
84
|
+
password: 'password',
|
85
|
+
endpoint: 'http://localhost:5985/wsman'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
describe '#create_with_defaults' do
|
89
|
+
it 'creates a ConnectionOpts object' do
|
90
|
+
config = WinRM::ConnectionOpts.create_with_defaults(overrides)
|
91
|
+
expect(config[:user]).to eq(overrides[:user])
|
92
|
+
expect(config[:password]).to eq(overrides[:password])
|
93
|
+
expect(config[:endpoint]).to eq(overrides[:endpoint])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'when certificate, key and endpoint are given' do
|
99
|
+
let(:overrides) do
|
100
|
+
{
|
101
|
+
client_cert: 'path/to/cert',
|
102
|
+
client_key: 'path/to/key',
|
103
|
+
endpoint: 'http://localhost:5985/wsman'
|
104
|
+
}
|
105
|
+
end
|
106
|
+
describe '#create_with_defaults' do
|
107
|
+
it 'creates a ConnectionOpts object' do
|
108
|
+
config = WinRM::ConnectionOpts.create_with_defaults(overrides)
|
109
|
+
expect(config[:client_cert]).to eq(overrides[:client_cert])
|
110
|
+
expect(config[:client_key]).to eq(overrides[:client_key])
|
111
|
+
expect(config[:endpoint]).to eq(overrides[:endpoint])
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context 'when overrides are provided' do
|
117
|
+
let(:overrides) do
|
118
|
+
{
|
119
|
+
user: 'Administrator',
|
120
|
+
password: 'password',
|
121
|
+
endpoint: 'http://localhost:5985/wsman',
|
122
|
+
transport: :ssl
|
123
|
+
}
|
124
|
+
end
|
125
|
+
describe '#create_with_defaults' do
|
126
|
+
it 'creates a ConnectionOpts object with overrides' do
|
127
|
+
config = WinRM::ConnectionOpts.create_with_defaults(overrides)
|
128
|
+
expect(config[:transport]).to eq(overrides[:transport])
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'when receive_timeout is specified' do
|
134
|
+
let(:overrides) do
|
135
|
+
{
|
136
|
+
user: 'Administrator',
|
137
|
+
password: 'password',
|
138
|
+
endpoint: 'http://localhost:5985/wsman',
|
139
|
+
receive_timeout: 120
|
140
|
+
}
|
141
|
+
end
|
142
|
+
describe '#create_with_defaults' do
|
143
|
+
it 'creates a ConnectionOpts object with the correct receive_timeout' do
|
144
|
+
config = WinRM::ConnectionOpts.create_with_defaults(overrides)
|
145
|
+
expect(config[:receive_timeout]).to eq(overrides[:receive_timeout])
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context 'when operation_timeout is specified' do
|
151
|
+
let(:overrides) do
|
152
|
+
{
|
153
|
+
user: 'Administrator',
|
154
|
+
password: 'password',
|
155
|
+
endpoint: 'http://localhost:5985/wsman',
|
156
|
+
operation_timeout: 120
|
157
|
+
}
|
158
|
+
end
|
159
|
+
describe '#create_with_defaults' do
|
160
|
+
it 'creates a ConnectionOpts object with the correct timeouts' do
|
161
|
+
config = WinRM::ConnectionOpts.create_with_defaults(overrides)
|
162
|
+
expect(config[:operation_timeout]).to eq(overrides[:operation_timeout])
|
163
|
+
expect(config[:receive_timeout]).to eq(overrides[:operation_timeout] + 10)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context 'when invalid data types are given' do
|
169
|
+
let(:overrides) do
|
170
|
+
{
|
171
|
+
user: 'Administrator',
|
172
|
+
password: 'password',
|
173
|
+
endpoint: 'http://localhost:5985/wsman',
|
174
|
+
operation_timeout: 'PT60S'
|
175
|
+
}
|
176
|
+
end
|
177
|
+
describe '#create_with_defaults' do
|
178
|
+
it 'raises an error' do
|
179
|
+
expect { WinRM::ConnectionOpts.create_with_defaults(overrides) }.to raise_error
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'winrm'
|
2
|
+
require 'winrm/shells/cmd'
|
3
|
+
require 'winrm/shells/power_shell'
|
4
|
+
|
5
|
+
describe WinRM::Connection do
|
6
|
+
context 'new' do
|
7
|
+
it 'creates a new winrm session' do
|
8
|
+
connection = WinRM::Connection.new(default_connection_opts)
|
9
|
+
expect(connection).not_to be_nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'shell(:cmd)' do
|
14
|
+
it 'creates a new cmd session' do
|
15
|
+
connection = WinRM::Connection.new(default_connection_opts)
|
16
|
+
cmd_shell = connection.shell(:cmd)
|
17
|
+
expect(cmd_shell).not_to be_nil
|
18
|
+
expect(cmd_shell).to be_an_instance_of(WinRM::Shells::Cmd)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'shell(:powershell)' do
|
23
|
+
it 'creates a new powershell session' do
|
24
|
+
connection = WinRM::Connection.new(default_connection_opts)
|
25
|
+
cmd_shell = connection.shell(:powershell)
|
26
|
+
expect(cmd_shell).not_to be_nil
|
27
|
+
expect(cmd_shell).to be_an_instance_of(WinRM::Shells::Powershell)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'shell(:not_a_real_shell_type)' do
|
32
|
+
it 'raises a descriptive error' do
|
33
|
+
connection = WinRM::Connection.new(default_connection_opts)
|
34
|
+
expect { connection.shell(:not_a_real_shell_type) }.to raise_error(WinRM::InvalidShellError)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
describe 'Exceptions' do
|
2
|
+
describe WinRM::WinRMAuthorizationError do
|
3
|
+
let(:error) { WinRM::WinRMHTTPTransportError.new('Foo happened', 500) }
|
4
|
+
|
5
|
+
it 'adds the response code to the message' do
|
6
|
+
expect(error.message).to eq('Foo happened (500).')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'exposes the response code as an attribute' do
|
10
|
+
expect(error.status_code).to eq 500
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'is a winrm error' do
|
14
|
+
expect(error).to be_kind_of(WinRM::WinRMError)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe WinRM::WinRMWSManFault do
|
19
|
+
let(:error) { WinRM::WinRMWSManFault.new('fault text', 42) }
|
20
|
+
|
21
|
+
it 'exposes the fault text as an attribute' do
|
22
|
+
expect(error.fault_description).to eq('fault text')
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'exposes the fault code as an attribute' do
|
26
|
+
expect(error.fault_code).to eq 42
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is a winrm error' do
|
30
|
+
expect(error).to be_kind_of(WinRM::WinRMError)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe WinRM::WinRMWMIError do
|
35
|
+
let(:error) { WinRM::WinRMWMIError.new('message text', 77_777) }
|
36
|
+
|
37
|
+
it 'exposes the error text as an attribute' do
|
38
|
+
expect(error.error).to eq('message text')
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'exposes the error code as an attribute' do
|
42
|
+
expect(error.error_code).to eq 77_777
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'is a winrm error' do
|
46
|
+
expect(error).to be_kind_of(WinRM::WinRMError)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'winrm/exceptions'
|
2
|
+
require 'winrm/http/transport_factory'
|
3
|
+
|
4
|
+
module WinRM
|
5
|
+
module HTTP
|
6
|
+
# Remove the gssapi stuff in kerberos init for tests
|
7
|
+
class HttpGSSAPI < HttpTransport
|
8
|
+
def initialize(endpoint, realm, opts, service = nil) end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe WinRM::HTTP::TransportFactory do
|
14
|
+
describe '#create_transport' do
|
15
|
+
let(:transport) { :negotiate }
|
16
|
+
let(:options) do
|
17
|
+
{
|
18
|
+
transport: transport,
|
19
|
+
endpoint: 'endpoint',
|
20
|
+
user: 'user'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'creates a negotiate transport' do
|
25
|
+
options[:transport] = :negotiate
|
26
|
+
expect(subject.create_transport(options)).to be_a(WinRM::HTTP::HttpNegotiate)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'creates a plaintext transport' do
|
30
|
+
options[:transport] = :plaintext
|
31
|
+
expect(subject.create_transport(options)).to be_a(WinRM::HTTP::HttpPlaintext)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'creates a basic auth ssl transport' do
|
35
|
+
options[:transport] = :ssl
|
36
|
+
options[:basic_auth_only] = true
|
37
|
+
expect(subject.create_transport(options)).to be_a(WinRM::HTTP::BasicAuthSSL)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'creates a client cert ssl transport' do
|
41
|
+
options[:transport] = :ssl
|
42
|
+
options[:client_cert] = 'cert'
|
43
|
+
expect(subject.create_transport(options)).to be_a(WinRM::HTTP::ClientCertAuthSSL)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'creates a negotiate over ssl transport' do
|
47
|
+
options[:transport] = :ssl
|
48
|
+
expect(subject.create_transport(options)).to be_a(WinRM::HTTP::HttpNegotiate)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'creates a kerberos transport' do
|
52
|
+
options[:transport] = :kerberos
|
53
|
+
expect(subject.create_transport(options)).to be_a(WinRM::HTTP::HttpGSSAPI)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'creates a transport from a stringified transport' do
|
57
|
+
options[:transport] = 'negotiate'
|
58
|
+
expect(subject.create_transport(options)).to be_a(WinRM::HTTP::HttpNegotiate)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'raises when transport type does not exist' do
|
62
|
+
options[:transport] = :fancy
|
63
|
+
expect { subject.create_transport(options) }.to raise_error(WinRM::InvalidTransportError)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rubyntlm'
|
2
|
+
require 'winrm/http/transport'
|
3
|
+
|
4
|
+
describe WinRM::HTTP::HttpNegotiate do
|
5
|
+
describe '#init' do
|
6
|
+
let(:endpoint) { 'some_endpoint' }
|
7
|
+
let(:domain) { 'some_domain' }
|
8
|
+
let(:user) { 'some_user' }
|
9
|
+
let(:password) { 'some_password' }
|
10
|
+
let(:options) { {} }
|
11
|
+
|
12
|
+
context 'user is not domain prefixed' do
|
13
|
+
it 'does not pass a domain to the NTLM client' do
|
14
|
+
expect(Net::NTLM::Client).to receive(:new).with(user, password, options)
|
15
|
+
WinRM::HTTP::HttpNegotiate.new(endpoint, user, password, options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'user is domain prefixed' do
|
20
|
+
it 'passes prefixed domain to the NTLM client' do
|
21
|
+
expect(Net::NTLM::Client).to receive(:new) do |passed_user, passed_password, passed_options|
|
22
|
+
expect(passed_user).to eq user
|
23
|
+
expect(passed_password).to eq password
|
24
|
+
expect(passed_options[:domain]).to eq domain
|
25
|
+
end
|
26
|
+
WinRM::HTTP::HttpNegotiate.new(endpoint, "#{domain}\\#{user}", password, options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'option is passed with a domain' do
|
31
|
+
let(:options) { { domain: domain } }
|
32
|
+
|
33
|
+
it 'passes domain option to the NTLM client' do
|
34
|
+
expect(Net::NTLM::Client).to receive(:new) do |passed_user, passed_password, passed_options|
|
35
|
+
expect(passed_user).to eq user
|
36
|
+
expect(passed_password).to eq password
|
37
|
+
expect(passed_options[:domain]).to eq domain
|
38
|
+
end
|
39
|
+
WinRM::HTTP::HttpNegotiate.new(endpoint, user, password, options)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|