Skip to content

Commit

Permalink
If plugin_cache_dir specified - lock it to avoid bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxymVlasov committed Feb 8, 2024
1 parent 007b752 commit 819d913
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions hooks/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,10 @@ function common::terraform_init {
fi

# https://github.com/hashicorp/terraform/issues/31964
# if [ -n "$TF_PLUGIN_CACHE_DIR" ]; then
# echo "DBG 1. before lock $dir_path $(date)"
# flock --exclusive 0 #! NOT EXIST IN MAC - https://stackoverflow.com/questions/10526651/mac-os-x-equivalent-of-linux-flock1-command
# fi
if [ -n "$TF_PLUGIN_CACHE_DIR" ]; then
echo "$(date "+%s %N") DBG $dir_path: 1. flock --exclusive"
flock --exclusive 0 #! NOT EXIST IN MAC - https://stackoverflow.com/questions/10526651/mac-os-x-equivalent-of-linux-flock1-command
fi

echo "$(date "+%s %N") DBG $dir_path: 2. before tf init"

Expand All @@ -365,10 +365,10 @@ function common::terraform_init {
fi
fi

# if [ -n "$TF_PLUGIN_CACHE_DIR" ]; then
# flock --unlock 1 #! NOT EXIST IN MAC - https://stackoverflow.com/questions/10526651/mac-os-x-equivalent-of-linux-flock1-command
echo "$(date "+%s %N") DBG $dir_path: 3. after tf init"
# fi
if [ -n "$TF_PLUGIN_CACHE_DIR" ]; then
flock --unlock 1 #! NOT EXIST IN MAC - https://stackoverflow.com/questions/10526651/mac-os-x-equivalent-of-linux-flock1-command
echo "$(date "+%s %N") DBG $dir_path: 3. after tf init. flock --unlock"
fi

return $exit_code
}
Expand Down

0 comments on commit 819d913

Please sign in to comment.