Merge branch 'master' into issue-1332

This commit is contained in:
funilrys 2020-07-13 11:23:45 +02:00
commit c756858a1b
No known key found for this signature in database
GPG Key ID: 0D8BFEF5515C00C6
4 changed files with 47 additions and 8 deletions

View File

@ -2818,4 +2818,31 @@
# Added July 8, 2020
0.0.0.0 runative-syndicate.com
0.0.0.0 www.protectmobiletechieai.club
0.0.0.0 www.protectmobiletechieai.club
# Added July 10, 2020
0.0.0.0 xad.dnoticias.pt
0.0.0.0 ad.dnoticias.pt
0.0.0.0 advert.puzzles.mkjigsaw.com
0.0.0.0 adtracker.mkjigsaw.com
0.0.0.0 dadsats.com
# Added July 10, 2020
0.0.0.0 cdn.usefathom.com
# Added July 12, 2020
0.0.0.0 calltracking.fathomseo.com
0.0.0.0 adtrack.voicestar.com
0.0.0.0 wildcard.directtrack.com.wipext.digitalriverws.com
0.0.0.0 collect.usefathom.com
0.0.0.0 img3.usefathom.com
0.0.0.0 akr.usesfathom.com
0.0.0.0 archsmarter.usesfathom.com
0.0.0.0 butshesagirl.usesfathom.com
0.0.0.0 gateguardian.usesfathom.com
0.0.0.0 jsfiddle.usesfathom.com
0.0.0.0 justin.usesfathom.com
0.0.0.0 paleoleap.usesfathom.com
0.0.0.0 perroverde.usesfathom.com
0.0.0.0 stats.usesfathom.com
0.0.0.0 d3lvir7538n0oi.cloudfront.net

View File

@ -1,7 +1,8 @@
----
**Take Note!**
- This version of the Hosts file generator, and tests, are for Python 3.5+ only.
- With the exception of issues and PRs regarding changes to `hosts/data/StevenBlack/hosts`, all other issues regarding the content of the produced hosts files should be made with the appropriate data source that contributed the content in question. The contact information for all of the data sources can be found in the `hosts/data/` directory.
* This version of the Hosts file generator, and tests, are for Python 3.5+ only.
* With the exception of issues and PRs regarding changes to `hosts/data/StevenBlack/hosts`, all other issues regarding the content of the produced hosts files should be made with the appropriate data source that contributed the content in question. The contact information for all of the data sources can be found in the `hosts/data/` directory.
----
![Logo](https://raw.githubusercontent.com/StevenBlack/hosts/master/.github/logo.png)
@ -155,15 +156,18 @@ to remove hosts from the generated hosts file.
#### Using NixOS:
To install hosts file on your machine add the following into your `configuration.nix`:
```haskell
networking.extraHosts = let
```nix
{
networking.extraHosts = let
hostsPath = https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts;
hostsFile = builtins.fetchurl hostsPath;
in builtins.readFile "${hostsFile}";
}
```
* NOTE: Change `hostsPath` if you need other versions of hosts file.
* NOTE: The call to `fetchurl` is impure.
* NOTE: Change `hostsPath` if you need other versions of hosts file.
* NOTE: The call to `fetchurl` is impure.
Use `fetchFromGitHub` with the exact commit if you want to always get the same result.

View File

@ -1327,7 +1327,7 @@ class TestFlushDnsCache(BaseStdout):
self.assertIn(expected, output)
@mock.patch("os.path.isfile", side_effect=[True, False, False, True] + [False] * 10)
@mock.patch("subprocess.call", side_effect=[1, 0])
@mock.patch("subprocess.call", side_effect=[1, 0, 0])
def test_flush_posix_fail_then_succeed(self, *_):
with self.mock_property("platform.system") as obj:
obj.return_value = "Linux"

View File

@ -1293,6 +1293,7 @@ def flush_dns_cache():
system_prefixes = ["/usr", ""]
service_types = ["NetworkManager", "wicd", "dnsmasq", "networking"]
restarted_services = []
for system_prefix in system_prefixes:
systemctl = system_prefix + "/bin/systemctl"
@ -1300,18 +1301,25 @@ def flush_dns_cache():
for service_type in service_types:
service = service_type + ".service"
if service in restarted_services:
continue
service_file = path_join_robust(system_dir, service)
service_msg = (
"Flushing the DNS cache by restarting " + service + " {result}"
)
if os.path.isfile(service_file):
if 0 != subprocess.call([systemctl, "status", service],
stdout=subprocess.DEVNULL):
continue
dns_cache_found = True
if subprocess.call(SUDO + [systemctl, "restart", service]):
print_failure(service_msg.format(result="failed"))
else:
print_success(service_msg.format(result="succeeded"))
restarted_services.append(service)
dns_clean_file = "/etc/init.d/dns-clean"
dns_clean_msg = "Flushing the DNS cache via dns-clean executable {result}"