܍~c 0UdZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z mZdd lmZd Zd gZd d deeedededededgegdZe ed<eeZdede de dededdf dZdS)z)Update Hostname: Update hostname and fqdnN)Logger)dedent)util)Cloud)Config) MetaSchema get_meta_doc) PER_ALWAYSzThis 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`` allcc_update_hostnamezUpdate HostnamezUpdate 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 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 )idnametitle descriptiondistrosexamples frequencyactivate_by_schema_keysmetarcfgcloudlogargsreturncRtj|ddr|d|dStj|dd}||jd|tj||\}}}|r|dkr|ddS t j| dd} |d |||j ||| dS#t$rtj |d ||wxYw) Npreserve_hostnameFzWConfiguration option 'preserve_hostname' is set, not updating the hostname in module %sprefer_fqdn_over_hostname localhostz6Hostname is localhost. Let other services handle this.datazprevious-hostnamezUpdating hostname to %s (%s)z(Failed to update the hostname to %s (%s)) rget_cfg_option_booldebugdistro set_optionget_hostname_fqdnospathjoin get_cpathupdate_hostname Exceptionlogexc) rrrrr hostname_fqdnhostnamefqdn is_defaultprev_fns E/usr/lib/python3/dist-packages/cloudinit/config/cc_update_hostname.pyhandler2Us] %8%@@  6    , ($M   ;]KKK#'#9#u#E#E XtZh+-- JKKK',,uv668KLL 0$AAA $$XtW=====  ;T8     s A&D#D&)__doc__r%loggingrtextwrapr cloudinitrcloudinit.cloudrcloudinit.configrcloudinit.config.schemarr cloudinit.settingsr MODULE_DESCRIPTIONrr__annotations__strlistr2r1rAs0// !!!!!!######<<<<<<<<)))))) '   '%                A'P!_00j000d ,t      #( /5 =A        r@