mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
Changed return of empty string to raise an exception as it should have been from the beginning.
This commit is contained in:
parent
1b814c43ad
commit
806759cfc9
@ -969,7 +969,8 @@ def get_node_name():
|
|||||||
|
|
||||||
# if we didn't match, just bail to the next node
|
# if we didn't match, just bail to the next node
|
||||||
break
|
break
|
||||||
return ""
|
msg = 'Failed to get node name for node %s' % gethostname()
|
||||||
|
raise GetNodeNameFailed(msg)
|
||||||
|
|
||||||
|
|
||||||
class ApplyNodeLabelFailed(Exception):
|
class ApplyNodeLabelFailed(Exception):
|
||||||
@ -979,9 +980,6 @@ class ApplyNodeLabelFailed(Exception):
|
|||||||
def _apply_node_label(label, delete=False, overwrite=False):
|
def _apply_node_label(label, delete=False, overwrite=False):
|
||||||
''' Invoke kubectl to apply node label changes '''
|
''' Invoke kubectl to apply node label changes '''
|
||||||
nodename = get_node_name()
|
nodename = get_node_name()
|
||||||
if nodename == "":
|
|
||||||
msg = 'Unable to get node name for node {}'.format(gethostname())
|
|
||||||
raise ApplyNodeLabelFailed(msg)
|
|
||||||
|
|
||||||
# TODO: Make this part of the kubectl calls instead of a special string
|
# TODO: Make this part of the kubectl calls instead of a special string
|
||||||
cmd_base = 'kubectl --kubeconfig={0} label node {1} {2}'
|
cmd_base = 'kubectl --kubeconfig={0} label node {1} {2}'
|
||||||
|
Loading…
Reference in New Issue
Block a user