def set_all(self, path, body):
<EOL>if not isinstance(body, dict):<EOL><INDENT>raise HttpBadRequest("<STR_LIT>")<EOL><DEDENT>for hostname, details in body.items():<EOL><INDENT>error = self.host_errors(hostname, details)<EOL>if error:<EOL><INDENT>raise HttpBadRequest("<STR_LIT>" % (hostname, error))<EOL><DEDENT><DEDENT>old_hostnames = set(self.balancer.hosts.keys())<EOL>new_hostnames = set(body.keys())<EOL>self.balancer.hosts = body<EOL>for hostname in new_hostnames - old_hostnames:<EOL><INDENT>self.balancer.stats[hostname] = {}<EOL><DEDENT>for hostname in old_hostnames - new_hostnames:<EOL><INDENT>try:<EOL><INDENT>del self.balancer.stats[hostname]<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return {"<STR_LIT>": True}<EOL>
Replaces the hosts list with the provided input