After three years of using BOSH I'm still surprised that
bosh cancel task is relatively ineffective. It doesn't immediately cancel the task; rather it registers the request, and patiently waits for the current task to get into a state where you could safely cancel it. Which is almost never what you want. You know something is wrong and you want to cancel the task NOW.
More importantly perhaps: you want to unlock the current deployment.
BOSH has a lock over each deployment - you can only perform one deployment per deployment name at a time. So if you cannot cancel a task that has locked a deployment, then you cannot perform a subsequent task.
The rest of this article documents how to find and delete a lock.
Where is a BOSH lock?
BOSH uses Redis for locks. To find the location and password for Redis, look in the Director's configuration:
$ cat /var/vcap/jobs/director/config/director.yml | grep redis -A3 redis: host: 127.0.0.1 port: 25255 password: redis logging: level: info
For a single VM BOSH, Redis will be running on the same host on port
To connected to Redis, add the
redis-cli to the $PATH:
export PATH=$PATH:/var/vcap/packages/redis/bin redis-cli -p 25255 -a redis
To find the lock, look up all current locks:
> keys "lock:*" 1) "lock:deployment:my-locked-deployment"
There it is - the "deployment" lock for deployment "my-locked-deployment".
Delete it with Redis command
> del lock:deployment:my-locked-deployment (integer) 1