style(scripts): add some colors when wait for main apps

This commit is contained in:
Khue Doan 2022-03-14 22:37:02 +07:00
parent 3561050efc
commit df7eafe801

View File

@ -17,11 +17,6 @@ ingresses = [
'name': 'hajimari', 'name': 'hajimari',
'fullname': 'Homepage', 'fullname': 'Homepage',
'namespace': 'hajimari' 'namespace': 'hajimari'
},
{
'name': 'gitea',
'fullname': 'Gitea',
'namespace': 'gitea'
} }
] ]
@ -39,7 +34,6 @@ def wait_app(name: str, fullname: str, namespace: str) -> None:
) )
url = f"https://{ingress.spec.rules[0].host}" url = f"https://{ingress.spec.rules[0].host}"
requests.get(url, verify=False).raise_for_status() requests.get(url, verify=False).raise_for_status()
sleep(3)
console.log(f"{fullname} is ready, visit {url}") console.log(f"{fullname} is ready, visit {url}")
success = True success = True
except Exception: except Exception:
@ -47,12 +41,15 @@ def wait_app(name: str, fullname: str, namespace: str) -> None:
def main() -> None: def main() -> None:
Console().rule("Waiting for essential applications")
config.load_kube_config(config_file='./metal/kubeconfig.yaml') config.load_kube_config(config_file='./metal/kubeconfig.yaml')
requests.urllib3.disable_warnings() requests.urllib3.disable_warnings()
for ingress in ingresses: for ingress in ingresses:
wait_app(ingress['name'], ingress['fullname'], ingress['namespace']) wait_app(ingress['name'], ingress['fullname'], ingress['namespace'])
print("There's more, but you can start exploring right away!")
if __name__ == '__main__': if __name__ == '__main__':
main() main()