From 4fe84ca6dcc76e4998bc57c4c4f6b34b1f448bc7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 9 Sep 2020 10:58:37 -0400 Subject: [PATCH] Fix various issues in 3.0.0 release If the kernel is new enough to do SKU, but the firmware doesn't have it, fallback to model. Fix outright mistakes in the config_port_tsm code Up mac count from 2 to 3. If querying cumulus switches using SNMP the switch will add its own mac to the list bringing the total for a shared port to 3. --- confluent_osdeploy/el8/profiles/default/scripts/configbmc | 4 +++- .../genesis/profiles/default/scripts/configbmc | 7 +++++-- confluent_server/bin/osdeploy | 2 +- confluent_server/confluent/discovery/handlers/generic.py | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/confluent_osdeploy/el8/profiles/default/scripts/configbmc b/confluent_osdeploy/el8/profiles/default/scripts/configbmc index 610b3c9c..50f1f170 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/configbmc +++ b/confluent_osdeploy/el8/profiles/default/scripts/configbmc @@ -321,7 +321,9 @@ def main(): vendor = open('/sys/devices/virtual/dmi/id/sys_vendor').read() vendor = vendor.strip() try: - model = open('/sys/devices/virtual/dmi/id/product_sku').read() + model = open('/sys/devices/virtual/dmi/id/product_sku').read().strip() + if model == 'none': + raise Exception('no sku') except Exception: model = open('/sys/devices/virtual/dmi/id/product_name').read() if vendor in ('Lenovo', 'IBM'): diff --git a/confluent_osdeploy/genesis/profiles/default/scripts/configbmc b/confluent_osdeploy/genesis/profiles/default/scripts/configbmc index 610b3c9c..b1afcda5 100644 --- a/confluent_osdeploy/genesis/profiles/default/scripts/configbmc +++ b/confluent_osdeploy/genesis/profiles/default/scripts/configbmc @@ -169,6 +169,7 @@ def set_port_tsm(s, port, model): raise Exception("Unsupported port for TSM") timer = 15 while timer: + timer = timer - 1 time.sleep(1.0) sys.stdout.write('.') sys.stdout.flush() @@ -178,7 +179,7 @@ def set_port_tsm(s, port, model): elif port == 'dedicated': iface = 1 s.raw_command(0x32, 0x71, b'\x00\x01\x03') - rsp = s.raw_command(0x32, 0x72, bytearray(4, iface, 0)) + rsp = s.raw_command(0x32, 0x72, bytearray([4, iface, 0])) print('Complete') return int(rsp['data'][0]) @@ -321,7 +322,9 @@ def main(): vendor = open('/sys/devices/virtual/dmi/id/sys_vendor').read() vendor = vendor.strip() try: - model = open('/sys/devices/virtual/dmi/id/product_sku').read() + model = open('/sys/devices/virtual/dmi/id/product_sku').read().strip() + if model == 'none': + raise Exception('No SKU') except Exception: model = open('/sys/devices/virtual/dmi/id/product_name').read() if vendor in ('Lenovo', 'IBM'): diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index cc059abc..1fbb3d53 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -114,7 +114,7 @@ def local_node_trust_setup(): 'IgnoreRhosts no']) if domain and not myname.endswith(domain): myprincipals.add('{0}.{1}'.format(myname, domain)) - if '.' in myname and myname.endswith(domain): + if domain and '.' in myname and myname.endswith(domain): myprincipals.add(myname.split('.')[0]) for pubkey in glob.glob('/etc/ssh/ssh_host_*_key.pub'): currpubkey = open(pubkey, 'rb').read() diff --git a/confluent_server/confluent/discovery/handlers/generic.py b/confluent_server/confluent/discovery/handlers/generic.py index abc0929b..aca0f864 100644 --- a/confluent_server/confluent/discovery/handlers/generic.py +++ b/confluent_server/confluent/discovery/handlers/generic.py @@ -21,7 +21,7 @@ class NodeHandler(object): https_supported = True is_enclosure = False devname = '' - maxmacs = 2 # reasonable default, allowing for common scenario of + maxmacs = 3 # reasonable default, allowing for common scenario of # shared nic in theory, but blocking enclosure managers # and uplink ports @@ -122,4 +122,4 @@ class NodeHandler(object): except Exception: self._certfailreason = 2 return None - return self._fp \ No newline at end of file + return self._fp