1040 Commits

Author SHA1 Message Date
Chris Roberts
0a20379b1a Enable deprecated key type and host key algorithm
Recent versions of OpenSSH remove support of ssh-rsa key types and host
key algorithms from the default conection configuration. Set options to
enable them and provide a configuration option which can disable them if
required.
2023-05-22 17:09:47 -07:00
Chris Roberts
1f26256680 Release file lock before file deletion
When unlocking the file mutex utility always unlock the file prior to
deletion to ensure the file can be properly deleted.
2023-05-17 11:13:10 -07:00
sophia
4551b8b2ad Use file locks to avoid file existance checking race conditions 2023-02-22 14:28:00 -08:00
sophia
f153996b2d Add tests for mutex util module 2023-01-13 14:08:27 -08:00
sophia
83efa09dfa Test box download mutex 2023-01-12 16:30:05 -08:00
Chris Roberts
2fe4056a7d Fix test using File.exists? to use non-deprecated name 2022-11-14 10:11:00 -08:00
Dan Čermák
be63d8a88f
Mark box_collection_test to require bsdtar
These tests implicitly require bsdtar and should be skipped if the binary is not
available.
2022-11-01 15:25:39 +01:00
Chris Roberts
c7ef689d86 Prevent trailing space character on user agent 2022-09-28 13:51:54 -07:00
Chris Roberts
c13c0feabf
Merge pull request #12885 from wbclark/12884_keys_only_fix
(#12884) Use default ssh.private_key_path when ssh.keys_only = false
2022-09-21 13:21:27 -07:00
Chris Roberts
7d7ad89ac5 Provide helpful error message on invalid version
When a box version (or constraint) is provided with an invalid
format, rescue the error and return a customized error with
information for the user explaining the problem.
2022-09-21 11:21:24 -07:00
sophia
115bec2b05 Add test for validating box metadata.json 2022-09-14 14:05:27 -04:00
William Bradford Clark
15df2c69b4 (#12884) Use default ssh.private_key_path when ssh.keys_only = false 2022-09-10 02:16:51 -04:00
Sophia Castellarin
14e825b8d0
Merge pull request #12753 from dcermak/bump-fake_ftp
Bump fake_ftp to ~> 0.3.0 & adjust tests
2022-08-01 13:23:00 -05:00
Paul Hinze
1b93691b8a
Merge pull request #12567 from electrofelix/improve-gem-resolving
Improve Gem spec selection when resolving
2022-08-01 12:49:16 -05:00
sophia
df94a36568 Patch fake_ftp for determining the size of files 2022-08-01 11:30:29 -05:00
Dan Čermák
73ee447c87 Stop using the last argument as kwargs in unit tests
A few unit tests started failing with Ruby 3.0, because they were relying on
keyword arguments being converted into hashes automatically. This behavior was
deprecated in Ruby 2.7 and results in errors in Ruby 3.0 onward.

For further details:
https://rubyreferences.github.io/rubychanges/3.0.html#keyword-arguments-are-now-fully-separated-from-positional-arguments
2022-07-28 14:45:47 -05:00
Paul Hinze
ee8883153c
Make Docker provider work again post config refactor
- Allow machine.box to be empty without sadness (depends on
   https://github.com/hashicorp/vagrant-plugin-sdk/pull/182)
 - Get synced folder type from plugin name instead of defaulting to
   :virtualbox
2022-07-08 11:36:27 -05:00
sophia
1913864212 Update remote machine test for fully go backed machine 2022-06-29 16:54:57 -05:00
sophia
fa561cab29 Fill in mock machine client methods 2022-05-04 09:32:36 -05:00
Paul Hinze
b88123fab4
Add unit test for new behavior 2022-04-25 12:26:55 -05:00
Paul Hinze
2707d09181
Fix prepend/append action hooks firing multiple times
This addresses the surprising behavior that the StoreBoxMetadata hook
was running many times during a machine up, including during failed
operations where a destroy_on_error deleted the machine. This was
resulting in an error that looked like:

> No such file or directory @ rb_sysopen [...] /[...]/box_meta

Plugin action hooks using prepend/append were attaching every time a
Builder was run, including sub-Builders that show up for things like
Call actions.

To fix this, we tell Builders if they are "primary" and only run
prepend/append on those. See inline comments for more explanation.
2022-04-25 12:26:55 -05:00
sophia
3e641fbe6b
Stub machine index proto mapper for environment test 2022-04-25 12:26:51 -05:00
Paul Hinze
2906d2c7df
Populate default when synced folder guest type is not set
This helps fix the unit tests that were failing. Also adding a test for
the new behavior
2022-04-25 12:26:44 -05:00
Paul Hinze
06ad1b4565
Fixup tests for Ruby 3.0
This is a pass through test failures and deprecation warnings:

 * Make all ambiguous `.with(..., key: val)` use explicit hashes to
   prevent test failures for argument mismatch in Ruby 3.0
 * Scope down all unbounded `raise_error` to address warnings (remove
   one test that was revealed to be referencing a nonexistent variable
   once the raise_error was scoped.)
 * Update all `any_instance` usage to new syntax to address warnings
 * Allow the service cache to be cleared and do so between some tests
 * Fix a small bug in with_plugin's plugin not found code path (revealed
   by a scoped and_raise)
2022-04-25 12:26:40 -05:00
Paul Hinze
ff86d86ac8
Provisioner Plugins 2022-04-25 12:26:37 -05:00
Paul Hinze
8b6ef27a0f
Fix multiple synced folder handling in server mode
There was a hash assignment that was overriding values when there were
multiple synced folders for a given implementation.

Includes some stub-tastic unit tests to help verify the hash munging
behavior does what it's supposed to do going forward.
2022-04-25 12:26:37 -05:00
Paul Hinze
a841da4fc6
Add a simple push plugin in Go
The only tweak required to get this to work was allowing a DummyConfig
to survive being passed through a remote plugin on the Ruby side.
2022-04-25 12:26:21 -05:00
Darragh Bailey
0c6d6d8e9d Improve Gem spec selection when resolving
When computing the solution set, if a gem is already loaded, make sure
to use the specification of the loaded one instead of the first
available as otherwise there is a risk that when multiple matches are
available the specification for the wrong version may be picked.

When this happens an error message will be triggered that looks like

  can't activate json-2.3.0, already activated json-2.5.1

This can occur for distribution packaged vagrants as well as installs
for development purposes where the ruby install may contain a default
gem spec of an older version than is needed.

Fixes: #12521
Fixes: vagrant-libvirt/vagrant-libvirt#1390
2021-11-01 17:31:48 +00:00
Chris Roberts
bbd1404c1e
Merge pull request #12437 from chrisroberts/line-buf-shell-util
Line buffer utility and shell provisioner usage
2021-06-29 13:11:19 -07:00
Chris Roberts
32757d56e1
Merge pull request #12304 from grahamhub/issue-12191
implement --info flag for package cmd #12191
2021-06-29 13:07:47 -07:00
Chris Roberts
9b232d0ff3 Add test coverage on line buffer util 2021-06-29 11:04:14 -07:00
Chris Roberts
3d0d0148e9 Update tests to use real UI instance
Replaces use of UI doubles within tests to use actual UI instance
    to ensure calls are passing parameters correctly.
2021-06-23 14:04:48 -07:00
Chris Roberts
e7a6f397da Updates for Ruby 3.0 2021-06-21 15:57:46 -07:00
Dan Čermák
b1ba47c52c
Mock the PowerShell.executable method in more tests
On *nix systems we might not have powershell installed and then finding
powershell.exe or pwsh.exe fails in some tests. If we instead mock
self.executable to return "powershell", then the tests pass and don't cause any
side effects.
2021-04-30 09:37:20 +02:00
Chris Roberts
5967a23fa0 Support pwsh executable name for powershell
This updates the powershell detection to look for the `pwsh` executable
    and use it when the powershell executable is not available.
2021-04-28 12:45:48 -07:00
grahamhub
bfa73b06c6 cli: implement --info flag for package #12191 2021-04-15 00:28:41 -05:00
sophia
b480790a8d Add box directly with authed urls 2021-04-05 16:39:01 -05:00
Connor Martin
e041bc7998 add checksum test 2021-03-11 17:47:08 -06:00
Chris Roberts
ae48e960fc Add test for behavior difference when running outside of installer 2021-03-09 08:06:10 -08:00
Chris Roberts
320fb81824 Clean up tests to handle modifications 2021-03-08 17:14:53 -08:00
Sophia Castellarin
d111596446
Merge pull request #12188 from soapy1/vagrant-does-not-reference-empty-string-vm
Don't try to find "" by prefix in the machine index
2021-02-23 14:24:17 -06:00
Sophia Castellarin
181b4ea890
Merge pull request #12177 from soapy1/apply-download-opts-to-metadata
Apply download options to metadata requests
2021-02-23 13:26:53 -06:00
Sophia Castellarin
f2a1e25783
Merge pull request #12189 from soapy1/box-metadata-download-error
Raise error if downloading box metadata fails
2021-02-23 12:39:42 -06:00
sophia
220f346d2b Make shell script for loop shell agnostic 2021-02-22 12:36:54 -06:00
sophia
4b67216d71 Raise error if downloading box metadata fails 2021-02-12 17:07:04 -06:00
sophia
ab1c3c2547 Don't try to find "" by prefix in the machine index 2021-02-11 15:59:15 -06:00
sophia
44f527ff8e Apply download options to metadata requests 2021-02-09 18:33:20 -06:00
Chris Roberts
7f6ab8e166
Merge pull request #12054 from chrisroberts/f-sol-file-resolv
Update solution file to use DependencyRequests and allow prerelease
2020-11-17 15:36:44 -08:00
Chris Roberts
c4eda3f08f Update solution file to use DependencyRequests and allow prerelease
Maintain the solution file persisting dependency information on
    disk but update the runtime representation to
    Gem::Resolver::DependencyRequest instances which are expected
    by the sets when locating matches.

    Properly abide by prerelease setting in customized sets and
    force prerelease matching when in the builtin set. If a request
    is matched on a prerelease, and the request itself is not set
    to allow prereleases, update it to ensure successful resolution.
2020-11-17 13:02:33 -08:00
Chris Roberts
51f4229df9 Provide coverage on behavior of hooks/triggers
Include coverage when converting a builder to an app for
    execution that validates when hooks and triggers are applied,
    ensure they are applied, and that original style triggers
    are only applied once.
2020-11-13 16:05:06 -08:00