3 \me @stddlZddlZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z ejeZGdddZdS) N)Optional)Distro)PathsRunners)events) DataSourcec@seZdZd!eeeeeee j dddZ e ddZ d"dd Zd d Zd#d dZddZe ddZddZddZd$ddZddZd%ddZd&ddZd'dd ZdS)(CloudN) datasourcepathscfgdistrorunnersreportercCs@||_||_||_||_||_|dkr6tjdddd}||_dS)Nzunnamed-cloud-reporterF)name descriptionZreporting_enabled)r r r _cfg_runnersrReportEventStackr)selfr r r r r rr/usr/lib/python3.6/cloud.py__init__ s zCloud.__init__cCs tj|jS)N)copydeepcopyr)rrrrr 6sz Cloud.cfgFcCs|jj|||||S)N)rrun)rrZfunctorargsZfreqZ clear_on_failrrrr;sz Cloud.runcCs6|jj|}tjj|s2tjdtjj||dS|S)Nz-No template found in %s for template named %s)r Z template_tplospathisfileLOGZwarningdirname)rrfnrrrget_template_filename>s   zCloud.get_template_filenameTcCs |jj|S)N)r get_userdata)rZ apply_filterrrrr#JszCloud.get_userdatacCs |jjS)N)r get_instance_id)rrrrr$MszCloud.get_instance_idcCs|jjS)N)r launch_index)rrrrr%PszCloud.launch_indexcCs |jjS)N)r get_public_ssh_keys)rrrrr&TszCloud.get_public_ssh_keyscCs |jjS)N)r get_locale)rrrrr'WszCloud.get_localecCs|jj||dS)N)fqdn metadata_only)r get_hostname)rr(r)rrrr*ZszCloud.get_hostnamecCs |jj|S)N)r device_name_to_device)rrrrrr+_szCloud.device_name_to_devicecCs |jj|S)N)r get_ipath_cur)rrrrrr,bszCloud.get_ipath_curcCs |jj|S)N)r get_cpath)rrrrrr-eszCloud.get_cpathcCs |jj|S)N)r get_ipath)rrrrrr.hszCloud.get_ipath)N)NF)T)FF)N)N)N)__name__ __module__ __qualname__rrdictrrrrrrpropertyr rr"r#r$r%r&r'r*r+r,r-r.rrrrrs        r)rZloggingrZtypingrZcloudinit.distrosrZcloudinit.helpersrrZcloudinit.reportingrZcloudinit.sourcesrZ getLoggerr/rrrrrrs