From 35701cdf019072fc4ac97fe7ca398ab9814baf57 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Jul 2022 11:41:29 -0400 Subject: [PATCH] Allow ident net config to override deploycfg In routed deployment, deploycfg will be missing network info, use the ident provided network if detected. --- .../esxi7/profiles/hypervisor/scripts/makeksnet | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/confluent_osdeploy/esxi7/profiles/hypervisor/scripts/makeksnet b/confluent_osdeploy/esxi7/profiles/hypervisor/scripts/makeksnet index cf27ff78..fa05c9c6 100644 --- a/confluent_osdeploy/esxi7/profiles/hypervisor/scripts/makeksnet +++ b/confluent_osdeploy/esxi7/profiles/hypervisor/scripts/makeksnet @@ -1,7 +1,7 @@ #!/usr/bin/python import re import subprocess - +import yaml uplinkmatch = re.compile('^\s*Uplinks:\s*(.*)') nodename = None for inf in open('/etc/confluent/confluent.info', 'r').read().split('\n'): @@ -33,6 +33,16 @@ for info in vswinfo.split('\n'): upinfo = uplinkmatch.match(info) if upinfo: vmnic = upinfo.group(1) +try: + with open('/tmp/confluentident/cnflnt.yml') as identin: + identcfg = yaml.safe_load(identin) + ncfg = identcfg['netcfgs'][0] + cfg['ipv4_method'] = ncfg['ipv4_method'] + cfg['ipv4_address'] = ncfg['ipv4_address'].split('/')[0] + cfg['ipv4_netmask'] = ncfg['ipv4_netmask'] + cfg['ipv4_gateway'] = ncfg['ipv4_gateway'] +except Exception: + pass netline = 'network --hostname={0} --bootproto={1}'.format(nodename, cfg['ipv4_method']) if vmnic: netline += ' --device={0}'.format(vmnic)