def handle(self, service_name, **options): checks_to_do = [service_name] if service_name else list(CHECKS) try: statuses = run_checks(checks_to_do) except UnknownCheckException: print("Services available are:") for service_name in CHECKS.keys(): print("- {}".format(service_name)) else: self.print_results(statuses)
def handle(self, service_name, **options): if service_name: if service_name not in CHECKS: print("Services available are:") for service_name in CHECKS.keys(): print("- {}".format(service_name)) else: service_check = CHECKS[service_name] self.perform_check(service_name, service_check) else: for service_name, service_check in CHECKS.items(): self.perform_check(service_name, service_check)
def handle(self, *args, **options): if len(args) == 1: service_name = args[0] if service_name not in CHECKS: print "Services available are:" for service_name in CHECKS.keys(): print "- {}".format(service_name) else: service_check = CHECKS[service_name] self.perform_check(service_name, service_check) else: for service_name, service_check in CHECKS.items(): self.perform_check(service_name, service_check)
def handle(self, service_name, **options): checks_to_do = [service_name] if service_name else list(CHECKS) try: statuses = run_checks(checks_to_do) except UnknownCheckException: print("Services available are:") for service_name in CHECKS.keys(): print("- {}".format(service_name)) sys.exit(-1) else: self.print_results(statuses) if not all(status[1].success for status in statuses): sys.exit(1)