sailesh1993 / rpms / cloud-init

Forked from rpms/cloud-init a year ago
Clone
ef3f20
From daa2bd7c780b91c81154c700aeea25755c53e0a6 Mon Sep 17 00:00:00 2001
ef3f20
From: Ryan McCabe <rmccabe@redhat.com>
ef3f20
Date: Thu, 18 May 2017 23:20:52 -0400
ef3f20
Subject: [PATCH] Add missing sysconfig unit test data
ef3f20
ef3f20
This includes portions of upstream commit:
ef3f20
ef18b8ac4cf7e3dfd98830fbdb298380a192a0fc
ef3f20
ef3f20
Resolves: rhbz#1438082
ef3f20
X-downstream-only: true
ef3f20
---
ef3f20
 cloudinit/net/sysconfig.py                     |  2 +-
ef3f20
 tests/unittests/test_distros/test_netconfig.py | 27 ++++++++++++++++++++++++++
ef3f20
 2 files changed, 28 insertions(+), 1 deletion(-)
ef3f20
ef3f20
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
ef3f20
index 240ed23..ef80d99 100644
ef3f20
--- a/cloudinit/net/sysconfig.py
ef3f20
+++ b/cloudinit/net/sysconfig.py
ef3f20
@@ -246,7 +246,7 @@ class Renderer(renderer.Renderer):
ef3f20
     def __init__(self, config=None):
ef3f20
         if not config:
ef3f20
             config = {}
ef3f20
-        self.sysconf_dir = config.get('sysconf_dir', 'etc/sysconfig/')
ef3f20
+        self.sysconf_dir = config.get('sysconf_dir', 'etc/sysconfig')
ef3f20
         self.netrules_path = config.get(
ef3f20
             'netrules_path', 'etc/udev/rules.d/70-persistent-net.rules')
ef3f20
         self.dns_path = config.get('dns_path', 'etc/resolv.conf')
ef3f20
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
ef3f20
index 85982cf..23ff570 100644
ef3f20
--- a/tests/unittests/test_distros/test_netconfig.py
ef3f20
+++ b/tests/unittests/test_distros/test_netconfig.py
ef3f20
@@ -67,6 +67,33 @@ iface eth1 inet6 static
ef3f20
     gateway 2607:f0d0:1002:0011::1
ef3f20
 '''
ef3f20
 
ef3f20
+V1_NET_CFG = {'config': [{'name': 'eth0',
ef3f20
+
ef3f20
+                          'subnets': [{'address': '192.168.1.5',
ef3f20
+                                       'broadcast': '192.168.1.0',
ef3f20
+                                       'gateway': '192.168.1.254',
ef3f20
+                                       'netmask': '255.255.255.0',
ef3f20
+                                       'type': 'static'}],
ef3f20
+                          'type': 'physical'},
ef3f20
+                         {'name': 'eth1',
ef3f20
+                          'subnets': [{'control': 'auto', 'type': 'dhcp4'}],
ef3f20
+                          'type': 'physical'}],
ef3f20
+              'version': 1}
ef3f20
+
ef3f20
+V1_NET_CFG_IPV6 = {'config': [{'name': 'eth0',
ef3f20
+                               'subnets': [{'address':
ef3f20
+                                            '2607:f0d0:1002:0011::2',
ef3f20
+                                            'gateway':
ef3f20
+                                            '2607:f0d0:1002:0011::1',
ef3f20
+                                            'netmask': '64',
ef3f20
+                                            'type': 'static'}],
ef3f20
+                               'type': 'physical'},
ef3f20
+                              {'name': 'eth1',
ef3f20
+                               'subnets': [{'control': 'auto',
ef3f20
+                                            'type': 'dhcp4'}],
ef3f20
+                               'type': 'physical'}],
ef3f20
+                   'version': 1}
ef3f20
+
ef3f20
 
ef3f20
 class WriteBuffer(object):
ef3f20
     def __init__(self):