Skip to content

Commit

Permalink
Update to the lock recipe so that it shows you who currently has the …
Browse files Browse the repository at this point in the history
…lock on the deployment
  • Loading branch information
valguss committed Mar 22, 2022
1 parent 8a41b3f commit b6fd56c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions recipe/deploy/lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
$user = escapeshellarg(get('user'));
$locked = run("[ -f {{deploy_path}}/.dep/deploy.lock ] && echo +locked || echo $user > {{deploy_path}}/.dep/deploy.lock");
if ($locked === '+locked') {
$lockedUser = run("cat {{deploy_path}}/.dep/deploy.lock");
throw new GracefulShutdownException(
"Deploy locked.\n" .
"Deploy locked by $lockedUser.\n" .
"Execute \"deploy:unlock\" task to unlock."
);
}
Expand All @@ -24,7 +25,8 @@
task('deploy:is_locked', function () {
$locked = test("[ -f {{deploy_path}}/.dep/deploy.lock ]");
if ($locked) {
throw new GracefulShutdownException("Deploy is locked.");
$lockedUser = run("cat {{deploy_path}}/.dep/deploy.lock");
throw new GracefulShutdownException("Deploy is locked by $lockedUser.");
}
info('Deploy is unlocked.');
});

0 comments on commit b6fd56c

Please sign in to comment.