summaryrefslogtreecommitdiff
path: root/src/Propellor/PrivData.hs
diff options
context:
space:
mode:
authorJoey Hess2014-07-06 16:32:05 -0400
committerJoey Hess2014-07-06 16:32:05 -0400
commit5002b5e3915890542286487efb852c16c0ca988d (patch)
treee2fb5a55975ca1644d891f27472a4759bc72c05b /src/Propellor/PrivData.hs
parent77f396175231f52f7658ab8702bcd8f776a82242 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/PrivData.hs')
-rw-r--r--src/Propellor/PrivData.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Propellor/PrivData.hs b/src/Propellor/PrivData.hs
index ac7228f8..10965fe3 100644
--- a/src/Propellor/PrivData.hs
+++ b/src/Propellor/PrivData.hs
@@ -26,6 +26,7 @@ import Utility.SafeCommand
import Utility.Misc
import Utility.FileMode
import Utility.Env
+import Utility.Table
-- | Allows a Property to access the value of a specific PrivDataField,
-- for use in a specific Context.
@@ -90,10 +91,17 @@ editPrivData field context = do
listPrivDataFields :: IO ()
listPrivDataFields = do
m <- decryptPrivData
- putStrLn ("\nAll currently set privdata fields:")
- mapM_ list $ M.keys m
+ putStrLn "\n"
+ let rows = map mkrow (M.keys m)
+ let table = tableWithHeader header rows
+ putStr $ unlines $ formatTable table
where
- list = putStrLn . ("\t" ++) . shellEscape . show
+ header = ["Field", "Context", "Hosts"]
+ mkrow (field, (Context context)) =
+ [ shellEscape $ show field
+ , shellEscape context
+ , "xxx"
+ ]
setPrivDataTo :: PrivDataField -> Context -> PrivData -> IO ()
setPrivDataTo field context value = do