Last active
May 28, 2019 22:38
-
-
Save ffrank/e3e1a706b616155be9a06ad6af90dc8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mount "/mnt/acceptance_mount" { | |
state => "exists", | |
device => "/tmp/loopdevice", | |
type => "ext2", | |
options => { | |
"rw"=>"", | |
"loop"=>"", | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fail() | |
{ | |
echo >&2 "FATAL - $@" | |
exit 1 | |
} | |
assert() | |
{ | |
eval "$@" | |
if [ $? -ne 0 ] ; then | |
fail "ASSERTION: $@" | |
fi | |
} | |
mount_point=/mnt/acceptance_mount | |
fs_file=/tmp/loopdevice | |
manifest="mount { '$mount_point': device => '$fs_file', ensure => 'mounted' }" | |
mkdir -p $mount_point \ | |
|| fail "could not prepare mount point at $mount_point" | |
dd if=/dev/zero of=$fs_file bs=1M count=10 \ | |
|| fail "could not create empty file $fs_file" | |
mke2fs $fs_file \ | |
|| fail "could not create filesystem in file $fs_file" | |
mgmt run --tmp-prefix --converged-timeout 5 \ | |
puppet 'mount { "'$mount_point'": device => "'$fs_file'", fstype => "ext2", options => "loop,rw", ensure => "mounted" }' | |
assert grep -q $fs_file /proc/mounts | |
mgmt run --tmp-prefix --converged-timeout 5 \ | |
puppet 'mount { "'$mount_point'": device => "'$fs_file'", ensure => "unmounted" }' | |
assert ! grep -q $fs_file /proc/mounts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment