Skip to content

Commit

Permalink
migration: Export trust token if needed
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Jul 16, 2024
1 parent 41e7c10 commit 16ec945
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions migration/run_migration_integration_tests-18-04
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ lxc start "$CONTAINER_ONE_NAME"
sleep 5 # Wait for the network to come up
lxc exec "$CONTAINER_ONE_NAME" -- apt update
lxc exec "$CONTAINER_ONE_NAME" -- apt install -y tox python3-dev libssl-dev libffi-dev build-essential criu
lxc exec "$CONTAINER_ONE_NAME" -- lxc config set core.trust_password password
lxc exec "$CONTAINER_ONE_NAME" -- lxc config set core.https_address "[::]"
if lxc exec "$CONTAINER_ONE_NAME" -- lxc info | grep -qwF explicit_trust_token; then
LXD_TOKEN_ONE="$(lxc exec "$CONTAINER_ONE_NAME" -- lxc config trust add --name pylxd --quiet)"
export LXD_TOKEN_ONE
else
lxc exec "$CONTAINER_ONE_NAME" -- lxc config set core.trust_password password
fi
lxc exec "$CONTAINER_ONE_NAME" -- mkdir -p /root/.config/lxc
lxc exec "$CONTAINER_ONE_NAME" -- openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 \
-sha384 -keyout /root/.config/lxc/client.key -out /root/.config/lxc/client.crt -nodes \
Expand All @@ -51,8 +56,13 @@ lxc start "$CONTAINER_TWO_NAME"
sleep 5 # Wait for the network to come up
lxc exec "$CONTAINER_TWO_NAME" -- apt update
lxc exec "$CONTAINER_TWO_NAME" -- apt install -y tox python3-dev libssl-dev libffi-dev build-essential criu
lxc exec "$CONTAINER_TWO_NAME" -- lxc config set core.trust_password password
lxc exec "$CONTAINER_TWO_NAME" -- lxc config set core.https_address "[::]:8443"
if lxc exec "$CONTAINER_TWO_NAME" -- lxc info | grep -qwF explicit_trust_token; then
LXD_TOKEN_TWO="$(lxc exec "$CONTAINER_TWO_NAME" -- lxc config trust add --name pylxd --quiet)"
export LXD_TOKEN_TWO
else
lxc exec "$CONTAINER_TWO_NAME" -- lxc config set core.trust_password password
fi
lxc exec "$CONTAINER_ONE_NAME" -- mkdir -p /root/.config/lxc
lxc exec "$CONTAINER_TWO_NAME" -- openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 \
-sha384 -keyout /root/.config/lxc/client.key -out /root/.config/lxc/client.crt -nodes \
Expand Down

0 comments on commit 16ec945

Please sign in to comment.