a '¡DgÖã@stddlZddlZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z e e¡ZGdd„dƒZdS) éN)ÚOptional)ÚDistro)ÚPathsÚRunners)Úevents)Ú DataSourcec@s¨eZdZd!eeeeeee j dœdd„Z e dd„ƒZ d"dd „Zd d „Zd#d d„Zdd„Ze dd„ƒZdd„Zdd„Zd$dd„Zdd„Zd%dd„Zd&dd„Zd'dd „ZdS)(ÚCloudN)Ú datasourceÚpathsÚcfgÚdistroÚrunnersÚreportercCs@||_||_||_||_||_|dur6tjdddd�}||_dS)Nzunnamed-cloud-reporterF)ÚnameÚ descriptionZreporting_enabled)r r r Ú_cfgÚ_runnersrÚReportEventStackr)Úselfr r r r r r©rú3/usr/lib/python3.9/site-packages/cloudinit/cloud.pyÚ__init__ s ýzCloud.__init__cCs t |j¡S©N)ÚcopyÚdeepcopyr©rrrrr 6sz Cloud.cfgFcCs|j |||||¡S)açRun a function gated by a named semaphore for a desired frequency. The typical case for this method would be to limit running of the provided func to a single well-defined frequency: PER_INSTANCE, PER_BOOT or PER_ONCE The semaphore provides a gate that persists across cloud-init boot stage boundaries so multiple modules can share this state even if they happen to be run in different boot stages or across reboots. )rÚrun)rrZfunctorÚargsZfreqZ clear_on_failrrrr;s z Cloud.runcCs6|jj|}tj |¡s2t dtj |¡|¡dS|S)Nz-No template found in %s for template named %s)r Z template_tplÚosÚpathÚisfileÚLOGZwarningÚdirname)rrÚfnrrrÚget_template_filenameIs   ýzCloud.get_template_filenameTcCs |j |¡Sr)r Ú get_userdata)rZ apply_filterrrrr%UszCloud.get_userdatacCs |j ¡Sr)r Úget_instance_idrrrrr&XszCloud.get_instance_idcCs|jjSr)r Ú launch_indexrrrrr'[szCloud.launch_indexcCs |j ¡Sr)r Úget_public_ssh_keysrrrrr(_szCloud.get_public_ssh_keyscCs |j ¡Sr)r Ú get_localerrrrr)bszCloud.get_localecCs|jj||d�S)N)ÚfqdnÚ metadata_only)r Ú get_hostname)rr*r+rrrr,esÿzCloud.get_hostnamecCs |j |¡Sr)r Údevice_name_to_device©rrrrrr-jszCloud.device_name_to_devicecCs |j |¡Sr)r Ú get_ipath_curr.rrrr/mszCloud.get_ipath_curcCs |j |¡Sr)r Ú get_cpathr.rrrr0pszCloud.get_cpathcCs |j |¡Sr)r Ú get_ipathr.rrrr1sszCloud.get_ipath)N)NF)T)FF)N)N)N)Ú__name__Ú __module__Ú __qualname__rrÚdictrrrrrrÚpropertyr rr$r%r&r'r(r)r,r-r/r0r1rrrrrs0ùù        r)rZloggingrÚtypingrZcloudinit.distrosrZcloudinit.helpersrrZcloudinit.reportingrZcloudinit.sourcesrZ getLoggerr2r!rrrrrÚs