Revision 5b11f8db htools/Ganeti/Config.hs

b/htools/Ganeti/Config.hs
111 111
-- | Computes the role of a node.
112 112
getNodeRole :: ConfigData -> Node -> NodeRole
113 113
getNodeRole cfg node
114
  | nodeName node == (clusterMasterNode $ configCluster cfg) = NRMaster
114
  | nodeName node == clusterMasterNode (configCluster cfg) = NRMaster
115 115
  | nodeMasterCandidate node = NRCandidate
116 116
  | nodeDrained node = NRDrained
117 117
  | nodeOffline node = NROffline
......
133 133
getItem :: String -> String -> M.Map String a -> Result a
134 134
getItem kind name allitems = do
135 135
  let lresult = lookupName (M.keys allitems) name
136
      err = \details -> Bad $ kind ++ " name " ++ name ++ " " ++ details
136
      err msg = Bad $ kind ++ " name " ++ name ++ " " ++ msg
137 137
  fullname <- case lrMatchPriority lresult of
138 138
                PartialMatch -> Ok $ lrContent lresult
139 139
                ExactMatch -> Ok $ lrContent lresult
......
160 160
       -- if not found by uuid, we need to look it up by name, slow
161 161
       Ok grp -> Ok grp
162 162
       Bad _ -> let by_name = M.mapKeys
163
                              (\k -> groupName ((M.!) groups k )) groups
163
                              (groupName . (M.!) groups) groups
164 164
                in getItem "NodeGroup" name by_name
165 165

  
166 166
-- | Computes a node group's node params.
......
232 232
                   link = nicpLink fparams
233 233
               in case nicIp nic of
234 234
                    Nothing -> accum
235
                    Just ip -> let oldipmap = M.findWithDefault (M.empty)
235
                    Just ip -> let oldipmap = M.findWithDefault M.empty
236 236
                                              link accum
237 237
                                   newipmap = M.insert ip iname oldipmap
238 238
                               in M.insert link newipmap accum

Also available in: Unified diff