def main()

in src/tools/diagnostics/updatecenter_troubleshooter.py [0:0]


def main(output_path=None, return_json_output="False"):
    if os.geteuid() != 0:
        print ("Please run this script as root")
        exit()

    # supported python version greter than 2.7.x

    if(sys.version_info[0] == 2) and (sys.version_info[1] < 7):
        print("Unsupport python version:" + str(sys.version_info))
#       exit()


    print ("Processing Information...[can take upto 5 minutes]")

    get_machine_info()
    check_os_version()
    check_proxy_connectivity()
    check_general_internet_connectivity()
    if(1 == check_imds_connectivity()):
        check_azcmagent()
        check_arc_extension()
    else:
        check_azureagent()
    check_azure_extension()
    check_autoassessment_service()

    try:
        print ("Checking access to linux repos")
        check_access_to_linux_repos()
    except Exception as e:
        pass

    if return_json_output == "True":
        print (json.dumps([obj.__dict__ for obj in rule_info_list]))
    else:
        for line in output:
            print (line)

        if output_path is not None:
            try:
                os.makedirs(output_path)
            except OSError:
                if not os.path.isdir(output_path):
                    raise 
            log_path = "%s/healthcheck-%s.log" % (output_path, datetime.datetime.utcnow().isoformat())
            f = open(log_path, "w")
            f.write("".join(output))
            f.close()
            print ("Output is written to " + log_path)