On Mon, Sep 16, 2013 at 1:53 PM, Jose A. Lopes <[email protected]> wrote:
> Interdiff: > > * fix 'Ganeti.Runtime' after pulling fix for issue 575. > > * add extra logreason constants, namely, 'extraLogreasonAccess' and > 'extraLogreasonError', to the Haskell to Python constants > generation. In Haskell, these constants were moved to > 'Ganeti.Runtime', therefore, the Python couterparts must be updated > to fetch their values from the generated constants module. > > Signed-off-by: Jose A. Lopes <[email protected]> > --- > lib/constants.py | 4 ++-- > src/Ganeti/HsConstants.hs | 16 +++++++++++++++- > src/Ganeti/Runtime.hs | 9 +++------ > 3 files changed, 20 insertions(+), 9 deletions(-) > > diff --git a/lib/constants.py b/lib/constants.py > index f7e83f2..1540a4c 100644 > --- a/lib/constants.py > +++ b/lib/constants.py > @@ -203,8 +203,8 @@ VALID_EXTRA_LOGREASONS = compat.UniqueFrozenset([ > # These are the extra logfiles, grouped by daemon > DAEMONS_EXTRA_LOGBASE = { > MOND: { > - EXTRA_LOGREASON_ACCESS: "monitoring-daemon-access", > - EXTRA_LOGREASON_ERROR: "monitoring-daemon-error", > + EXTRA_LOGREASON_ACCESS: _constants.EXTRA_LOGREASON_ACCESS, > + EXTRA_LOGREASON_ERROR: _constants.EXTRA_LOGREASON_ERROR, > } > } > > diff --git a/src/Ganeti/HsConstants.hs b/src/Ganeti/HsConstants.hs > index 84796bd..67492b0 100644 > --- a/src/Ganeti/HsConstants.hs > +++ b/src/Ganeti/HsConstants.hs > @@ -38,11 +38,13 @@ module Ganeti.HsConstants where > > import Data.Map (Map) > import qualified Data.Map as Map (fromList) > +import Data.Maybe (fromMaybe) > > import AutoConf > import Ganeti.ConstantUtils (FrozenSet, Protocol(..)) > import qualified Ganeti.ConstantUtils as ConstantUtils (mkSet, > exitFailure) > -import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..)) > +import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..), > + ExtraLogReason(..)) > import qualified Ganeti.Runtime as Runtime > > -- * Admin states > @@ -166,6 +168,18 @@ daemonsPorts = > (rapi, (Tcp, defaultRapiPort)), > (ssh, (Tcp, 22))] > > +extraLogreasonAccess :: String > +extraLogreasonAccess = > + fromMaybe > + (fail "Failed to retrieve the monitoring daemon access log") > + (Runtime.daemonsExtraLogbase GanetiMond AccessLog) > Maybe I'm mistaken, but shouldn't the first parameter of "fromMaybe" be of the same type as its result value? Here the result value is string, according to the signature, but the first parameter is 'fail "..."', which is a monadic value. > + > +extraLogreasonError :: String > +extraLogreasonError = > + fromMaybe > + (fail "Failed to retrieve the monitoring daemon error log") > + (Runtime.daemonsExtraLogbase GanetiMond ErrorLog) > + > -- * Possible values for NodeGroup.alloc_policy > > allocPolicyLastResort :: String > diff --git a/src/Ganeti/Runtime.hs b/src/Ganeti/Runtime.hs > index 343b395..0f323c6 100644 > --- a/src/Ganeti/Runtime.hs > +++ b/src/Ganeti/Runtime.hs > @@ -35,6 +35,7 @@ module Ganeti.Runtime > , daemonGroup > , ExtraLogReason(..) > , daemonLogFile > + , daemonsExtraLogbase > , daemonsExtraLogFile > , daemonPidFile > , getEnts > @@ -126,12 +127,8 @@ daemonGroup (ExtraGroup AdminGroup) = > AutoConf.adminGroup > data ExtraLogReason = AccessLog | ErrorLog > > daemonsExtraLogbase :: GanetiDaemon -> ExtraLogReason -> Maybe String > -daemonsExtraLogbase GanetiMond AccessLog = > - Just C.daemonsExtraLogbaseGanetiMondAccess > - > -daemonsExtraLogbase GanetiMond ErrorLog = > - Just C.daemonsExtraLogbaseGanetiMondError > - > +daemonsExtraLogbase GanetiMond AccessLog = Just "monitoring-daemon-access" > +daemonsExtraLogbase GanetiMond ErrorLog = Just "monitoring-daemon-error" > daemonsExtraLogbase _ _ = Nothing > > -- | Returns the log file for a daemon. > -- > 1.8.4 > > Thanks, Michele -- Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
