LGTM, thanks On Tue Feb 10 2015 at 3:01:34 PM 'Klaus Aehlig' via ganeti-devel < [email protected]> wrote:
> If no port is specified as a command-line option, prefer > the value of /etc/services over the global default. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/Monitoring/Server.hs | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/src/Ganeti/Monitoring/Server.hs b/src/Ganeti/Monitoring/ > Server.hs > index 24af4a2..bd98d35 100644 > --- a/src/Ganeti/Monitoring/Server.hs > +++ b/src/Ganeti/Monitoring/Server.hs > @@ -50,6 +50,7 @@ import Data.List (find) > import Data.Monoid (mempty) > import qualified Data.Map as Map > import qualified Data.PSQueue as Queue > +import Network.BSD (getServicePortNumber) > import Snap.Core > import Snap.Http.Server > import qualified Text.JSON as J > @@ -67,7 +68,7 @@ import Ganeti.Objects (DataCollectorConfig(..)) > import qualified Ganeti.Constants as C > import qualified Ganeti.ConstantUtils as CU > import Ganeti.Runtime > -import Ganeti.Utils (getCurrentTimeUSec) > +import Ganeti.Utils (getCurrentTimeUSec, withDefaultOnIOError) > > -- * Types and constants definitions > > @@ -105,9 +106,12 @@ prepMain :: PrepFn CheckResult PrepResult > prepMain opts _ = do > accessLog <- daemonsExtraLogFile GanetiMond AccessLog > errorLog <- daemonsExtraLogFile GanetiMond ErrorLog > + defaultPort <- withDefaultOnIOError C.defaultMondPort > + . liftM fromIntegral > + $ getServicePortNumber C.mond > return . > setPort > - (maybe C.defaultMondPort fromIntegral (optPort opts)) . > + (maybe defaultPort fromIntegral (optPort opts)) . > maybe id (setBind . pack) (optBindAddress opts) > $ defaultHttpConf accessLog errorLog > > -- > 2.2.0.rc0.207.ga3a616c > >
