2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Add API check

Particularly SELinux is a frequently missed configuration
facet, alert when the selinux is blocking.
This commit is contained in:
Jarrod Johnson 2022-09-30 12:17:31 -04:00
parent ee3aef0a4c
commit 9ecd3e3ac7

View File

@ -85,6 +85,16 @@ def web_download_works():
return False
return True
def web_api_works():
try:
res = subprocess.check_output(['curl', '-X', 'GET', '-Isk', 'https://localhost/confluent-api/'])
res = res.split(b'\n')[0]
if b'401' in res:
return True
return False
except Exception:
return False
return True
def nics_missing_ipv6():
# check for ability to create AF_INET6, for kernel disabled ipv6
@ -176,6 +186,11 @@ if __name__ == '__main__':
print('OK')
else:
emprint('Failed to download /confluent-public/site/confluent_uuid')
fprint('Checking web API access: ')
if web_api_works():
print('OK')
else:
emprint('Failed access, if selinux is enabled, `setsebool -P httpd_can_network_connect=1`, otherwise check web proxy configuration')
else:
emprint('Not Running (Example resolution: systemctl enable httpd --now)')
fprint('TFTP Status: ')