force remove mac address after restoring snapshot

This commit is contained in:
Kay0u 2023-05-22 12:57:17 +02:00
parent 33a8934c0d
commit fb03d3edea
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
2 changed files with 3 additions and 3 deletions

View file

@ -30,6 +30,9 @@ start_container () {
restore_snapshot "$CONTAINER_IMAGE" "$CURRENT_VERSION" "$SNAPSHOT_NAME" restore_snapshot "$CONTAINER_IMAGE" "$CURRENT_VERSION" "$SNAPSHOT_NAME"
# Unset the mac address to ensure the copy will get a new one and will be able to get new IP
lxc config unset "$CONTAINER_IMAGE" volatile.eth0.hwaddr 2> /dev/null
lxc start $CONTAINER_IMAGE lxc start $CONTAINER_IMAGE
wait_container $CONTAINER_IMAGE wait_container $CONTAINER_IMAGE

View file

@ -98,9 +98,6 @@ create_snapshot()
local ynh_version=$2 local ynh_version=$2
local snapshot=$3 local snapshot=$3
# Unset the mac address to ensure the copy will get a new one and will be able to get new IP
lxc config unset "$image_to_rebuild" volatile.eth0.hwaddr 2> /dev/null
# Create snapshot # Create snapshot
lxc snapshot "$instance_to_publish" "$ynh_version-$snapshot" --reuse lxc snapshot "$instance_to_publish" "$ynh_version-$snapshot" --reuse
} }