Commit 929efcc3 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Gracefully handle queries for non-existing nodes



When adding a node, Ganeti checks whether the node is already
part of the cluster by querying for the node name. However,
as queries are meant to return all nodes with the given name,
it might well return the empty list when a new node is to be
added. Handle that case correctly.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent fb8d8645
......@@ -253,6 +253,10 @@ def AddNode(opts, args):
fields=["name", "sip", "master",
"ndp/ssh_port"],
use_locking=False)
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 = ""
......
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