From 75add230b6a701054cb8fe848d300c165a5aaf4e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 9 Aug 2023 11:13:09 -0400 Subject: [PATCH] Skip API key init on checkonly runs Checkonly does not require API key, and makes apiclient more dependent on material that is unlikely to exist early in a deployment. --- .../common/initramfs/opt/confluent/bin/apiclient | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient b/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient index fefc07b4..b64052c9 100644 --- a/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient +++ b/confluent_osdeploy/common/initramfs/opt/confluent/bin/apiclient @@ -227,7 +227,7 @@ def get_apikey(nodename, hosts, errout=None): return apikey class HTTPSClient(client.HTTPConnection, object): - def __init__(self, usejson=False, port=443, host=None, errout=None, phmac=None): + def __init__(self, usejson=False, port=443, host=None, errout=None, phmac=None, checkonly=False): self.phmac = phmac self.errout = None if errout: @@ -291,7 +291,7 @@ class HTTPSClient(client.HTTPConnection, object): if self.phmac: with open(phmac, 'r') as hmacin: self.stdheaders['CONFLUENT_CRYPTHMAC'] = hmacin.read() - else: + elif not checkonly: self.stdheaders['CONFLUENT_APIKEY'] = get_apikey(node, self.hosts, errout=self.errout) if mgtiface: self.stdheaders['CONFLUENT_MGTIFACE'] = mgtiface @@ -468,7 +468,7 @@ if __name__ == '__main__': outf.write(chunk) chunk = reader.read(16384) sys.exit(0) - client = HTTPSClient(usejson, errout=errout, phmac=phmac) + client = HTTPSClient(usejson, errout=errout, phmac=phmac, checkonly=checkonly) if waitfor: status = 201 while status != waitfor: