ganeti
Safe HaskellNone

Ganeti.Ssconf

Description

Implementation of the Ganeti Ssconf interface.

Synopsis

Reading individual ssconf entries

maxFileSize :: Int Source #

Maximum ssconf file size we support.

sSFilePrefix :: FilePath Source #

ssconf file prefix, re-exported from Constants.

data SSKey Source #

Instances

Instances details
Bounded SSKey # 
Instance details

Defined in Ganeti.Ssconf

Enum SSKey # 
Instance details

Defined in Ganeti.Ssconf

Eq SSKey # 
Instance details

Defined in Ganeti.Ssconf

Methods

(==) :: SSKey -> SSKey -> Bool

(/=) :: SSKey -> SSKey -> Bool

Ord SSKey # 
Instance details

Defined in Ganeti.Ssconf

Methods

compare :: SSKey -> SSKey -> Ordering

(<) :: SSKey -> SSKey -> Bool

(<=) :: SSKey -> SSKey -> Bool

(>) :: SSKey -> SSKey -> Bool

(>=) :: SSKey -> SSKey -> Bool

max :: SSKey -> SSKey -> SSKey

min :: SSKey -> SSKey -> SSKey

Show SSKey # 
Instance details

Defined in Ganeti.Ssconf

Methods

showsPrec :: Int -> SSKey -> ShowS

show :: SSKey -> String

showList :: [SSKey] -> ShowS

HasStringRepr SSKey # 
Instance details

Defined in Ganeti.Ssconf

Methods

fromStringRepr :: MonadFail m => String -> m SSKey Source #

toStringRepr :: SSKey -> String Source #

Arbitrary SSKey 
Instance details

Defined in Test.Ganeti.Ssconf

Methods

arbitrary :: Gen SSKey

shrink :: SSKey -> [SSKey]

sSKeyFromRaw :: forall m. (Monad m, MonadFail m) => String -> m SSKey Source #

sSKeyToRaw :: SSKey -> String Source #

hvparamsSSKey :: Hypervisor -> SSKey Source #

For a given hypervisor get the corresponding SSConf key that contains its parameters.

The corresponding SSKeys are generated automatically by TH, but since we don't have convenient infrastructure for generating this function, it's just manual. All constructors must be given explicitly so that adding another hypervisor will trigger "incomplete pattern" warning and force the corresponding addition.

keyToFilename Source #

Arguments

:: FilePath

Config path root

-> SSKey

Ssconf key

-> FilePath

Full file name

Convert a ssconf key into a (full) file path.

catchIOErrors Source #

Arguments

:: Maybe a

Optional default

-> IO a

Action to run

-> IO (Result a) 

Runs an IO action while transforming any error into Bad values. It also accepts an optional value to use in case the error is just does not exist.

readSSConfFile Source #

Arguments

:: Maybe FilePath

Optional config path override

-> Maybe String

Optional default value

-> SSKey

Desired ssconf key

-> IO (Result String) 

Read an ssconf file.

parseKeyValue :: MonadFail m => String -> String -> m (String, String) Source #

Parses a key-value pair of the form "key=value" from str, fails with desc otherwise.

parseIPFamily :: Int -> Result Family Source #

Parses a string containing an IP family

getPrimaryIPFamily :: Maybe FilePath -> IO (Result Family) Source #

Read the primary IP family.

parseNodesVmCapable :: String -> Result [(String, Bool)] Source #

Parse the nodes vm capable value from a String.

getNodesVmCapable :: Maybe FilePath -> IO (Result [(String, Bool)]) Source #

Read and parse the nodes vm capable.

getMasterCandidatesIps :: Maybe FilePath -> IO (Result [String]) Source #

Read the list of IP addresses of the master candidates of the cluster.

getMasterNode :: Maybe FilePath -> IO (Result String) Source #

Read the name of the master node.

parseHypervisorList :: String -> Result [Hypervisor] Source #

Parse the list of enabled hypervisors from a String.

getHypervisorList :: Maybe FilePath -> IO (Result [Hypervisor]) Source #

Read and parse the list of enabled hypervisors.

parseEnabledUserShutdown :: String -> Result Bool Source #

Parse whether user shutdown is enabled from a String.

getEnabledUserShutdown :: Maybe FilePath -> IO (Result Bool) Source #

Read and parse whether user shutdown is enabled.

Working with the whole ssconf map

newtype SSConf Source #

The data type used for representing the ssconf.

Constructors

SSConf 

Fields

Instances

Instances details
Eq SSConf # 
Instance details

Defined in Ganeti.Ssconf

Methods

(==) :: SSConf -> SSConf -> Bool

(/=) :: SSConf -> SSConf -> Bool

Ord SSConf # 
Instance details

Defined in Ganeti.Ssconf

Methods

compare :: SSConf -> SSConf -> Ordering

(<) :: SSConf -> SSConf -> Bool

(<=) :: SSConf -> SSConf -> Bool

(>) :: SSConf -> SSConf -> Bool

(>=) :: SSConf -> SSConf -> Bool

max :: SSConf -> SSConf -> SSConf

min :: SSConf -> SSConf -> SSConf

Show SSConf # 
Instance details

Defined in Ganeti.Ssconf

Methods

showsPrec :: Int -> SSConf -> ShowS

show :: SSConf -> String

showList :: [SSConf] -> ShowS

JSON SSConf # 
Instance details

Defined in Ganeti.Ssconf

Methods

readJSON :: JSValue -> Result SSConf

showJSON :: SSConf -> JSValue

readJSONs :: JSValue -> Result [SSConf]

showJSONs :: [SSConf] -> JSValue

Arbitrary SSConf 
Instance details

Defined in Test.Ganeti.Ssconf

Methods

arbitrary :: Gen SSConf

shrink :: SSConf -> [SSConf]