diff options
| author | Chad Smith <chad.smith@canonical.com> | 2017-12-01 10:04:25 -0700 |
|---|---|---|
| committer | Chad Smith <chad.smith@canonical.com> | 2017-12-01 10:04:25 -0700 |
| commit | 9824cecf6d644093c5083ab2d550a58d18d207b0 (patch) | |
| tree | 2a944c65afc7379211ffa6ce0b2f0841bded4c5a /cloudinit/net/sysconfig.py | |
| parent | d4dfa39f8c2d6e386303cbe6abb9bb1f804cae5f (diff) | |
| parent | 7acc9e68fafbbd7c56587aebe752ba6ba8c8a3db (diff) | |
| download | vyos-cloud-init-9824cecf6d644093c5083ab2d550a58d18d207b0.tar.gz vyos-cloud-init-9824cecf6d644093c5083ab2d550a58d18d207b0.zip | |
merge from master at 17.1-46-g7acc9e68
Diffstat (limited to 'cloudinit/net/sysconfig.py')
| -rw-r--r-- | cloudinit/net/sysconfig.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py index f5727969..39d89c46 100644 --- a/cloudinit/net/sysconfig.py +++ b/cloudinit/net/sysconfig.py @@ -7,12 +7,15 @@ import six from cloudinit.distros.parsers import networkmanager_conf from cloudinit.distros.parsers import resolv_conf +from cloudinit import log as logging from cloudinit import util from . import renderer from .network_state import ( is_ipv6_addr, net_prefix_to_ipv4_mask, subnet_is_ipv6) +LOG = logging.getLogger(__name__) + def _make_header(sep='#'): lines = [ @@ -347,6 +350,18 @@ class Renderer(renderer.Renderer): else: iface_cfg['GATEWAY'] = subnet['gateway'] + if 'dns_search' in subnet: + iface_cfg['DOMAIN'] = ' '.join(subnet['dns_search']) + + if 'dns_nameservers' in subnet: + if len(subnet['dns_nameservers']) > 3: + # per resolv.conf(5) MAXNS sets this to 3. + LOG.debug("%s has %d entries in dns_nameservers. " + "Only 3 are used.", iface_cfg.name, + len(subnet['dns_nameservers'])) + for i, k in enumerate(subnet['dns_nameservers'][:3], 1): + iface_cfg['DNS' + str(i)] = k + @classmethod def _render_subnet_routes(cls, iface_cfg, route_cfg, subnets): for i, subnet in enumerate(subnets, start=len(iface_cfg.children)): |
