Skip to content

Commit

Permalink
tests: containerize vagrant commands with podman
Browse files Browse the repository at this point in the history
Added a function to wrap vagrant commands within a podman container

Signed-off-by: Guillaume Abrioux <[email protected]>
  • Loading branch information
guits committed Jun 18, 2024
1 parent 4dc7d96 commit 615b5f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/scripts/generate_ssh_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Generate a custom ssh config from Vagrant so that it can then be used by
# ansible.cfg

source vagrant.sh

path=$1

if [ $# -eq 0 ]
Expand Down
16 changes: 16 additions & 0 deletions tests/scripts/vagrant.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

vagrant(){
podman run -it --rm \
-e LIBVIRT_DEFAULT_URI \
-e SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" \
-v /var/run/libvirt/:/var/run/libvirt/ \
-v ~/.vagrant.d:/.vagrant.d \
-v $(realpath "${PWD}"):${PWD} \
-w "${PWD}" \
--network host \
--entrypoint /bin/bash \
--security-opt label=disable \
docker.io/vagrantlibvirt/vagrant-libvirt:latest \
vagrant $@
}
5 changes: 5 additions & 0 deletions tests/scripts/vagrant_up.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash
set -x

source vagrant.sh

test -d ~/.vagrant.d || mkdir ~/.vagrant.d

if [[ -n $1 ]]; then
DIRECTORY=$1
shift
Expand Down

0 comments on commit 615b5f6

Please sign in to comment.