Skip to content

Instantly share code, notes, and snippets.

@prometheanfire
Created April 16, 2020 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prometheanfire/77295626417800dedb6971e3188ae7a5 to your computer and use it in GitHub Desktop.
Save prometheanfire/77295626417800dedb6971e3188ae7a5 to your computer and use it in GitHub Desktop.
stdin
diff --git a/glean/cmd.py b/glean/cmd.py
index 9974ac1..a577ed5 100644
--- a/glean/cmd.py
+++ b/glean/cmd.py
@@ -953,7 +953,6 @@ def write_dns_info(dns_servers):
# write resolv.conf if the file can be written to (if symlink is pointing
# to a non-existant file, writing will fail), will return false if the
# pointer is incomplete
- log.debug(resolved_enabled)
if resolved_enabled != 0:
log.debug("resolved not in use, writing to /etc/resolv.conf")
resolv_nameservers = ""
@@ -961,7 +960,7 @@ def write_dns_info(dns_servers):
resolv_nameservers += "nameserver {0}\n".format(server)
resolve_confs['/etc/resolv.conf'] = resolv_nameservers
# set up resolved if enabled
- if resolved_enabled is True:
+ if resolved_enabled == 0:
log.debug("resolved in use, writing to /etc/systemd/resolved.conf")
# read the existing config so we only overwrite what's needed
resolved_conf = configparser.ConfigParser()
diff --git a/glean/tests/test_glean.py b/glean/tests/test_glean.py
index ad19313..cfa7dd1 100644
--- a/glean/tests/test_glean.py
+++ b/glean/tests/test_glean.py
@@ -143,13 +143,13 @@ class TestGlean(base.BaseTestCase):
return real_path_exists(path)
def os_system_networkd_side_effect(self, command, *args):
- return True
+ return 0
def os_system_default_side_effect(self, sample_prefix, command):
if command is 'systemctl is-enabled systemd-resolved':
- return False
+ return 1
else:
- return True
+ return 0
@mock.patch('subprocess.call', return_value=0, new_callable=mock.Mock)
@mock.patch('os.fsync', return_value=0, new_callable=mock.Mock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment