aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/impl_ifcfg.py
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2015-09-23 15:59:44 -0400
committerDan Prince <dprince@redhat.com>2015-09-23 15:59:44 -0400
commitd788652276344c8dbe5a97d629f19a66c9de97f4 (patch)
treeb834442dc349fab54e416f614e26c3dc507a2f9d /os_net_config/impl_ifcfg.py
parent64123ba0e7ddda112b646bfa5e48f15402921350 (diff)
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
Diffstat (limited to 'os_net_config/impl_ifcfg.py')
-rw-r--r--os_net_config/impl_ifcfg.py6
1 files changed, 6 insertions, 0 deletions
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=[]):