commit 49cce6ce032d36c35f65a43ad17efe01a5d403a1 Author: Damian Johnson atagar@torproject.org Date: Thu May 10 12:51:21 2018 -0700
Use new methods to reference diretories
Using stem's new stem.directory module rather than the deprecated aliases. --- consensus_health_checker.py | 3 ++- descriptor_checker.py | 3 ++- fallback_directories.py | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/consensus_health_checker.py b/consensus_health_checker.py index 9710b5e..993ef73 100755 --- a/consensus_health_checker.py +++ b/consensus_health_checker.py @@ -16,6 +16,7 @@ import util
import stem.descriptor import stem.descriptor.remote +import stem.directory import stem.util.conf import stem.util.enum
@@ -24,7 +25,7 @@ from stem.util.lru_cache import lru_cache
Runlevel = stem.util.enum.UppercaseEnum('NOTICE', 'WARNING', 'ERROR')
-DIRECTORY_AUTHORITIES = stem.descriptor.remote.get_authorities() +DIRECTORY_AUTHORITIES = stem.directory.Authority.from_cache() del DIRECTORY_AUTHORITIES['tor26'] # DirPort does not service requests without a '.z' suffix
EMAIL_SUBJECT = 'Consensus issues' diff --git a/descriptor_checker.py b/descriptor_checker.py index fd7c91d..9764f87 100755 --- a/descriptor_checker.py +++ b/descriptor_checker.py @@ -17,6 +17,7 @@ import util
import stem.descriptor import stem.descriptor.remote +import stem.directory
EMAIL_SUBJECT = 'Unable to retrieve tor descriptors'
@@ -61,7 +62,7 @@ def main():
# download the consensus from each authority
- for authority in stem.descriptor.remote.get_authorities().values(): + for authority in stem.directory.Authority.from_cache().values(): if authority.v3ident is None: continue # authority doesn't vote in the consensus elif authority.nickname == 'tor26': diff --git a/fallback_directories.py b/fallback_directories.py index 8ede789..3e4ce06 100755 --- a/fallback_directories.py +++ b/fallback_directories.py @@ -9,7 +9,8 @@ Report for how many of our fallback directories are unreachable. import time import traceback
-from stem.descriptor.remote import DescriptorDownloader, FallbackDirectory +import stem.descriptor.remote +import stem.directory
import util
@@ -24,12 +25,12 @@ EMAIL_BODY = """\
"""
-downloader = DescriptorDownloader(timeout = 30) +downloader = stem.descriptor.remote.DescriptorDownloader(timeout = 30)
def main(): try: - fallback_directories = FallbackDirectory.from_remote().values() + fallback_directories = stem.directory.Fallback.from_remote().values() log.info('Retrieved %i fallback directories' % len(fallback_directories)) except IOError as exc: raise IOError("Unable to determine tor's fallback directories: %s" % exc)
tor-commits@lists.torproject.org