a '¡Dg¶ã@sŽUdZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z dd ge gd œZ e ed <e e¡Zeeeedd œd d„ZdS)z)Update Hostname: Update hostname and fqdnéN)Úutil)ÚCloud)ÚConfig)Ú MetaSchema)Ú PER_ALWAYSZcc_update_hostnameÚall)ÚidZdistrosZ frequencyZactivate_by_schema_keysÚmeta)ÚnameÚcfgÚcloudÚargsÚreturnc Csòt |dd¡rt d|¡dSt |dd¡}|durB|j d|¡t |dd¡}|durf|j d|¡t ||¡\}}}|r’|dkr’t d¡dSz6tj  |  d¡d ¡} t d ||¡|j  ||| ¡Wn$t yìt  td ||¡‚Yn0dS) NZpreserve_hostnameFzWConfiguration option 'preserve_hostname' is set, not updating the hostname in module %sZprefer_fqdn_over_hostnameÚcreate_hostname_fileZ localhostz6Hostname is localhost. Let other services handle this.Údatazprevious-hostnamezUpdating hostname to %s (%s)z(Failed to update the hostname to %s (%s))rZget_cfg_option_boolÚLOGÚdebugZdistroZ set_optionZget_hostname_fqdnÚosÚpathÚjoinZ get_cpathZupdate_hostnameÚ ExceptionZlogexc) r r r r Z hostname_fqdnrÚhostnameZfqdnZ is_defaultZprev_fn©rúG/usr/lib/python3.9/site-packages/cloudinit/config/cc_update_hostname.pyÚhandles:ýÿÿ   ÿr)Ú__doc__ZloggingrZ cloudinitrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.settingsrr Ú__annotations__Z getLoggerÚ__name__rÚstrÚlistrrrrrÚ s     ü