
    x[h	              
           U d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	ged
gdZeed<    ej                   e      Zdede	dededdf
dZy)z@Update Etc Hosts: Update the hosts file (usually ``/etc/hosts``)    N)	lifecycle	templaterutil)Cloud)Config)
MetaSchema)
PER_ALWAYScc_update_etc_hostsallmanage_etc_hosts)iddistros	frequencyactivate_by_schema_keysmetanamecfgcloudargsreturnc                    t        j                  |dd      }|j                  j                  }t        j                  |dg      r|dk(  rt        j                  ddd       t        j                  ||      \  }}}|st        j                  d	       y |j                  d
|j                  j                  z        }	|	s"t        d|j                  j                  z        t        j                  |	|||d       y |dk(  ret        j                  ||      \  }}}|st        j                  d	       y t        j                  d|       |j                  j!                  ||       y t        j                  d||        y )Nr   Ftemplate)addonsz+Value 'template' for key 'manage_etc_hosts'z22.2zUse 'true' instead.)
deprecateddeprecated_versionextra_messagez<Option 'manage_etc_hosts' was set, but no hostname was foundzhosts.%sz.No hosts template could be found for distro %s)hostnamefqdn	localhostzManaging localhost in %szPConfiguration option 'manage_etc_hosts' is not set, not managing %s in module %s)r   get_cfg_option_strdistrohosts_fntranslate_boolr   	deprecateget_hostname_fqdnLOGwarningget_template_filenameosfamilyRuntimeErrorr   render_to_filedebugupdate_etc_hosts)
r   r   r   r   manage_hostsr"   r   r   _tpl_fn_names
             F/usr/lib/python3/dist-packages/cloudinit/config/cc_update_etc_hosts.pyhandler2      sd   **30BEJL||$$H<=:%H#)3
 #44S%@4KKN  11%,,//0
 @<<((* 
 	  $#G	
 
	$"44S%@4KKN 		,h7%%h5		,		
    )__doc__logging	cloudinitr   r   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.settingsr	   r   __annotations__	getLogger__name__r&   strlistr2    r3   r1   <module>rA      s}    G  0 0 ! # . )  w 23	j  g!1
 1
6 1
% 1
t 1
 1
r3   