diff --git a/plinth/modules/tor/privileged.py b/plinth/modules/tor/privileged.py index d799e4739..0e64bda23 100644 --- a/plinth/modules/tor/privileged.py +++ b/plinth/modules/tor/privileged.py @@ -14,8 +14,7 @@ import augeas from plinth import action_utils from plinth.actions import privileged -from plinth.modules.tor.utils import (APT_TOR_PREFIX, get_augeas, - get_real_apt_uri_path, iter_apt_uris) +from plinth.modules.tor.utils import APT_TOR_PREFIX, get_augeas, iter_apt_uris SERVICE_FILE = '/etc/firewalld/services/tor-{0}.xml' TOR_CONFIG = '/files/etc/tor/instances/plinth/torrc' @@ -415,7 +414,6 @@ def _enable_apt_transport_tor(): """Enable package download over Tor.""" aug = get_augeas() for uri_path in iter_apt_uris(aug): - uri_path = get_real_apt_uri_path(aug, uri_path) uri = aug.get(uri_path) if uri.startswith('http://') or uri.startswith('https://'): aug.set(uri_path, APT_TOR_PREFIX + uri) @@ -432,7 +430,6 @@ def _disable_apt_transport_tor(): pass for uri_path in iter_apt_uris(aug): - uri_path = get_real_apt_uri_path(aug, uri_path) uri = aug.get(uri_path) if uri.startswith(APT_TOR_PREFIX): aug.set(uri_path, uri[len(APT_TOR_PREFIX):]) diff --git a/plinth/modules/tor/utils.py b/plinth/modules/tor/utils.py index 8dba7d8da..f91ecba5e 100644 --- a/plinth/modules/tor/utils.py +++ b/plinth/modules/tor/utils.py @@ -63,28 +63,6 @@ def iter_apt_uris(aug): [aug.match(path) for path in APT_SOURCES_URI_PATHS]) -def get_real_apt_uri_path(aug, path): - """Return the actual path which contains APT URL. - - XXX: This is a workaround for Augeas bug parsing Apt source files - with '[options]'. Remove this workaround after Augeas lens is - fixed. - """ - uri = aug.get(path) - if uri[0] == '[': - parent_path = path.rsplit('/', maxsplit=1)[0] - skipped = False - for child_path in aug.match(parent_path + '/*')[1:]: - if skipped: - return child_path - - value = aug.get(child_path) - if value[-1] == ']': - skipped = True - - return path - - def get_augeas(): """Return an instance of Augeaus for processing APT configuration.""" aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD + @@ -121,7 +99,6 @@ def is_apt_transport_tor_enabled(): return False for uri_path in iter_apt_uris(aug): - uri_path = get_real_apt_uri_path(aug, uri_path) uri = aug.get(uri_path) if not uri.startswith(APT_TOR_PREFIX) and \ (uri.startswith('http://') or uri.startswith('https://')):