Commit f65784ac authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Merge branch 'stable-2.11' into master



* stable-2.11
  Gracefully handle queries for non-existing nodes
  Consider job-IDs queried for twice only once

Conflicts:
	lib/client/gnt_node.py: trivial
	src/Ganeti/Query/Query.hs: import ALL the functions
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parents d759a02b 929efcc3
......@@ -252,7 +252,11 @@ def AddNode(opts, args):
fields=["name", "sip", "master",
"ndp/ssh_port"],
use_locking=False)
node_exists, sip, is_master, ssh_port = output[0]
if len(output) == 0:
node_exists = ""
sip = None
else:
node_exists, sip, is_master, ssh_port = output[0]
except (errors.OpPrereqError, errors.OpExecError):
node_exists = ""
sip = None
......
......@@ -57,11 +57,11 @@ module Ganeti.Query.Query
) where
import Control.DeepSeq
import Control.Monad (filterM, foldM, unless)
import Control.Monad (filterM, foldM, liftM, unless)
import Control.Monad.IO.Class
import Control.Monad.Trans (lift)
import qualified Data.Foldable as Foldable
import Data.List (intercalate)
import Data.List (intercalate, nub)
import Data.Maybe (fromMaybe)
import qualified Data.Map as Map
import qualified Text.JSON as J
......@@ -168,6 +168,7 @@ getRequestedJobIDs qfilter =
Nothing -> Ok []
Just [] -> Ok []
Just vals ->
liftM nub $
mapM (\e -> case e of
QuotedString s -> makeJobIdS s
NumericValue i -> makeJobId $ fromIntegral i
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment