Skip to content

Commit

Permalink
fix: extract-image regression (#791)
Browse files Browse the repository at this point in the history
Concurrent node/add-module actions fail on flock acquiring the lock
file.

The lock file is created in a unique path by node/add-module,
preventing the execution of multiple modules installation at the same
time, which normally happens in cluster/create-cluster and
cluster/add-node actions.

Refs NethServer/dev#7058

This commit changes extract-image behavior. The lock file is created
under ./ (the working directory) instead of AGENT_INSTALL_DIR/.
  • Loading branch information
DavidePrincipi authored Jan 24, 2025
1 parent fea1a2f commit b1765d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/imageroot/usr/local/agent/bin/extract-image
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ image=${1:?missing image URL argument}
set -e

# Prevent concurrent execution of this script with a lock file opened with
# an arbitrary high FD number, like 201. The lock is released when the
# script completes:
exec 201>"${AGENT_STATE_DIR:?}"/.extract-image.lock
# an arbitrary high FD number, like 201. The lock is created in the
# working directory, and is released when the script completes:
exec 201>.extract-image.lock
flock --verbose -n 201

lst_file=".imageroot.lst"
Expand Down

0 comments on commit b1765d2

Please sign in to comment.