We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Release SecureDrop 1.8.1
This is a tracking issue for the release of SecureDrop 1.8.1. This minor release will provide improvements to the restore functionality, and update OSSEC rules to support the transition to Ubuntu 20.04 Focal.

Tentatively scheduled as follows:

**String and feature freeze:** 2021-04-07
**Pre-release announcement:** 2021-04-08
**Release date:** 2021-04-14

**Release manager:** @kushaldas  
**Deputy release manager:** @emkll 
**Communications manager:**: @eloquence / @emkll 

_SecureDrop maintainers and testers:_ As you QA 1.8.1, please report back your testing results as comments on this ticket. File GitHub issues for any problems found, tag them "QA: Release", and associate them with the [1.8.1 milestone](https://github.com/freedomofpress/securedrop/milestone/71) for tracking (or ask a maintainer to do so).

Test debian packages will be posted on https://apt-test.freedom.press signed with [the test key](https://gist.githubusercontent.com/conorsch/ec4008b111bc3142fca522693f3cce7e/raw/2968621e8ad92db4505a31fcc5776422d7d26729/apt-test%2520apt%2520pubkey). An Ansible playbook testing the upgrade path is [here](https://gist.github.com/rmol/eb605e28e290e90f45347f3a2f1ad43e).

# [QA Matrix for 1.8.1](https://docs.google.com/spreadsheets/d/1JZZ6kozgfFSkMV2XWjajWoLDmABjnzUsmbMCOhUaAAg/edit?usp=sharing)
# [Test Plan for 1.8.1](https://github.com/freedomofpress/securedrop/wiki/1.8.1-Test-Plan)


# Prepare release candidate (1.8.1~rc1)
- [x] Cherry-pick changes to release/1.8.0 branch @zenmonkeykstop  https://github.com/freedomofpress/securedrop/pull/5890
- [ ] Link to latest version of Tails, including release candidates, to test against during QA
- [x] Prepare 1.8.1~rc1 release changelog
- [x] Prepare 1.8.1~rc1 Tag https://github.com/freedomofpress/securedrop/tree/1.8.1-rc1
- [x] Build debs and put up `1.8.1~rc1` on test apt server: https://github.com/freedomofpress/securedrop-dev-packages-lfs/pull/102
- [x] Commit build logs to https://github.com/freedomofpress/build-logs/commit/639b9f5d2c0aea1b03415ee1724d1f602ac017ed

# Final release
- [x] Ensure builder in release branch is updated and/or update builder image
- [x] Push signed tag https://github.com/freedomofpress/securedrop/releases/tag/1.8.1
- [x] Pre-Flight: Test updater logic in Tails (apt-qa tracks the `release` branch in the LFS repo)
- [x] Build final Debian packages for 1.8.0 (and preserve build logs)
- [x] Commit package build logs to https://github.com/freedomofpress/build-logs/commit/03a90fa69bbb8256cbb034675b09ddd60e17f25c
- [x] Upload Debian packages to apt-qa server 
- [x] Pre-Flight: Test that install and upgrade from 1.8.0 to 1.8.1 works w/ prod repo debs (apt-qa.freedom.press polls the `release` branch in the LFS repo for the debs)
- [x] Flip apt QA server to prod status (merge to `main` in the LFS repo)
- [x] Merge Docs branch changes to ``main`` and verify new docs build in securedrop-docs repo
- [x] Prepare release messaging

# Post release
- [x] Create GitHub release object https://github.com/freedomofpress/securedrop/releases/tag/1.8.0
- [x] Once release object is created, update versions in `securedrop-docs` and Wagtail
- [x] Build readthedocs and verify new docs show up on https://docs.securedrop.org
- [x] Publish announcements
- [ ] Merge changelog, https://github.com/freedomofpress/securedrop/pull/5899, and https://github.com/freedomofpress/securedrop/pull/5894/ back to `develop`
- [ ] Update upgrade testing boxes (might not be possible due to https://github.com/freedomofpress/securedrop/issues/5883)
- [x] Update roadmap wiki page: https://github.com/freedomofpress/securedrop/wiki/Development-Roadmap


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `install_files/ansible-base/roles/restore/files/disable_v2.py`
Content:
```
1 #!/usr/bin/env python3
2 # To execute on prod:
3 # python3 disable_v2.py /etc/tor/torrc /etc/tor/torrc
4 # To execute for testing locally:
5 # python3 disable_v2.py /etc/tor/torrc /tmp/dumytorrc
6 import sys
7 
8 
9 def filter_v2(filename):
10     # Read the file
11     with open(filename) as f:
12         data = f.readlines()
13     # We will store the filtered lines to result
14     result = []
15 
16     i = 0
17     while i < len(data):
18         line = data[i]
19         if line == "HiddenServiceDir /var/lib/tor/services/source\n":
20             i += 1
21             while data[i].strip() == "":
22                 i += 1
23             line = data[i]
24             if line == "HiddenServiceVersion 2\n":
25                 i += 1
26                 line = data[i]
27                 while data[i].strip() == "":
28                     i += 1
29                 line = data[i]
30                 if line == "HiddenServicePort 80 127.0.0.1:80\n":
31                     i += 1
32                     continue
33         # Now check for journalist
34         if line == "HiddenServiceDir /var/lib/tor/services/journalist\n":
35             i += 1
36             while data[i].strip() == "":
37                 i += 1
38             line = data[i]
39             if line == "HiddenServiceVersion 2\n":
40                 i += 1
41                 line = data[i]
42                 while data[i].strip() == "":
43                     i += 1
44                 line = data[i]
45                 if line == "HiddenServicePort 80 127.0.0.1:8080\n":
46                     i += 1
47                     line = data[i]
48                     while data[i].strip() == "":
49                         i += 1
50                     line = data[i]
51                     if line == "HiddenServiceAuthorizeClient stealth journalist\n":
52                         i += 1
53                         continue
54         # Now the v2 ssh access
55         if line == "HiddenServiceDir /var/lib/tor/services/ssh\n":
56             i += 1
57             while data[i].strip() == "":
58                 i += 1
59             line = data[i]
60             if line == "HiddenServiceVersion 2\n":
61                 i += 1
62                 line = data[i]
63                 while data[i].strip() == "":
64                     i += 1
65                 line = data[i]
66                 if line == "HiddenServicePort 22 127.0.0.1:22\n":
67                     i += 1
68                     line = data[i]
69                     while data[i].strip() == "":
70                         i += 1
71                     line = data[i]
72                     if line == "HiddenServiceAuthorizeClient stealth admin\n":
73                         i += 1
74                         continue
75 
76         result.append(line)
77         i += 1
78 
79     # Now return the result
80     return result
81 
82 
83 if __name__ == "__main__":
84     filename = sys.argv[1]
85     outputfilename = sys.argv[2]
86     result = filter_v2(filename)
87     with open(outputfilename, "w") as fobj:
88         for line in result:
89             fobj.write(line)
90
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/install_files/ansible-base/roles/restore/files/disable_v2.py b/install_files/ansible-base/roles/restore/files/disable_v2.py
deleted file mode 100644
--- a/install_files/ansible-base/roles/restore/files/disable_v2.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env python3
-# To execute on prod:
-# python3 disable_v2.py /etc/tor/torrc /etc/tor/torrc
-# To execute for testing locally:
-# python3 disable_v2.py /etc/tor/torrc /tmp/dumytorrc
-import sys
-
-
-def filter_v2(filename):
-    # Read the file
-    with open(filename) as f:
-        data = f.readlines()
-    # We will store the filtered lines to result
-    result = []
-
-    i = 0
-    while i < len(data):
-        line = data[i]
-        if line == "HiddenServiceDir /var/lib/tor/services/source\n":
-            i += 1
-            while data[i].strip() == "":
-                i += 1
-            line = data[i]
-            if line == "HiddenServiceVersion 2\n":
-                i += 1
-                line = data[i]
-                while data[i].strip() == "":
-                    i += 1
-                line = data[i]
-                if line == "HiddenServicePort 80 127.0.0.1:80\n":
-                    i += 1
-                    continue
-        # Now check for journalist
-        if line == "HiddenServiceDir /var/lib/tor/services/journalist\n":
-            i += 1
-            while data[i].strip() == "":
-                i += 1
-            line = data[i]
-            if line == "HiddenServiceVersion 2\n":
-                i += 1
-                line = data[i]
-                while data[i].strip() == "":
-                    i += 1
-                line = data[i]
-                if line == "HiddenServicePort 80 127.0.0.1:8080\n":
-                    i += 1
-                    line = data[i]
-                    while data[i].strip() == "":
-                        i += 1
-                    line = data[i]
-                    if line == "HiddenServiceAuthorizeClient stealth journalist\n":
-                        i += 1
-                        continue
-        # Now the v2 ssh access
-        if line == "HiddenServiceDir /var/lib/tor/services/ssh\n":
-            i += 1
-            while data[i].strip() == "":
-                i += 1
-            line = data[i]
-            if line == "HiddenServiceVersion 2\n":
-                i += 1
-                line = data[i]
-                while data[i].strip() == "":
-                    i += 1
-                line = data[i]
-                if line == "HiddenServicePort 22 127.0.0.1:22\n":
-                    i += 1
-                    line = data[i]
-                    while data[i].strip() == "":
-                        i += 1
-                    line = data[i]
-                    if line == "HiddenServiceAuthorizeClient stealth admin\n":
-                        i += 1
-                        continue
-
-        result.append(line)
-        i += 1
-
-    # Now return the result
-    return result
-
-
-if __name__ == "__main__":
-    filename = sys.argv[1]
-    outputfilename = sys.argv[2]
-    result = filter_v2(filename)
-    with open(outputfilename, "w") as fobj:
-        for line in result:
-            fobj.write(line)

{"golden_diff": "diff --git a/install_files/ansible-base/roles/restore/files/disable_v2.py b/install_files/ansible-base/roles/restore/files/disable_v2.py\ndeleted file mode 100644\n--- a/install_files/ansible-base/roles/restore/files/disable_v2.py\n+++ /dev/null\n@@ -1,89 +0,0 @@\n-#!/usr/bin/env python3\n-# To execute on prod:\n-# python3 disable_v2.py /etc/tor/torrc /etc/tor/torrc\n-# To execute for testing locally:\n-# python3 disable_v2.py /etc/tor/torrc /tmp/dumytorrc\n-import sys\n-\n-\n-def filter_v2(filename):\n-    # Read the file\n-    with open(filename) as f:\n-        data = f.readlines()\n-    # We will store the filtered lines to result\n-    result = []\n-\n-    i = 0\n-    while i < len(data):\n-        line = data[i]\n-        if line == \"HiddenServiceDir /var/lib/tor/services/source\\n\":\n-            i += 1\n-            while data[i].strip() == \"\":\n-                i += 1\n-            line = data[i]\n-            if line == \"HiddenServiceVersion 2\\n\":\n-                i += 1\n-                line = data[i]\n-                while data[i].strip() == \"\":\n-                    i += 1\n-                line = data[i]\n-                if line == \"HiddenServicePort 80 127.0.0.1:80\\n\":\n-                    i += 1\n-                    continue\n-        # Now check for journalist\n-        if line == \"HiddenServiceDir /var/lib/tor/services/journalist\\n\":\n-            i += 1\n-            while data[i].strip() == \"\":\n-                i += 1\n-            line = data[i]\n-            if line == \"HiddenServiceVersion 2\\n\":\n-                i += 1\n-                line = data[i]\n-                while data[i].strip() == \"\":\n-                    i += 1\n-                line = data[i]\n-                if line == \"HiddenServicePort 80 127.0.0.1:8080\\n\":\n-                    i += 1\n-                    line = data[i]\n-                    while data[i].strip() == \"\":\n-                        i += 1\n-                    line = data[i]\n-                    if line == \"HiddenServiceAuthorizeClient stealth journalist\\n\":\n-                        i += 1\n-                        continue\n-        # Now the v2 ssh access\n-        if line == \"HiddenServiceDir /var/lib/tor/services/ssh\\n\":\n-            i += 1\n-            while data[i].strip() == \"\":\n-                i += 1\n-            line = data[i]\n-            if line == \"HiddenServiceVersion 2\\n\":\n-                i += 1\n-                line = data[i]\n-                while data[i].strip() == \"\":\n-                    i += 1\n-                line = data[i]\n-                if line == \"HiddenServicePort 22 127.0.0.1:22\\n\":\n-                    i += 1\n-                    line = data[i]\n-                    while data[i].strip() == \"\":\n-                        i += 1\n-                    line = data[i]\n-                    if line == \"HiddenServiceAuthorizeClient stealth admin\\n\":\n-                        i += 1\n-                        continue\n-\n-        result.append(line)\n-        i += 1\n-\n-    # Now return the result\n-    return result\n-\n-\n-if __name__ == \"__main__\":\n-    filename = sys.argv[1]\n-    outputfilename = sys.argv[2]\n-    result = filter_v2(filename)\n-    with open(outputfilename, \"w\") as fobj:\n-        for line in result:\n-            fobj.write(line)\n", "issue": "Release SecureDrop 1.8.1\nThis is a tracking issue for the release of SecureDrop 1.8.1. This minor release will provide improvements to the restore functionality, and update OSSEC rules to support the transition to Ubuntu 20.04 Focal.\r\n\r\nTentatively scheduled as follows:\r\n\r\n**String and feature freeze:** 2021-04-07\r\n**Pre-release announcement:** 2021-04-08\r\n**Release date:** 2021-04-14\r\n\r\n**Release manager:** @kushaldas  \r\n**Deputy release manager:** @emkll \r\n**Communications manager:**: @eloquence / @emkll \r\n\r\n_SecureDrop maintainers and testers:_ As you QA 1.8.1, please report back your testing results as comments on this ticket. File GitHub issues for any problems found, tag them \"QA: Release\", and associate them with the [1.8.1 milestone](https://github.com/freedomofpress/securedrop/milestone/71) for tracking (or ask a maintainer to do so).\r\n\r\nTest debian packages will be posted on https://apt-test.freedom.press signed with [the test key](https://gist.githubusercontent.com/conorsch/ec4008b111bc3142fca522693f3cce7e/raw/2968621e8ad92db4505a31fcc5776422d7d26729/apt-test%2520apt%2520pubkey). An Ansible playbook testing the upgrade path is [here](https://gist.github.com/rmol/eb605e28e290e90f45347f3a2f1ad43e).\r\n\r\n# [QA Matrix for 1.8.1](https://docs.google.com/spreadsheets/d/1JZZ6kozgfFSkMV2XWjajWoLDmABjnzUsmbMCOhUaAAg/edit?usp=sharing)\r\n# [Test Plan for 1.8.1](https://github.com/freedomofpress/securedrop/wiki/1.8.1-Test-Plan)\r\n\r\n\r\n# Prepare release candidate (1.8.1~rc1)\r\n- [x] Cherry-pick changes to release/1.8.0 branch @zenmonkeykstop  https://github.com/freedomofpress/securedrop/pull/5890\r\n- [ ] Link to latest version of Tails, including release candidates, to test against during QA\r\n- [x] Prepare 1.8.1~rc1 release changelog\r\n- [x] Prepare 1.8.1~rc1 Tag https://github.com/freedomofpress/securedrop/tree/1.8.1-rc1\r\n- [x] Build debs and put up `1.8.1~rc1` on test apt server: https://github.com/freedomofpress/securedrop-dev-packages-lfs/pull/102\r\n- [x] Commit build logs to https://github.com/freedomofpress/build-logs/commit/639b9f5d2c0aea1b03415ee1724d1f602ac017ed\r\n\r\n# Final release\r\n- [x] Ensure builder in release branch is updated and/or update builder image\r\n- [x] Push signed tag https://github.com/freedomofpress/securedrop/releases/tag/1.8.1\r\n- [x] Pre-Flight: Test updater logic in Tails (apt-qa tracks the `release` branch in the LFS repo)\r\n- [x] Build final Debian packages for 1.8.0 (and preserve build logs)\r\n- [x] Commit package build logs to https://github.com/freedomofpress/build-logs/commit/03a90fa69bbb8256cbb034675b09ddd60e17f25c\r\n- [x] Upload Debian packages to apt-qa server \r\n- [x] Pre-Flight: Test that install and upgrade from 1.8.0 to 1.8.1 works w/ prod repo debs (apt-qa.freedom.press polls the `release` branch in the LFS repo for the debs)\r\n- [x] Flip apt QA server to prod status (merge to `main` in the LFS repo)\r\n- [x] Merge Docs branch changes to ``main`` and verify new docs build in securedrop-docs repo\r\n- [x] Prepare release messaging\r\n\r\n# Post release\r\n- [x] Create GitHub release object https://github.com/freedomofpress/securedrop/releases/tag/1.8.0\r\n- [x] Once release object is created, update versions in `securedrop-docs` and Wagtail\r\n- [x] Build readthedocs and verify new docs show up on https://docs.securedrop.org\r\n- [x] Publish announcements\r\n- [ ] Merge changelog, https://github.com/freedomofpress/securedrop/pull/5899, and https://github.com/freedomofpress/securedrop/pull/5894/ back to `develop`\r\n- [ ] Update upgrade testing boxes (might not be possible due to https://github.com/freedomofpress/securedrop/issues/5883)\r\n- [x] Update roadmap wiki page: https://github.com/freedomofpress/securedrop/wiki/Development-Roadmap\r\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n# To execute on prod:\n# python3 disable_v2.py /etc/tor/torrc /etc/tor/torrc\n# To execute for testing locally:\n# python3 disable_v2.py /etc/tor/torrc /tmp/dumytorrc\nimport sys\n\n\ndef filter_v2(filename):\n    # Read the file\n    with open(filename) as f:\n        data = f.readlines()\n    # We will store the filtered lines to result\n    result = []\n\n    i = 0\n    while i < len(data):\n        line = data[i]\n        if line == \"HiddenServiceDir /var/lib/tor/services/source\\n\":\n            i += 1\n            while data[i].strip() == \"\":\n                i += 1\n            line = data[i]\n            if line == \"HiddenServiceVersion 2\\n\":\n                i += 1\n                line = data[i]\n                while data[i].strip() == \"\":\n                    i += 1\n                line = data[i]\n                if line == \"HiddenServicePort 80 127.0.0.1:80\\n\":\n                    i += 1\n                    continue\n        # Now check for journalist\n        if line == \"HiddenServiceDir /var/lib/tor/services/journalist\\n\":\n            i += 1\n            while data[i].strip() == \"\":\n                i += 1\n            line = data[i]\n            if line == \"HiddenServiceVersion 2\\n\":\n                i += 1\n                line = data[i]\n                while data[i].strip() == \"\":\n                    i += 1\n                line = data[i]\n                if line == \"HiddenServicePort 80 127.0.0.1:8080\\n\":\n                    i += 1\n                    line = data[i]\n                    while data[i].strip() == \"\":\n                        i += 1\n                    line = data[i]\n                    if line == \"HiddenServiceAuthorizeClient stealth journalist\\n\":\n                        i += 1\n                        continue\n        # Now the v2 ssh access\n        if line == \"HiddenServiceDir /var/lib/tor/services/ssh\\n\":\n            i += 1\n            while data[i].strip() == \"\":\n                i += 1\n            line = data[i]\n            if line == \"HiddenServiceVersion 2\\n\":\n                i += 1\n                line = data[i]\n                while data[i].strip() == \"\":\n                    i += 1\n                line = data[i]\n                if line == \"HiddenServicePort 22 127.0.0.1:22\\n\":\n                    i += 1\n                    line = data[i]\n                    while data[i].strip() == \"\":\n                        i += 1\n                    line = data[i]\n                    if line == \"HiddenServiceAuthorizeClient stealth admin\\n\":\n                        i += 1\n                        continue\n\n        result.append(line)\n        i += 1\n\n    # Now return the result\n    return result\n\n\nif __name__ == \"__main__\":\n    filename = sys.argv[1]\n    outputfilename = sys.argv[2]\n    result = filter_v2(filename)\n    with open(outputfilename, \"w\") as fobj:\n        for line in result:\n            fobj.write(line)\n", "path": "install_files/ansible-base/roles/restore/files/disable_v2.py"}], "after_files": [{"content": null, "path": "install_files/ansible-base/roles/restore/files/disable_v2.py"}]}