From 0d93f4f12c4c7d0a37dc2e6f792ce0f9dde793db Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 14 Sep 2015 21:49:05 -0400 Subject: Allow storing arbitrary ByteStrings in PrivData, extracted using privDataByteString. --- src/Propellor/Types/PrivData.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Propellor/Types') 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) -- cgit v1.2.3