commit d038a0d05f62d7f390818e97dbd9204e72f5fced Author: Tom Ritter tom@ritter.vg Date: Fri Jan 5 22:30:31 2018 -0600
Refactor the FallbackDir Pseudo-Flag (part of #24691) --- data/consensus.cfg | 2 +- website.py | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/data/consensus.cfg b/data/consensus.cfg index e05818f..fd7a7bb 100644 --- a/data/consensus.cfg +++ b/data/consensus.cfg @@ -1,7 +1,7 @@ # control consensus-health output
# do not show all fallback directory output -ignore_fallback_authorities True +ignore_fallback_authorities False
# do not show values less than this amount on the graph. For small testing networks set to 1 graph_logical_min 125 diff --git a/website.py b/website.py index fc9cf91..ce2fe60 100755 --- a/website.py +++ b/website.py @@ -107,6 +107,21 @@ class WebsiteWriter: self.consensus.known_flags.append('ReachableIPv6') self.consensus.known_flags.append('NoIPv6Consensus')
+ # Add the FallbackDir flag + if not self.config['ignore_fallback_authorities']: + self.consensus.known_flags.append('FallbackDir') + for dirauth_nickname in self.known_authorities: + if dirauth_nickname in self.votes: + vote = self.votes[dirauth_nickname] + vote.known_flags.append('FallbackDir') + for r in vote.routers: + if r in self.fallback_dirs: + vote.routers[r].flags.append('FallbackDir') + for r in self.consensus.routers: + if r in self.fallback_dirs: + self.consensus.routers[r].flags.append('FallbackDir') + + #----------------------------------------------------------------------------------------- def _write_page_header(self, include_relay_info): """ @@ -962,7 +977,7 @@ class WebsiteWriter: Write the status of the fallback directory mirrors """ if self.config['ignore_fallback_authorities']: - return + return
self.site.write("<br>\n\n\n" + " <!-- ================================================================= -->" @@ -1426,11 +1441,6 @@ class WebsiteWriter: self.site.write("bwauth=" + ",".join(assigning_bwauths)) flagsWritten += 1
- if relay_fp in self.fallback_dirs: - self.site.write(" <br />" if flagsWritten > 0 else "") - self.site.write("FallbackDir") - flagsWritten += 1 - self.site.write("</td>\n") else: self.site.write(" <td></td>\n")