def apply_config(self, config):
self.haproxy_config_path = config["<STR_LIT>"]<EOL>global_stanza = Stanza("<STR_LIT>")<EOL>global_stanza.add_lines(config.get("<STR_LIT>", []))<EOL>global_stanza.add_lines([<EOL>"<STR_LIT>" % config["<STR_LIT>"],<EOL>"<STR_LIT>"<EOL>])<EOL>defaults_stanza = Stanza("<STR_LIT>")<EOL>defaults_stanza.add_lines(config.get("<STR_LIT>", []))<EOL>proxy_stanzas = [<EOL>ProxyStanza(<EOL>name, proxy["<STR_LIT:port>"], proxy["<STR_LIT>"],<EOL>proxy.get("<STR_LIT>", []),<EOL>proxy.get("<STR_LIT>")<EOL>)<EOL>for name, proxy in six.iteritems(config.get("<STR_LIT>", {}))<EOL>]<EOL>stats_stanza = None<EOL>if "<STR_LIT>" in config:<EOL><INDENT>stats_stanza = StatsStanza(<EOL>config["<STR_LIT>"]["<STR_LIT:port>"], config["<STR_LIT>"].get("<STR_LIT>", "<STR_LIT:/>")<EOL>)<EOL>for timeout in ("<STR_LIT>", "<STR_LIT>", "<STR_LIT>"):<EOL><INDENT>if timeout in config["<STR_LIT>"].get("<STR_LIT>", {}):<EOL><INDENT>stats_stanza.add_line(<EOL>"<STR_LIT>" % (<EOL>timeout,<EOL>config["<STR_LIT>"]["<STR_LIT>"][timeout]<EOL>)<EOL>)<EOL><DEDENT><DEDENT><DEDENT>self.config_file = HAProxyConfig(<EOL>global_stanza, defaults_stanza,<EOL>proxy_stanzas=proxy_stanzas, stats_stanza=stats_stanza,<EOL>meta_clusters=config.get("<STR_LIT>", {}),<EOL>bind_address=config.get("<STR_LIT>")<EOL>)<EOL>self.control = HAProxyControl(<EOL>config["<STR_LIT>"], config["<STR_LIT>"], config["<STR_LIT>"],<EOL>)<EOL>
Constructs HAProxyConfig and HAProxyControl instances based on the
contents of the config.

This is mostly a matter of constructing the configuration stanzas.