diff --git a/capsulflask/shell_scripts/ip-dhcp-host.sh b/capsulflask/shell_scripts/ip-dhcp-host.sh index 31c11d7..77363a3 100755 --- a/capsulflask/shell_scripts/ip-dhcp-host.sh +++ b/capsulflask/shell_scripts/ip-dhcp-host.sh @@ -18,7 +18,14 @@ ipv4_address="$4" if [ "$action" = 'add' ]; then printf "trying to delete any existing (probably expired) dhcp associations for $ipv4_address..." virsh net-update "$network_name" delete ip-dhcp-host "" --live --config || true + + printf "adding $mac_address --> $ipv4_address to $network_name" + virsh net-update "$network_name" "$action" ip-dhcp-host "" --live --config +else + printf "removing $mac_address and $ipv4_address from $network_name if they exist" + virsh net-update "$network_name" "$action" ip-dhcp-host "" --live --config || true + virsh net-update "$network_name" "$action" ip-dhcp-host "" --live --config || true fi -printf "adding $mac_address --> $ipv4_address to $network_name" -virsh net-update "$network_name" "$action" ip-dhcp-host "" --live --config + +