Browse Source

Merge "Only force DNS handling if there is DNS data"

changes/26/788126/2
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
c2e2a920e8
2 changed files with 12 additions and 8 deletions
  1. +12
    -2
      glean/cmd.py
  2. +0
    -6
      glean/install.py

+ 12
- 2
glean/cmd.py View File

@ -26,6 +26,7 @@ import subprocess
import sys
import time
from glean import install
from glean import systemlock
from glean import utils
from glean._vendor import distro
@ -959,7 +960,10 @@ def write_debian_interfaces(interfaces, sys_interfaces, args):
return files_to_write
def write_dns_info(dns_servers):
def write_dns_info(dns_servers, args):
# exit early if there are no DNS servers
if not dns_servers:
return {}
# will fail on non-systemd systems (what we want)
# will exit 1 if not enabled (what we want)
# will exit 0 if enabled (or indirectly enabled)
@ -994,6 +998,12 @@ def write_dns_info(dns_servers):
resolved_conf_fd.close()
# add the config to files to be written
resolve_confs['/etc/systemd/resolved.conf'] = resolved_conf_output
# make sure NetworkManager does not override our configuration
if args.use_nm:
install.install(
'nm-no-resolv-handling.conf',
'/etc/NetworkManager/conf.d/nm-no-resolv-handling.conf',
mode='0644')
return resolve_confs
@ -1383,7 +1393,7 @@ def write_network_info_from_config_drive(args, meta_data):
dns = {}
if not args.skip_dns:
dns = write_dns_info(get_dns_from_config_drive(network_info))
dns = write_dns_info(get_dns_from_config_drive(network_info), args)
interfaces = get_config_drive_interfaces(network_info)
if 'meta' in meta_data and 'glean_ignore_interfaces' in meta_data['meta']:
# Force DHCP to be used ignoring the interface information.


+ 0
- 6
glean/install.py View File

@ -152,12 +152,6 @@ def main():
'/etc/udev/rules.d/99-glean.rules',
mode='0644')
if args.use_nm:
# glean handles resolv.conf, so this turns off nm touching
# it
install('nm-no-resolv-handling.conf',
'/etc/NetworkManager/conf.d/nm-no-resolv-handling.conf',
mode='0644')
# NetworkManager has a "after" network-pre, and
# glean@<interface> services have a "before". However, if
# udev has not yet triggered and started the glean


Loading…
Cancel
Save