diff --git a/install_files/ansible-base/roles/app-test/files/tor_app.fact b/install_files/ansible-base/roles/app-test/files/tor_app.fact index b4818591b56..22c61c09f9b 100644 --- a/install_files/ansible-base/roles/app-test/files/tor_app.fact +++ b/install_files/ansible-base/roles/app-test/files/tor_app.fact @@ -8,8 +8,8 @@ import json import os TOR_SVC_PATH = "/var/lib/tor/services/" -JOURNALIST_DIR = "journalist" -SOURCE_DIR = "source" +JOURNALIST_DIR = "journalistv3" +SOURCE_DIR = "sourcev3" def extract_sd_onion_data(tor_path=TOR_SVC_PATH, @@ -17,27 +17,25 @@ def extract_sd_onion_data(tor_path=TOR_SVC_PATH, source_dir=SOURCE_DIR, protocol="http"): - for interface in [journalist_dir, source_dir]: + def get_int_addr(base_path): hostname_file = os.path.join(TOR_SVC_PATH, interface, 'hostname') try: with open(hostname_file) as f: tor_config = f.readline().rstrip().split() - onion_addr = "{p}://{a}".format(p=protocol, a=tor_config[0]) - auth_token = tor_config[1] - - # This must be a source interface because we dont see hidservauth info - except IndexError: - source_int = onion_addr - # One of the files doesn't exist :| Maybe tor setup hasnt run yet. + return onion_addr + # The file doesn't exist :/ Maybe tor setup hasn't run yet. except IOError: - return dict() - else: - journalist_int = onion_addr + pass + + try: + journalist_int = get_int_addr(JOURNALIST_DIR) + source_int = get_int_addr(SOURCE_DIR) + except Exception: + return dict() return dict(journalist_location=journalist_int, - source_location=source_int, - hidserv_token=auth_token) + source_location=source_int) if __name__ == '__main__': diff --git a/install_files/ansible-base/roles/app-test/tasks/extract_apptor_test_config.yml b/install_files/ansible-base/roles/app-test/tasks/extract_apptor_test_config.yml index b99f7e98689..728af0ec10e 100644 --- a/install_files/ansible-base/roles/app-test/tasks/extract_apptor_test_config.yml +++ b/install_files/ansible-base/roles/app-test/tasks/extract_apptor_test_config.yml @@ -21,7 +21,6 @@ - name: Gather apptest facts to dict to prepare for output set_fact: _tbb_selenium_dict: - hidserv_token: "{{ ansible_local.tor_app.hidserv_token }}" journalist_location: "{{ ansible_local.tor_app.journalist_location }}" source_location: "{{ ansible_local.tor_app.source_location }}" timeout: "{{ tbb_timeout }}"