Revision f40fe08c src/Ganeti/HTools/Backend/Luxi.hs

b/src/Ganeti/HTools/Backend/Luxi.hs
210 210
parseNode _ v = fail ("Invalid node query result: " ++ show v)
211 211

  
212 212
-- | Parses the cluster tags.
213
getClusterData :: JSValue -> Result ([String], IPolicy)
213
getClusterData :: JSValue -> Result ([String], IPolicy, String)
214 214
getClusterData (JSObject obj) = do
215 215
  let errmsg = "Parsing cluster info"
216 216
      obj' = fromJSObject obj
217 217
  ctags <- tryFromObj errmsg obj' "tags"
218 218
  cpol <- tryFromObj errmsg obj' "ipolicy"
219
  return (ctags, cpol)
219
  master <- tryFromObj errmsg obj' "master"
220
  return (ctags, cpol, master)
220 221

  
221 222
getClusterData _ = Bad "Cannot parse cluster info, not a JSON record"
222 223

  
......
265 266
  let (node_names, node_idx) = assignIndices node_data
266 267
  inst_data <- instances >>= getInstances node_names
267 268
  let (_, inst_idx) = assignIndices inst_data
268
  (ctags, cpol) <- cinfo >>= getClusterData
269
  return (ClusterData group_idx node_idx inst_idx ctags cpol)
269
  (ctags, cpol, master) <- cinfo >>= getClusterData
270
  node_idx' <- setMaster node_names node_idx master
271
  return (ClusterData group_idx node_idx' inst_idx ctags cpol)
270 272

  
271 273
-- | Top level function for data loading.
272 274
loadData :: String -- ^ Unix socket to use as source

Also available in: Unified diff