Ë
    œf­  ã                   ó4  — U d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ d	Zd
gZdddee ed«       ed«       ed«       ed«       ed«       ed«      geg dœZeed<    ee«      Z  ej(                  e«      Zdede
dededdf
d„Zy)z)Update Hostname: Update hostname and fqdné    N)Údedent)Úutil)ÚCloud)ÚConfig)Ú
MetaSchemaÚget_meta_doc)Ú
PER_ALWAYSzöThis module will update the system hostname and fqdn. If ``preserve_hostname``
is set ``true``, then the hostname will not be altered.

.. note::
    for instructions on specifying hostname and fqdn, see documentation for
    ``cc_set_hostname``
ÚallÚcc_update_hostnamezUpdate HostnamezUpdate hostname and fqdna¡          # By default: when ``preserve_hostname`` is not specified cloud-init
        # updates ``/etc/hostname`` per-boot based on the cloud provided
        # ``local-hostname`` setting. If you manually change ``/etc/hostname``
        # after boot cloud-init will no longer modify it.
        #
        # This default cloud-init behavior is equivalent to this cloud-config:
        preserve_hostname: false
        zh        # Prevent cloud-init from updating the system hostname.
        preserve_hostname: true
        ze        # Prevent cloud-init from updating ``/etc/hostname``
        preserve_hostname: true
        zÌ        # Set hostname to "external.fqdn.me" instead of "myhost"
        fqdn: external.fqdn.me
        hostname: myhost
        prefer_fqdn_over_hostname: true
        create_hostname_file: true
        zÇ        # Set hostname to "external" instead of "external.fqdn.me" when
        # cloud metadata provides the ``local-hostname``: "external.fqdn.me".
        prefer_fqdn_over_hostname: false
        zß        # On a machine without an ``/etc/hostname`` file, don't create it
        # In most clouds, this will result in a DHCP-configured hostname
        # provided by the cloud
        create_hostname_file: false
        )ÚidÚnameÚtitleÚdescriptionÚdistrosÚexamplesÚ	frequencyÚactivate_by_schema_keysÚmetar   ÚcfgÚcloudÚargsÚreturnc                 ó¾  — t        j                  |dd«      rt        j                  d| «       y t        j                  |dd «      }||j                  j                  d|«       t        j                  |dd «      }||j                  j                  d|«       t        j                  ||«      \  }}}|r|dk(  rt        j                  d«       y 	 t        j                  j                  |j                  d«      d	«      }	t        j                  d
||«       |j                  j                  |||	«       y # t        $ r t        j                  t        d||«       ‚ w xY w)NÚpreserve_hostnameFzWConfiguration option 'preserve_hostname' is set, not updating the hostname in module %sÚprefer_fqdn_over_hostnameÚcreate_hostname_fileÚ	localhostz6Hostname is localhost. Let other services handle this.Údatazprevious-hostnamezUpdating hostname to %s (%s)z(Failed to update the hostname to %s (%s))r   Úget_cfg_option_boolÚLOGÚdebugÚdistroÚ
set_optionÚget_hostname_fqdnÚosÚpathÚjoinÚ	get_cpathÚupdate_hostnameÚ	ExceptionÚlogexc)
r   r   r   r   Úhostname_fqdnr   ÚhostnameÚfqdnÚ
is_defaultÚprev_fns
             úE/usr/lib/python3/dist-packages/cloudinit/config/cc_update_hostname.pyÚhandler2   _   sE  € Ü×Ñ Ð%8¸%Ô@Ü	‰	ð6àô	
ð
 	ô ×,Ñ,ØÐ(¨$ó€Mð Ð Ø‰×ÑÐ ;¸]ÔKô  ×3Ñ3ØÐ# TóÐð Ð'Ø‰×ÑÐ 6Ð8LÔMä#'×#9Ñ#9¸#¸uÓ#EÑ €XˆtZÙh +Ò-ä	‰	ÐJÔKØðÜ—'‘'—,‘,˜uŸ™¨vÓ6Ð8KÓLˆÜ	‰	Ð0°$¸ÔAØ‰×$Ñ$ X¨t°WÕ=øÜò Ü‰ÜÐ;¸TÀ8ô	
ð 	ð	ús   ÃA#D5 Ä5'E)Ú__doc__Úloggingr%   Útextwrapr   Ú	cloudinitr   Úcloudinit.cloudr   Úcloudinit.configr   Úcloudinit.config.schemar   r   Úcloudinit.settingsr	   ÚMODULE_DESCRIPTIONr   r   Ú__annotations__Ú	getLoggerÚ__name__r    ÚstrÚlistr2   © ó    r1   ú<module>rC      s  ðò 0ã Û 	Ý å Ý !Ý #ß <Ý )ðÐ ð ˆ'€ð ØØ'Ø%Øáðó
	
ñ 	ðó	
ñ 	ðó	
ñ 	ðó	
ñ 	ðó	
ñ 	ðó	
ðQ0ðb Ø!ñq9€€jó 9ñv tÓ
€Ø€g×Ñ˜Ó!€ð%ð %˜6ð %¨%ð %°tð %Àô %rB   