Viewing File: /usr/lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pyo

ó
oBú]c@s†dZddlmZddlmZddlmZddlmZeje	ƒZ
eZdddd	gZd
d„Z
d„Zd
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ÿÿÿÿ(tlog(tPER_INSTANCE(t	templater(tutiltfedoratopensusetrheltsless/etc/resolv.confcCsÞg}g}d|krqxV|djƒD]A\}}t|tƒr)|rZ|j|ƒqj|j|ƒq)q)Wnx||D]}|d|=q|W|jdƒs­i|d<n||d<tjd|ƒtj|||ƒdS(Ntoptionstflagss$Writing resolv.conf from template %s(	titemst
isinstancetbooltappendtgettLOGtdebugRtrender_to_file(ttemplate_fntparamsttarget_fnameR	tfalse_flagstkeytvaltflag((sC/usr/lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pytgenerate_resolv_conf=s

cCs¦d|kr |jd|ƒdStj|dtƒsI|jd|ƒdSd|kre|jdƒn|jdƒ}|s‹|jdƒdStd	|d
|dƒdS(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
    tmanage_resolv_confsFSkipping module named %s, no 'manage_resolv_conf' key in configurationNsGSkipping module named %s, 'manage_resolv_conf' present but set to Falsetresolv_confs3manage_resolv_conf True but no parameters provided!sresolv.confs1No template found, not rendering /etc/resolv.confRR(RRtget_cfg_option_booltFalsetwarningtget_template_filenameR(tnametcfgtcloudRt_argsR((sC/usr/lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pythandleTs 
		
N(t__doc__t	cloudinitRtloggingtcloudinit.settingsRRRt	getLoggert__name__Rt	frequencytdistrosRR$(((sC/usr/lib/python2.7/site-packages/cloudinit/config/cc_resolv_conf.pyt<module>/s
Back to Directory File Manager