def zone_present(domain, type, profile):
 zones = libcloud_dns_module.list_zones(profile)
 if (not type):
  type = 'master'
 matching_zone = [z for z in zones if (z.domain == domain)]
 if (len(matching_zone) > 0):
  return state_result(True, 'Zone already exists')
 else:
  result = libcloud_dns_module.create_zone(domain, profile, type)
  return state_result(result, 'Created new zone')

def zone_present ( domain , type , profile ) : zones = libcloud_dns_module . list_zones ( profile ) if ( not type ) : type = 'master' matching_zone = [ z for z in zones if ( z . domain == domain ) ] if ( len ( matching_zone ) > 0 ) : return state_result ( True , 'Zone already exists' ) else : result = libcloud_dns_module . create_zone ( domain , profile , type ) return state_result ( result , 'Created new zone' )
ensures a record is present .