diff --git a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php --- a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php @@ -128,7 +128,20 @@ DrydockResource $resource, DrydockLease $lease) { - // TODO: Remove leased directory + $cmd = $lease->getInterface('command'); + $path = $lease->getAttribute('path'); + + try { + if ($resource->getAttribute('platform') !== 'windows') { + $cmd->execx('rm -rf %s', $path); + } else { + $cmd->execx('rm -Recurse -Force %s', $path); + } + } catch (Exception $ex) { + // We try to clean up, but sometimes files are locked or still in + // use (this is far more common on Windows). There's nothing we can + // do about this, so we ignore it. + } } protected function shouldCloseUnleasedResource(