Revision 37904802 htools/Ganeti/Ssconf.hs

b/htools/Ganeti/Ssconf.hs
83 83
  ])
84 84

  
85 85
-- | Convert a ssconf key into a (full) file path.
86
keyToFilename :: Maybe FilePath     -- ^ Optional config path override
87
              -> SSKey              -- ^ ssconf key
88
              -> FilePath
89
keyToFilename optpath key = fromMaybe Path.dataDir optpath </>
90
                            sSFilePrefix ++ sSKeyToRaw key
86
keyToFilename :: FilePath     -- ^ Config path root
87
              -> SSKey        -- ^ Ssconf key
88
              -> FilePath     -- ^ Full file name
89
keyToFilename cfgpath key = do
90
  cfgpath </> sSFilePrefix ++ sSKeyToRaw key
91 91

  
92 92
-- | Runs an IO action while transforming any error into 'Bad'
93 93
-- values. It also accepts an optional value to use in case the error
......
111 111
               -> SSKey                     -- ^ Desired ssconf key
112 112
               -> IO (Result String)
113 113
readSSConfFile optpath def key = do
114
  result <- catchIOErrors def . readFile . keyToFilename optpath $ key
114
  result <- catchIOErrors def . readFile .
115
            keyToFilename (fromMaybe Path.dataDir optpath) $ key
115 116
  return (liftM (take maxFileSize) result)
116 117

  
117 118
-- | Strip space characthers (including newline). As this is

Also available in: Unified diff