mirror of
https://github.com/roles-ansible/ansible_role_restic.git
synced 2024-12-11 23:41:32 +01:00
fix: More tweaks to get snapshot-finding to work
Grr! this is really frustrating. We need more "tracking" for the snapshot we created.
This commit is contained in:
parent
ae270aeebd
commit
4cf66ebec4
1 changed files with 6 additions and 4 deletions
|
@ -110,14 +110,16 @@ function cleanup_vol {
|
||||||
[ -d "$path" ] || path="$(dirname "$path")"
|
[ -d "$path" ] || path="$(dirname "$path")"
|
||||||
|
|
||||||
{
|
{
|
||||||
local source="$(findmnt -v -f -J -T ${path} | jq -r '.filesystems[0].source')"
|
local source="$(findmnt -v -J -T ${path} | jq -r '.filesystems[]|.source' | grep '_snap$')"
|
||||||
|
|
||||||
|
if ! grep -q '_snap$' <<< $source; then
|
||||||
|
echo "Snapshot for ${path} could not be found (found: ${source}). Exiting!" && return 1;
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Cleaning up mount ..."
|
echo "Cleaning up mount ..."
|
||||||
umount "${path}"
|
umount "${path}"
|
||||||
|
|
||||||
echo "Cleaning up snapshot ..."
|
echo "Cleaning up snapshot ..."
|
||||||
if ! grep -q '_snap$' <<< $source; then
|
|
||||||
echo "Snapshot for ${path} could not be found (found: ${source}). Exiting!" && return 1;
|
|
||||||
fi
|
|
||||||
umount "${source}"
|
umount "${source}"
|
||||||
lvremove -y "${source}";
|
lvremove -y "${source}";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue