Current File : //lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pyo |
�
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