Improve move-machine.sh to handle an unregistered machine
In move-machine.sh, we do....
SOURCES=`zfs list -H -o name | grep -v zroot | grep /$FQDN$ | sed "sZ/'$FQDN$'ZZ" | wc -l `
if [ $SOURCES != 1 ] ;then
echo Found more than one possible ZFS for $HN
exit 2
fi
This is misleading when a host has been unregistered and so $FQDN is unset, because in fact then $SOURCES==0.
I think a reasonable path could be
- if FQDN is not set earlier in the script, give a better error message and exit there.
- Add a "--ignore-fqdn-check" flag whereupon we set FQDN=$HN instead and move on.
I think it's reasonable for us to want to have the option of keeping and operating on backups of recently-deregistered hosts, even though in practice we might instead make the decision that it's time to dispose of the backup.