mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-29 16:50:57 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 40c74699f0 | |||
| 3903cda789 | |||
| 72049657d7 | |||
| 247a7f5d8a | |||
| 61f793040e | |||
| 5a24619560 |
@@ -49,7 +49,7 @@ class DiskInfo(object):
|
||||
|
||||
@property
|
||||
def priority(self):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2'):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2', 'thinksystem_m.2'):
|
||||
return 0
|
||||
if 'imsm' in self.mdcontainer:
|
||||
return 1
|
||||
|
||||
@@ -49,7 +49,7 @@ class DiskInfo(object):
|
||||
|
||||
@property
|
||||
def priority(self):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2'):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2', 'thinksystem_m.2'):
|
||||
return 0
|
||||
if 'imsm' in self.mdcontainer:
|
||||
return 1
|
||||
|
||||
@@ -49,7 +49,7 @@ class DiskInfo(object):
|
||||
|
||||
@property
|
||||
def priority(self):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2'):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2', 'thinksystem_m.2'):
|
||||
return 0
|
||||
if 'imsm' in self.mdcontainer:
|
||||
return 1
|
||||
|
||||
@@ -49,7 +49,7 @@ class DiskInfo(object):
|
||||
|
||||
@property
|
||||
def priority(self):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2'):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2', 'thinksystem_m.2'):
|
||||
return 0
|
||||
if 'imsm' in self.mdcontainer:
|
||||
return 1
|
||||
|
||||
@@ -49,7 +49,7 @@ class DiskInfo(object):
|
||||
|
||||
@property
|
||||
def priority(self):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2'):
|
||||
if self.model.lower() in ('thinksystem_m.2_vd', 'thinksystem m.2', 'thinksystem_m.2'):
|
||||
return 0
|
||||
if 'imsm' in self.mdcontainer:
|
||||
return 1
|
||||
|
||||
@@ -1040,6 +1040,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']]
|
||||
@@ -1129,11 +1143,13 @@ def do_pxe_discovery(cfg, handler, info, manual, nodename, policies):
|
||||
# use uuid based scheme in lieu of tls cert, ideally only
|
||||
# for stateless 'discovery' targets like pxe, where data does not
|
||||
# change
|
||||
uuidinfo = cfg.get_node_attributes(nodename, ['id.uuid', 'id.serial', 'id.model', 'net*.bootable'])
|
||||
uuidinfo = cfg.get_node_attributes(nodename, ['id.uuid', 'id.serial', 'id.model', 'net*.hwaddr', 'net*.bootable'])
|
||||
if manual or policies & set(('open', 'pxe')):
|
||||
enrich_pxe_info(info)
|
||||
attribs = {}
|
||||
olduuid = uuidinfo.get(nodename, {}).get('id.uuid', None)
|
||||
if isinstance(olduuid, dict):
|
||||
olduuid = olduuid.get('value', None)
|
||||
uuid = info.get('uuid', None)
|
||||
if uuid and uuid != olduuid:
|
||||
attribs['id.uuid'] = info['uuid']
|
||||
@@ -1146,7 +1162,9 @@ def do_pxe_discovery(cfg, handler, info, manual, nodename, policies):
|
||||
for attrname in uuidinfo.get(nodename, {}):
|
||||
if attrname.endswith('.bootable') and uuidinfo[nodename][attrname].get('value', None):
|
||||
newattrname = attrname[:-8] + 'hwaddr'
|
||||
attribs[newattrname] = info['hwaddr']
|
||||
oldhwaddr = uuidinfo.get(nodename, {}).get(newattrname, {}).get('value', None)
|
||||
if info['hwaddr'] != oldhwaddr:
|
||||
attribs[newattrname] = info['hwaddr']
|
||||
if attribs:
|
||||
cfg.set_node_attributes({nodename: attribs})
|
||||
if info['uuid'] in known_pxe_uuids:
|
||||
@@ -1278,11 +1296,11 @@ known_pxe_uuids = {}
|
||||
def _map_unique_ids(nodes=None):
|
||||
global nodes_by_uuid
|
||||
global nodes_by_fprint
|
||||
nodes_by_uuid = {}
|
||||
nodes_by_fprint = {}
|
||||
# Map current known ids based on uuid and fingperprints for fast lookup
|
||||
cfg = cfm.ConfigManager(None)
|
||||
if nodes is None:
|
||||
nodes_by_uuid = {}
|
||||
nodes_by_fprint = {}
|
||||
nodes = cfg.list_nodes()
|
||||
bigmap = cfg.get_node_attributes(nodes,
|
||||
('id.uuid',
|
||||
|
||||
@@ -100,7 +100,9 @@ class SshShell(conapi.Console):
|
||||
while self.connected:
|
||||
pendingdata = self.shell.recv(8192)
|
||||
if not pendingdata:
|
||||
self.datacallback(conapi.ConsoleEvent.Disconnect)
|
||||
self.ssh.close()
|
||||
if self.datacallback:
|
||||
self.datacallback(conapi.ConsoleEvent.Disconnect)
|
||||
return
|
||||
self.datacallback(pendingdata)
|
||||
|
||||
@@ -110,7 +112,7 @@ class SshShell(conapi.Console):
|
||||
# that would rather not use the nodename as anything but an opaque
|
||||
# identifier
|
||||
self.datacallback = callback
|
||||
if self.username is not '':
|
||||
if self.username is not b'':
|
||||
self.logon()
|
||||
else:
|
||||
self.inputmode = 0
|
||||
@@ -126,12 +128,14 @@ class SshShell(conapi.Console):
|
||||
password=self.password, allow_agent=False,
|
||||
look_for_keys=False)
|
||||
except paramiko.AuthenticationException:
|
||||
self.ssh.close()
|
||||
self.inputmode = 0
|
||||
self.username = b''
|
||||
self.password = b''
|
||||
self.datacallback('\r\nlogin as: ')
|
||||
return
|
||||
except paramiko.ssh_exception.NoValidConnectionsError as e:
|
||||
self.ssh.close()
|
||||
self.datacallback(str(e))
|
||||
self.inputmode = 0
|
||||
self.username = b''
|
||||
@@ -139,6 +143,7 @@ class SshShell(conapi.Console):
|
||||
self.datacallback('\r\nlogin as: ')
|
||||
return
|
||||
except cexc.PubkeyInvalid as pi:
|
||||
self.ssh.close()
|
||||
self.keyaction = ''
|
||||
self.candidatefprint = pi.fingerprint
|
||||
self.datacallback(pi.message)
|
||||
@@ -148,6 +153,7 @@ class SshShell(conapi.Console):
|
||||
self.datacallback('\r\nEnter "disconnect" or "accept": ')
|
||||
return
|
||||
except paramiko.SSHException as pi:
|
||||
self.ssh.close()
|
||||
self.inputmode = -2
|
||||
warn = str(pi)
|
||||
if warnhostkey:
|
||||
|
||||
@@ -33,7 +33,7 @@ def get_extra_names(nodename, cfg):
|
||||
currnames = currnames.split(',')
|
||||
for currname in currnames:
|
||||
names.add(currname)
|
||||
if domain not in currname:
|
||||
if domain and domain not in currname:
|
||||
names.add('{0}.{1}'.format(currname, domain))
|
||||
return names
|
||||
|
||||
|
||||
@@ -111,6 +111,8 @@ class ShellSession(consoleserver.ConsoleSession):
|
||||
|
||||
def destroy(self):
|
||||
try:
|
||||
activesessions[(self.configmanager.tenant, self.node,
|
||||
self.username)][self.sessionid].close()
|
||||
del activesessions[(self.configmanager.tenant, self.node,
|
||||
self.username)][self.sessionid]
|
||||
except KeyError:
|
||||
|
||||
Reference in New Issue
Block a user