mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 19:10:10 +00:00
Check for some issues in a manual assign request
One is to provide clear feedback when a nodename is requested that was not previously defined, to make it more clear that it is a requirement and/or guard against going too far while the config function will be missing data it needs to complete onboarding. Another is to break if the request is trying to assign a node to a different definition when it already exists under a different name.
This commit is contained in:
parent
10ac1756f1
commit
b4e6e7caa8
@ -1050,6 +1050,20 @@ def eval_node(cfg, handler, info, nodename, manual=False):
|
||||
|
||||
|
||||
def discover_node(cfg, handler, info, nodename, manual):
|
||||
if manual:
|
||||
if not cfg.is_node(nodename):
|
||||
raise exc.InvalidArgumentException(
|
||||
'{0} is not a defined node, must be defined before an '
|
||||
'endpoint may be assigned to it'.format(nodename))
|
||||
if handler.https_supported:
|
||||
currcert = handler.https_cert
|
||||
if currcert:
|
||||
currprint = util.get_fingerprint(currcert, 'sha256')
|
||||
prevnode = nodes_by_fprint.get(currprint, None)
|
||||
if prevnode and prevnode != nodename:
|
||||
raise exc.InvalidArgumentException(
|
||||
'Attempt to assign {0} conflicts with existing node {1} '
|
||||
'based on TLS certificate.'.format(nodename, prevnode))
|
||||
known_nodes[nodename][info['hwaddr']] = info
|
||||
if info['hwaddr'] in unknown_info:
|
||||
del unknown_info[info['hwaddr']]
|
||||
|
Loading…
Reference in New Issue
Block a user