summaryrefslogtreecommitdiff
path: root/cloudinit/distros
diff options
context:
space:
mode:
authorLars Kellogg-Stedman <lars@redhat.com>2017-03-04 17:07:16 -0500
committerScott Moser <smoser@brickies.net>2017-03-07 12:48:32 -0500
commit657fd40f9ee692a817ec4614cd0d6cb0539ffabf (patch)
tree868e1b81534cf924687da24bf46b6e57c0a28667 /cloudinit/distros
parent1c795b974d13ba269763bb6016ecdbcaa9c7269d (diff)
downloadvyos-cloud-init-657fd40f9ee692a817ec4614cd0d6cb0539ffabf.tar.gz
vyos-cloud-init-657fd40f9ee692a817ec4614cd0d6cb0539ffabf.zip
net: do not raise exception for > 3 nameservers
log a warning rather than raising ValueError if we see more than three nameserver addresses. LP: #1670052
Diffstat (limited to 'cloudinit/distros')
-rw-r--r--cloudinit/distros/parsers/resolv_conf.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/cloudinit/distros/parsers/resolv_conf.py b/cloudinit/distros/parsers/resolv_conf.py
index ff6ee307..d1f8a042 100644
--- a/cloudinit/distros/parsers/resolv_conf.py
+++ b/cloudinit/distros/parsers/resolv_conf.py
@@ -6,9 +6,11 @@
from six import StringIO
+from cloudinit.distros.parsers import chop_comment
+from cloudinit import log as logging
from cloudinit import util
-from cloudinit.distros.parsers import chop_comment
+LOG = logging.getLogger(__name__)
# See: man resolv.conf
@@ -79,9 +81,10 @@ class ResolvConf(object):
if len(new_ns) == len(current_ns):
return current_ns
if len(current_ns) >= 3:
- # Hard restriction on only 3 name servers
- raise ValueError(("Adding %r would go beyond the "
- "'3' maximum name servers") % (ns))
+ LOG.warn("ignoring nameserver %r: adding would "
+ "exceed the maximum of "
+ "'3' name servers (see resolv.conf(5))" % (ns))
+ return current_ns[:3]
self._remove_option('nameserver')
for n in new_ns:
self._contents.append(('option', ['nameserver', n, '']))