gds-operations/puppet-resolvconf — pull request #8 by rfletcher (2014-07-13 16:38:18+00:00)
Title: DHCP detection when network config is split across multiple files

As a result of [Ubuntu bug #1262951](https://bugs.launchpad.net/ubuntu/+bug/1262951), /etc/network/interfaces may not contain the complete network configuration. External config files can now be sourced from that file.

That was the setup on some of our 12.10 servers, so the dhcp_enabled fact was incorrectly reporting `false`.

This change updates the custom `dhcp_enabled` fact to check /etc/network/interfaces *and* any external files sourced from that file.

Here's the configuration from one of our servers which was failing before (`dhcp_enabled` was reporting `false`):

````
ubuntu@server:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 12.04.4 LTS
Release:	12.04
Codename:	precise
````
````
ubuntu@server:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Source interfaces
# Please check /etc/network/interfaces.d before changing this file
# as interfaces may have been defined in /etc/network/interfaces.d
# NOTE: the primary ethernet device is defined in
# /etc/network/interfaces.d/eth0
# See LP: #1262951
source /etc/network/interfaces.d/*.cfg
````
````
ubuntu@server:~$ cat /etc/network/interfaces.d/eth0.cfg
# The primary network interface
auto eth0
iface eth0 inet dhcp
````