def get_zone_name()

in lemur/plugins/lemur_acme/dyn.py [0:0]


def get_zone_name(domain):
    zones = get_all_zones()

    zone_name = ""

    for z in zones:
        if domain.endswith(z.name):
            # Find the most specific zone possible for the domain
            # Ex: If fqdn is a.b.c.com, there is a zone for c.com,
            # and a zone for b.c.com, we want to use b.c.com.
            if z.name.count(".") > zone_name.count("."):
                zone_name = z.name
    if not zone_name:
        metrics.send("dyn_no_zone_name", "counter", 1)
        raise Exception("No Dyn zone found for domain: {}".format(domain))
    return zone_name