Python3缩进错误

时间:2019-12-19 15:55:05

标签: python-3.x

for x in range(0, podCount):
    for resourcelimitdata in resourcelimityaml:
        get_resource_limits(resourcelimitdata, data["spec"]["template"]["spec"]["containers"][x]["name"])
        if "resources" not in data["spec"]["template"]["spec"]["containers"][x]:
            print("No resources key", file=sys.stderr)
        else:
        if "limits" not in data["spec"]["template"]["spec"]["containers"][x]["resources"]:
            print("No limits key", file=sys.stderr)
        else:
        if "cpu" not in data["spec"]["template"]["spec"]["containers"][x]["resources"]["limits"]:
            print("No limits.cpu key", file=sys.stderr)
        else:
            cpu_check("limits.cpu", data["spec"]["template"]["spec"]["containers"][x]["resources"]["limits"]["cpu"], limits_cpu)
        if "memory" not in data["spec"]["template"]["spec"]["containers"][x]["resources"]["limits"]:
            print("No limits.memory key", file=sys.stderr)
        else:
            memory_check("limits.memory", data["spec"]["template"]["spec"]["containers"][x]["resources"]["limits"]["memory"], limits_memory)
        if "requests" not in data["spec"]["template"]["spec"]["containers"][x]["resources"]:
            print("No requests key", file=sys.stderr)
        else:
        if "cpu" not in data["spec"]["template"]["spec"]["containers"][x]["resources"]["requests"]:
            print("No requests.limits key", file=sys.stderr)
        else:
            cpu_check("requests.cpu", data["spec"]["template"]["spec"]["containers"][x]["resources"]["requests"]["cpu"], requests_cpu)
        if "memory" not in data["spec"]["template"]["spec"]["containers"][x]["resources"]["requests"]:
            print("No requests.memory key", file=sys.stderr)
        else:
            memory_check("requests.memory", data["spec"]["template"]["spec"]["containers"][x]["resources"]["requests"]["memory"], requests_memory)

0 个答案:

没有答案