mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-10-05 20:07:38 +03:00
fix: Error on release path activation (#216)
* fix: Change place where validation happens * chore: Change error message
This commit is contained in:
parent
dcd59383d7
commit
05c194375e
@ -120,14 +120,10 @@ activateRelease
|
||||
-> Hapistrano ()
|
||||
activateRelease ts deployPath release = do
|
||||
rpath <- releasePath deployPath release Nothing
|
||||
isRpathExist <- doesDirExist rpath
|
||||
if isRpathExist then do
|
||||
let tpath = tempSymlinkPath deployPath
|
||||
cpath = currentSymlinkPath deployPath
|
||||
exec (Ln ts rpath tpath) (Just release) -- create a symlink for the new candidate
|
||||
exec (Mv ts tpath cpath) (Just release) -- atomically replace the symlink
|
||||
else
|
||||
failWith 1 (Just $ "The release path '" <> show rpath <> "' cannot be activated.") (Just release)
|
||||
let tpath = tempSymlinkPath deployPath
|
||||
cpath = currentSymlinkPath deployPath
|
||||
exec (Ln ts rpath tpath) (Just release) -- create a symlink for the new candidate
|
||||
exec (Mv ts tpath cpath) (Just release) -- atomically replace the symlink
|
||||
|
||||
-- | Creates the file @.hapistrano__state@ containing
|
||||
-- @fail@ or @success@ depending on how the deployment ended.
|
||||
@ -209,7 +205,12 @@ rollback ts deployPath n mbRestartCommand = do
|
||||
releases <- releasesWithState Success deployPath
|
||||
case genericDrop n releases of
|
||||
[] -> failWith 1 (Just "Could not find the requested release to rollback to.") Nothing
|
||||
(x:_) -> activateRelease ts deployPath x
|
||||
(x:_) -> do
|
||||
rpath <- releasePath deployPath x Nothing
|
||||
isRpathExist <- doesDirExist rpath
|
||||
if isRpathExist
|
||||
then activateRelease ts deployPath x
|
||||
else failWith 1 (Just $ "Cannot rollback to the release path '" <> show rpath <> "'.") (Just x)
|
||||
forM_ mbRestartCommand (`exec` Nothing)
|
||||
|
||||
-- | Remove older releases to avoid filling up the target host filesystem.
|
||||
|
Loading…
Reference in New Issue
Block a user