43 Commits

Author SHA1 Message Date
sophia
8bad23d176 Update OpenBSD guest change hostname cap 2020-06-29 17:02:43 -05:00
Tomoyuki Sakurai
35d3be865f Atomically apply new hostname.if(5)
This fixes an issue when the interface being configured is the
interface through which ssh traffic is forwarded.

In a complex scenario, one needs to disable the default interface for
NAT, and use other interface for ssh. In this case, when vagrant run
`ifconfig #{ifname} inet delete`, the second ifconfig that is supposed
to restore interface settings will never be called. This might be a rare
need, but it is also strongly recommended to use `netstart` when
reconfiguring interfaces after updating `hostname.if(5)`.

The issue can be triggered when ssh connection has issues between two
`ifconfig` commands.
2017-12-13 18:34:17 +09:00
Brian Cain
0ac26be4ef (#8917) Fix shell_expand_guest_path capability
Prior to this commit, when the guest capability attempted to expand a
path with spaces it would quote the path passed in. However if the path
also had a relative path those quotes would end up making `printf`
ignore it and not properly expand the path fully. This commit updates
that to first escape the quotes of a path and then pass in the new path
to be expanded.
2017-08-25 10:02:36 -07:00
Brian Cain
2b8f7f67ea Add unit tests for shell_expand_guest_path function 2017-08-15 09:33:29 -07:00
Brian Cain
61c501cc65 Ensure paths with spaces are preserved
Prior to this commit, if a user set the `destination` path to include a
space, the `shell_expand_guest_path` function would remove that space
and return a partial path. This commit updates that to quote the path to
be expanded to preserve the entire path.
2017-08-14 15:34:10 -07:00
Chris Roberts
e62d71b645 Remove comment removal from /etc/hosts file on guests
Fixes: #7794
2017-04-20 17:07:56 -07:00
Chris Roberts
c39b3fbb76 guests/openbsd: Check package installation after installing package
The `pkg_add` command will return `0` when a package requested for
installation is not found. This adds a validation check to ensure
the rsync package is actually installed on the guest.
2016-10-25 12:16:52 -07:00
Chris Roberts
185a7dfc2e guests/rsync do not chown files excluded from sync 2016-08-16 15:13:19 -07:00
Chris Roberts
571659a5d1 guests/openbsd: include -h option on shutdown
For OpenBSD versions prior to 5.7 the `-h` option _must_ be provided
to the `shutdown` command when `-p` is used. Later versions no longer
require the `-h` option but still allow it for compatibility.

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.8?rev=1.40&content-type=text/x-cvsweb-markup
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/shutdown/shutdown.c?rev=1.40&content-type=text/x-cvsweb-markup
2016-08-10 09:14:08 -07:00
Seth Vargo
7868421a21
guests/openbsd: Fix hostname setting 2016-07-18 21:13:00 -04:00
Seth Vargo
07e6d0e707
guests/bsd: Centralize logic for halting guests 2016-06-18 15:06:20 -04:00
Seth Vargo
079acb42cd
guests/bsd: Centralize logic for public key management 2016-06-17 21:36:28 -04:00
Seth Vargo
6284a9ac50
guests/bsd: Move NFS mounting logic into shared
A number of the BSD guests used very old mounting options or just
ignored some parameters entirely. This fixes that.

- Closes #7474
- Fixes #7466
2016-06-17 21:04:23 -04:00
Seth Vargo
0c268f7b3f
guests/bsd: Add shared BSD guest for common behavior 2016-06-17 20:16:36 -04:00
Seth Vargo
b29864f450
Use symbols for defining guest capabilities 2016-06-17 19:55:04 -04:00
Seth Vargo
49ce775b53
Prefix tempfiles with vagrant- 2016-05-31 00:18:16 -04:00
Seth Vargo
7014aa3bab
Remove custom tempfile class
This is not actually providing any additional utility and also causes
namespace conflicts with people trying to use the real Tempfile class.
2016-05-30 23:21:47 -04:00
Seth Vargo
5a4f345363
Use Util::Tempfile when configuring networks
This fixes a fairly large tempfile leak. Vagrant uses a template
renderer to write network configuration files locally to disk. Then,
that temporarily file is uploaded to the remote host and moved into
place. Since Vagrant is such a short-lived process, GC never came along
and cleaned up those tempfiles, resulting in many temporary files being
created through regular Vagrant usage.

The Util::Tempfile class uses a block to ensure the temporary file is
deleted when the block finishes. This API required small tweaks to the
usage, but provides more safety to ensure the files are deleted.
2016-05-28 23:22:34 -04:00
Mitchell Hashimoto
67c14c4889 guests/openbsd: add newline after insert_public_key [GH-5881] 2015-07-05 17:10:10 -07:00
Mitchell Hashimoto
5418e6b85e guests: add remove_public_key to most guests 2014-10-24 10:05:01 -07:00
Kalman Hazins
bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Matt Behrens
a8fb2de7aa remove -v flag from post-rsync chmod
OpenBSD `chmod` does not support the `-v` flag, which causes
`vagrant up` to fail.
2014-05-09 18:31:23 -04:00
Mitchell Hashimoto
326e8012f7 guests/*: setup rsync_pre properly 2014-05-06 18:40:55 -07:00
Mitchell Hashimoto
4ef237a642 synced_folders/rsync: mkdir before rsync 2014-05-06 13:41:37 -07:00
Nikhil Benesch
2df36892dd synced_folders/rsync: only chown when necessary [GH-3525]
Run remote rsync as root to guarantee that rsync can write to guestpath.
This obviates the need to chown the guestpath to the SSH user prior to
sync.

This brings a substantial speedup (2x on a moderately-sized shared
folder) and properly triggers filesystem notifications on only the files
changed by a given sync.
2014-04-25 15:00:12 -04:00
Mitchell Hashimoto
2057d513cb Update CHANGELOG 2014-04-21 13:53:44 -07:00
Maximilian Fischer
a7b70dcf70 OpenBSD support for virtio interfaces
- When using KVM as provider you were not able to configure network
  interfaces that use virtio, because the interface name was strictly
  set to 'em'
2014-04-21 13:53:42 -07:00
Teemu Matilainen
e5f3f1ffe3 Merge pull request #2892 from tmatilai/openbsd
OpenBSD is not a Linux derivative
2014-02-03 18:27:23 -08:00
Teemu Matilainen
3b5d6c65fd guests/openbsd: Ensure that PKG_PATH is set when installing rsync
Depending on the shell, `PKG_PATH` is not necessarily set when Vagrant
runs `pkg_add`.

Ref: GH-2917
2014-02-03 23:17:54 -03:00
Teemu Matilainen
c11820c848 guests/openbsd: Add back insert_public_key cap
Copied from linux guest.
2014-02-03 08:29:54 -03:00
Teemu Matilainen
767f147469 guests/openbsd: OpenBSD is not a Linux derivative 2014-02-03 08:27:57 -03:00
Mitchell Hashimoto
f63ef395f1 Merge branch 'rsync_install' of https://github.com/tmatilai/vagrant into tmatilai-rsync_install
Conflicts:
	plugins/guests/freebsd/plugin.rb
	plugins/guests/netbsd/plugin.rb
	plugins/guests/openbsd/plugin.rb
2014-02-03 12:12:49 +01:00
Teemu Matilainen
023d3115dd guests/{free,net,open}bsd: Add shell_expand_guest_path capability 2014-02-02 17:38:24 -03:00
Teemu Matilainen
ee2ae94c25 synced_folders/rsync: Install rsync on guest if needed
Add new `rsync_installed` and `rsync_install` guest capabilities
to detect and install `rsync`.

Also copy `rsync_pre` capability to all Unix guests.
2014-01-31 02:12:57 -03:00
Tomoyuki Sahara
91db685295 more capabilities for OpenBSD guest 2013-08-28 13:12:09 +09:00
Mitchell Hashimoto
c4422d7198 FreeBSD and OpenBSD guest detection 2013-04-10 14:15:02 -07:00
Mitchell Hashimoto
5e09577a76 Lots more guest capabilities converted 2013-04-04 12:09:40 -07:00
Mitchell Hashimoto
52f3847b0a Laying the foundation for the new guest plugin 2013-04-03 21:47:57 -07:00
Mitchell Hashimoto
bb97351060 Change "channel" to "communicate" in all guests 2013-01-30 10:54:53 -08:00
Mitchell Hashimoto
0fc7cf7f02 Guest halt implementations no longer depend on machine state 2013-01-22 12:09:35 -08:00
Mitchell Hashimoto
1d2beff649 Guests to V2 2012-11-06 21:14:45 -08:00
Mitchell Hashimoto
459d82689e Get rid of autoload use in Guests
I don't use `activated` here because I'd really like to optimize
performance as much as possible, and loading files from disk is
generally slow. So instead of using `activated` I load the file at the
last possible moment which is when the exact class is being requested.

I don't think many people will do this outside of the core, and I'm not
too concerned.
2012-05-23 15:57:43 -07:00
Mitchell Hashimoto
9956e6d012 Better directory structure for plugins 2012-04-20 16:53:01 -07:00