From c7b8d05930259742c44e5a7371fd247ea5bcc27b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 3 Aug 2020 11:06:45 -0400 Subject: [PATCH] Fik initialize -k without other actions --- confluent_server/bin/osdeploy | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index 358824e6..23025ef1 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -176,8 +176,14 @@ def initialize(cmdset): install_tftp_content() if cmdset.l: local_node_trust_setup() - if not didsomething: - sys.exit(0) + if cmdset.k: + with open('/etc/ssh/ssh_known_hosts', 'a+b') as skh: + for cafile in glob.glob('/var/lib/confluent/public/site/ssh/*.ca'): + cacert = open(cafile, 'rb').read() + cacert = b'@cert-authority * ' + cacert + skh.write(cacert) + if not didsomething and (cmdset.k or cmdset.l): + sys.exit(0) if not didsomething: sys.stderr.write('Nothing was done, use initialize -i for ' 'interactive mode, or see initialize -h for more options\n') @@ -216,17 +222,10 @@ def initialize(cmdset): os.chdir(opath) os.rename(tmptarname, '/var/lib/confluent/public/site/initramfs.tgz') print('Site initramfs content packed successfully') - if cmdset.k: - with open('/etc/ssh/ssh_known_hosts', 'a+b') as skh: - for cafile in glob.glob('/var/lib/confluent/public/site/ssh/*.ca'): - cacert = open(cafile, 'rb').read() - cacert = b'@cert-authority * ' + cacert - skh.write(cacert) - # ok, also need to think on how to handle getinstalldisk + if not os.path.exists('/etc/confluent/srvcert.pem'): subprocess.check_call(['collective', 'gencert']) # TODO: check selinux and segetbool for httpd_can_network_connect - # tftp-server available and enabled? # httpd available and enabled?