summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/PrivData.hs
diff options
context:
space:
mode:
authorJoey Hess2015-09-14 21:49:05 -0400
committerJoey Hess2015-09-14 21:49:05 -0400
commit0d93f4f12c4c7d0a37dc2e6f792ce0f9dde793db (patch)
tree082fb29222fb901c9ef34baae7af9700340e79c0 /src/Propellor/Types/PrivData.hs
parentfb7b1826870c8a0e01f88da74ff2fd98a0626d5b (diff)
Allow storing arbitrary ByteStrings in PrivData, extracted using privDataByteString.
Diffstat (limited to 'src/Propellor/Types/PrivData.hs')
-rw-r--r--src/Propellor/Types/PrivData.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Propellor/Types/PrivData.hs b/src/Propellor/Types/PrivData.hs
index c72838cb..98cdb7a1 100644
--- a/src/Propellor/Types/PrivData.hs
+++ b/src/Propellor/Types/PrivData.hs
@@ -2,8 +2,10 @@ module Propellor.Types.PrivData where
import Propellor.Types.OS
import Utility.PartialPrelude
+import Utility.FileSystemEncoding
import Data.Maybe
+import qualified Data.ByteString.Lazy as L
-- | Note that removing or changing constructors or changing types will
-- break the serialized privdata files, so don't do that!
@@ -110,6 +112,10 @@ privDataLines (PrivData s) = lines s
privDataVal :: PrivData -> String
privDataVal (PrivData s) = fromMaybe "" (headMaybe (lines s))
+-- | Use to get ByteString out of PrivData.
+privDataByteString :: PrivData -> L.ByteString
+privDataByteString (PrivData s) = encodeBS s
+
data SshKeyType = SshRsa | SshDsa | SshEcdsa | SshEd25519
deriving (Read, Show, Ord, Eq, Enum, Bounded)