# Path: lighthouse/haproxy/stanzas/meta.py
# class MetaFrontendStanza(Stanza):
#     """
#     Stanza subclass representing a shared "meta" cluster frontend.
# 
#     These frontends just contain ACL directives for routing requests to
#     separate cluster backends.  If a member cluster does not have an ACL rule
#     defined in its haproxy config an error is logged and the member cluster
#     is skipped.
#     """
# 
#     def __init__(self, name, port, lines, members, bind_address=None):
#         super(MetaFrontendStanza, self).__init__("frontend")
#         self.header = "frontend %s" % name
# 
#         if not bind_address:
#             bind_address = ""
# 
#         self.add_line("bind %s:%s" % (bind_address, port))
#         self.add_lines(lines)
# 
#         for cluster in members:
#             if "acl" not in cluster.haproxy:
#                 logger.error(
#                     "Cluster %s is part of meta-cluster %s," +
#                     " but no acl rule defined.",
#                     cluster.name, name
#                 )
#                 continue
#             self.add_lines([
#                 "acl is_%s %s" % (cluster.name, cluster.haproxy["acl"]),
#                 "use_backend %s if is_%s" % (cluster.name, cluster.name)
#             ])


    import unittest2 as unittest
    import unittest
from mock import Mock
from lighthouse.haproxy.stanzas.meta import MetaFrontendStanza
try:
except ImportError:




class MetaFrontendStanzaTests(unittest.TestCase):

    def test_custom_bind_address(self):
        cluster1 = Mock(haproxy={})
        cluster2 = Mock(haproxy={})

# Path: lighthouse/haproxy/stanzas/meta.py
# class MetaFrontendStanza(Stanza):
#     """
#     Stanza subclass representing a shared "meta" cluster frontend.
# 
#     These frontends just contain ACL directives for routing requests to
#     separate cluster backends.  If a member cluster does not have an ACL rule
#     defined in its haproxy config an error is logged and the member cluster
#     is skipped.
#     """
# 
#     def __init__(self, name, port, lines, members, bind_address=None):
#         super(MetaFrontendStanza, self).__init__("frontend")
#         self.header = "frontend %s" % name
# 
#         if not bind_address:
#             bind_address = ""
# 
#         self.add_line("bind %s:%s" % (bind_address, port))
#         self.add_lines(lines)
# 
#         for cluster in members:
#             if "acl" not in cluster.haproxy:
#                 logger.error(
#                     "Cluster %s is part of meta-cluster %s," +
#                     " but no acl rule defined.",
#                     cluster.name, name
#                 )
#                 continue
#             self.add_lines([
#                 "acl is_%s %s" % (cluster.name, cluster.haproxy["acl"]),
#                 "use_backend %s if is_%s" % (cluster.name, cluster.name)
#             ])


# Path: tests/haproxy/stanzas/meta_tests.py
    import unittest2 as unittest
    import unittest
from mock import Mock
from lighthouse.haproxy.stanzas.meta import MetaFrontendStanza

try:
except ImportError:




class MetaFrontendStanzaTests(unittest.TestCase):

    def test_custom_bind_address(self):
        cluster1 = Mock(haproxy={})
        cluster2 = Mock(haproxy={})

        stanza = MetaFrontendStanza(