ó
oBú]c @ s† d Z d d l m Z d d l m Z d d l m Z d d l m Z e j e ƒ Z
e Z d d d d g Z d
d „ Z
d „ Z d
S( sf
Resolv Conf
-----------
**Summary:** configure resolv.conf
This module is intended to manage resolv.conf in environments where early
configuration of resolv.conf is necessary for further bootstrapping and/or
where configuration management such as puppet or chef own dns configuration.
As Debian/Ubuntu will, by default, utilize resovlconf, and similarly RedHat
will use sysconfig, this module is likely to be of little use unless those
are configured correctly.
.. note::
For RedHat with sysconfig, be sure to set PEERDNS=no for all DHCP
enabled NICs.
.. note::
And, in Ubuntu/Debian it is recommended that DNS be configured via the
standard /etc/network/interfaces configuration file.
**Internal name:** ``cc_resolv_conf``
**Module frequency:** per instance
**Supported distros:** fedora, rhel, sles
**Config keys**::
manage_resolv_conf: <true/false>
resolv_conf:
nameservers: ['8.8.4.4', '8.8.8.8']
searchdomains:
- foo.example.com
- bar.example.com
domain: example.com
options:
rotate: <true/false>
timeout: 1
iÿÿÿÿ( t log( t PER_INSTANCE( t templater( t utilt fedorat opensuset rhelt sless /etc/resolv.confc C sÞ g } g } d | k rq xV | d j ƒ D]A \ } } t | t ƒ r) | rZ | j | ƒ qj | j | ƒ q) q) Wn x | | D] } | d | =q| W| j d ƒ s i | d <n | | d <t j d | ƒ t j | | | ƒ d S( Nt optionst flagss$ Writing resolv.conf from template %s( t itemst
isinstancet boolt appendt gett LOGt debugR t render_to_file( t template_fnt paramst target_fnameR t false_flagst keyt valt flag( ( sC /usr/lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pyt generate_resolv_conf= s
c C s¦ d | k r | j d | ƒ d St j | d t ƒ sI | j d | ƒ d Sd | k re | j d ƒ n | j d ƒ } | s‹ | j d ƒ d St d | d
| d ƒ d S( s[
Handler for resolv.conf
@param name: The module name "resolv-conf" from cloud.cfg
@param cfg: A nested dict containing the entire cloud config contents.
@param cloud: The L{CloudInit} object in use.
@param log: Pre-initialized Python logger object to use for logging.
@param args: Any module arguments from cloud.cfg
t manage_resolv_confsF Skipping module named %s, no 'manage_resolv_conf' key in configurationNsG Skipping module named %s, 'manage_resolv_conf' present but set to Falset resolv_confs3 manage_resolv_conf True but no parameters provided!s resolv.confs1 No template found, not rendering /etc/resolv.confR R ( R R t get_cfg_option_boolt Falset warningt get_template_filenameR ( t namet cfgt cloudR t _argsR ( ( sC /usr/lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pyt handleT s
N( t __doc__t cloudinitR t loggingt cloudinit.settingsR R R t getLoggert __name__R t frequencyt distrosR R$ ( ( ( sC /usr/lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pyt <module>/ s