HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_resolv_conf.cpython-36.pyc
3

�xh��@s�UdZddlZddlmZddlmZmZddlmZddl	m
Z
ddlmZm
Z
ddlmZeje�Zd	d
d�ZdZd
ddedddddddddddddddgeed�gd gd!�Zee
e�Zd"d#�Zee
eedd$�d%d&�ZdS)'z"Resolv Conf: configure resolv.conf�N)�dedent)�	templater�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�PER_INSTANCEzresolv.confzsystemd.resolved.conf)z/etc/resolv.confz/etc/systemd/resolved.confa�Unless manually editing :file:`/etc/resolv.conf` is the correct way to manage
nameserver information on your operating system, you do not want to use
this module. Many distros have moved away from manually editing ``resolv.conf``
so please verify that this is the preferred nameserver management method for
your distro before using this module.

Note that using :ref:`network_config` is preferred, rather than using this
module, when possible.

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.

When using a :ref:`datasource_config_drive` and a RHEL-like system,
resolv.conf will also be managed automatically due to the available
information provided for DNS servers in the :ref:`network_config_v2` format.
For those that wish to have different settings, use this module.

In order for the ``resolv_conf`` section to be applied, ``manage_resolv_conf``
must be set ``true``.

.. note::
    For Red Hat with sysconfig, be sure to set PEERDNS=no for all DHCP
    enabled NICs.
Zcc_resolv_confzResolv ConfzConfigure resolv.confZ	almalinuxZalpineZ
cloudlinuxZfedoraZmarinerZopensusez
opensuse-leapzopensuse-microoszopensuse-tumbleweedZphotonZrhelZsle_hpcz	sle-microZslesZ	openeulera�            manage_resolv_conf: true
            resolv_conf:
              nameservers:
                - 8.8.8.8
                - 8.8.4.4
              searchdomains:
                - foo.example.com
                - bar.example.com
              domain: example.com
              sortlist:
                - 10.0.0.1/255
                - 10.0.0.2
              options:
                rotate: true
                timeout: 1
            �manage_resolv_conf)�id�name�title�descriptionZdistrosZ	frequencyZexamplesZactivate_by_schema_keyscCs�g}g}d|krNx<|dj�D],\}}t|t�r|r@|j|�q|j|�qWx||D]}|d|=qXW|jd�s|i|d<||d<tjd|�tj|||�dS)NZoptions�flagsz$Writing resolv.conf from template %s)	�items�
isinstance�bool�append�get�LOG�debugrZrender_to_file)�template_fn�params�target_fnamerZfalse_flags�key�val�flag�r�$/usr/lib/python3.6/cc_resolv_conf.py�generate_resolv_confhs

r)r�cfg�cloud�args�returnc
Cs�d|krtjd|�dStj|dd�s6tjd|�dSd|krLtjd�dSy|jt|jj�}Wnt	k
r�tjd�dSXt
||d|jjd	�dS)
a[
    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
    r
zFSkipping module named %s, no 'manage_resolv_conf' key in configurationNFzGSkipping module named %s, 'manage_resolv_conf' present but set to FalseZresolv_confz3manage_resolv_conf True but no parameters provided!z0No template found, not rendering resolve configs)rrr)rrrZget_cfg_option_boolZwarningZget_template_filename�RESOLVE_CONFIG_TEMPLATE_MAPZdistroZresolve_conf_fn�KeyErrorr)rr r!r"rrrr�handles0


r&)�__doc__Zlogging�textwraprZ	cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrZcloudinit.settingsr	Z	getLogger�__name__rr$ZMODULE_DESCRIPTION�metar�str�listr&rrrr�<module>	sJ