From d788652276344c8dbe5a97d629f19a66c9de97f4 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 23 Sep 2015 15:59:44 -0400 Subject: ifcfg: Add support for dns_servers Adds in the ability to optionally configure DNS server settings via the ifcfg file formats. The dns_servers JSON is an array which currently supports either 1 or 2 DNS servers (per limitations of the ifcfg format). Change-Id: I9edecfdd4e1d0f39883b72be554cd92c5685881d --- os_net_config/impl_ifcfg.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'os_net_config/impl_ifcfg.py') diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 99273bc..06cf389 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -157,6 +157,12 @@ class IfcfgNetConfig(os_net_config.NetConfig): data += "DEFROUTE=no\n" if base_opt.dhclient_args: data += "DHCLIENTARGS=%s\n" % base_opt.dhclient_args + if base_opt.dns_servers: + data += "DNS1=%s\n" % base_opt.dns_servers[0] + if len(base_opt.dns_servers) == 2: + data += "DNS2=%s\n" % base_opt.dns_servers[1] + elif len(base_opt.dns_servers) > 2: + logger.warning('ifcfg format supports a max of 2 dns servers.') return data def _add_routes(self, interface_name, routes=[]): -- cgit 1.2.3-korg