summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
authorFĂ©lix Sipma2015-12-16 19:10:56 +0100
committerJoey Hess2015-12-17 13:28:59 -0400
commit05dafa48efaad859665902c11e179a7cbdd8f433 (patch)
tree08e72a14bfbd74b2664ff79d506b1ba1dad0669c /src/Propellor
parentf3c5e20fa5b21f3317f63bbcc2d43d708d2ae736 (diff)
Gpg: use processTranscript in hasPrivKey and hasPubKey
(cherry picked from commit 21ffe59d0368f5cfe45316b31d661077e372d512)
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Property/Gpg.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Propellor/Property/Gpg.hs b/src/Propellor/Property/Gpg.hs
index dae6e5d7..fe339297 100644
--- a/src/Propellor/Property/Gpg.hs
+++ b/src/Propellor/Property/Gpg.hs
@@ -54,11 +54,9 @@ dotDir (User u) = do
return $ home </> ".gnupg"
hasPrivKey :: GpgKeyId -> User -> IO Bool
-hasPrivKey (GpgKeyId keyid) (User u) = do
- value <- catchMaybeIO $ readProcess "su" ["-c", "gpg --list-secret-keys " ++ keyid, u]
- return $ isJust value
+hasPrivKey (GpgKeyId keyid) (User u) = catchBoolIO $
+ snd <$> processTranscript "su" ["-c", "gpg --list-secret-keys", keyid, u] Nothing
hasPubKey :: GpgKeyId -> User -> IO Bool
-hasPubKey (GpgKeyId keyid) (User u) = do
- value <- catchMaybeIO $ readProcess "su" ["-c", "gpg --list-public-keys " ++ keyid, u]
- return $ isJust value
+hasPubKey (GpgKeyId keyid) (User u) = catchBoolIO $
+ snd <$> processTranscript "su" ["-c", "gpg --list-public-keys", keyid, u] Nothing