propellor spin
This commit is contained in:
parent
b5af98d744
commit
0aa635dbd2
|
@ -52,7 +52,7 @@ import qualified Propellor.Property.User as User
|
||||||
-- > -- rest of system properties here
|
-- > -- rest of system properties here
|
||||||
cleanInstallOnce :: Confirmation -> Property
|
cleanInstallOnce :: Confirmation -> Property
|
||||||
cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $
|
cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $
|
||||||
confirmed
|
confirmed "clean install confirmed" confirmation
|
||||||
`before`
|
`before`
|
||||||
osbootstrapped
|
osbootstrapped
|
||||||
`before`
|
`before`
|
||||||
|
@ -64,10 +64,6 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $
|
||||||
`before`
|
`before`
|
||||||
finalized
|
finalized
|
||||||
where
|
where
|
||||||
confirmed = property "clean install confirmed" $ do
|
|
||||||
checkConfirmed confirmation
|
|
||||||
return NoChange
|
|
||||||
|
|
||||||
osbootstrapped = withOS "/new-os bootstrapped" $ \o -> case o of
|
osbootstrapped = withOS "/new-os bootstrapped" $ \o -> case o of
|
||||||
(Just d@(System (Debian _) _)) -> debootstrap d
|
(Just d@(System (Debian _) _)) -> debootstrap d
|
||||||
(Just u@(System (Ubuntu _) _)) -> debootstrap u
|
(Just u@(System (Ubuntu _) _)) -> debootstrap u
|
||||||
|
@ -97,11 +93,14 @@ cleanInstallOnce confirmation = check (not <$> doesFileExist flagfile) $
|
||||||
|
|
||||||
data Confirmation = Confirmed HostName
|
data Confirmation = Confirmed HostName
|
||||||
|
|
||||||
checkConfirmed :: Confirmation -> Propellor ()
|
confirmed :: Desc -> Confirmation -> Property
|
||||||
checkConfirmed (Confirmed c) = do
|
confirmed desc (Confirmed c) = property desc $ do
|
||||||
hostname <- asks hostName
|
hostname <- asks hostName
|
||||||
when (hostname /= c) $
|
if hostname /= c
|
||||||
errorMessage "Run with a bad confirmation, not matching hostname."
|
then do
|
||||||
|
warningMessage "Run with a bad confirmation, not matching hostname."
|
||||||
|
return FailedChange
|
||||||
|
else return NoChange
|
||||||
|
|
||||||
-- /etc/network/interfaces is configured to bring up all interfaces that
|
-- /etc/network/interfaces is configured to bring up all interfaces that
|
||||||
-- are currently up, using the same IP addresses.
|
-- are currently up, using the same IP addresses.
|
||||||
|
@ -142,9 +141,10 @@ type GrubDev = String
|
||||||
|
|
||||||
-- Removes the old OS's backup from /old-os
|
-- Removes the old OS's backup from /old-os
|
||||||
oldOSRemoved :: Confirmation -> Property
|
oldOSRemoved :: Confirmation -> Property
|
||||||
oldOSRemoved confirmed = check (doesDirectoryExist oldOsDir) $
|
oldOSRemoved confirmation = check (doesDirectoryExist oldOsDir) $
|
||||||
property "old OS backup removed" $ do
|
go `requires` confirmed "old OS backup removal confirmed" confirmation
|
||||||
checkConfirmed confirmed
|
where
|
||||||
|
go = property "old OS backup removed" $ do
|
||||||
liftIO $ removeDirectoryRecursive oldOsDir
|
liftIO $ removeDirectoryRecursive oldOsDir
|
||||||
return MadeChange
|
return MadeChange
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue