U '¡Dgëã@s UdZddlZddlmZmZmZddlmZddlm Z ddl m Z ddl m Z e e¡ZdZd Zd d ge d gd œZe ed<ee eeddœdd„Zdd„ZdS)z0Apk Configure: Configures apk repositories file.éN)Ú temp_utilsÚ templaterÚutil)ÚCloud)ÚConfig)Ú MetaSchema)Ú PER_INSTANCEz+https://alpine.global.ssl.fastly.net/alpinea ## template:jinja # # Created by cloud-init # # This file is written on first boot of an instance # {{ alpine_baseurl }}/{{ alpine_version }}/main {% if community_enabled -%} {{ alpine_baseurl }}/{{ alpine_version }}/community {% endif -%} {% if testing_enabled -%} {% if alpine_version != 'edge' %} # # Testing - using with non-Edge installation may cause problems! # {% endif %} {{ alpine_baseurl }}/edge/testing {% endif %} {% if local_repo != '' %} # # Local repo # {{ local_repo }}/{{ alpine_version }} {% endif %} Zcc_apk_configureZalpineÚ apk_repos)ÚidZdistrosZ frequencyZactivate_by_schema_keysÚmeta)ÚnameÚcfgÚcloudÚargsÚreturncCs”| d¡}|st d|¡dSt |dd¡rSkipping module named %s, no 'alpine_repo' configuration foundÚversionz@Skipping module named %s, 'version' not specified in alpine_repoZlocal_repo_base_urlÚ)ÚgetÚLOGÚdebugrZget_cfg_option_boolÚ_write_repositories_file)r r rrZ apk_sectionrÚalpine_versionÚ local_repo©rúC/usr/lib/python3/dist-packages/cloudinit/config/cc_apk_configure.pyÚhandle>s: ÿÿ þ þ rcCsxd}| dt¡}||| d¡| d¡|dœ}tjddd}|d }tj|td t d |¡t   |||¡t  |¡d S) a Write the /etc/apk/repositories file with the specified entries. @param alpine_repo: A nested dict of the alpine_repo configuration. @param alpine_version: A string of the Alpine version to use. @param local_repo: A string containing the base URL of a local repo. z/etc/apk/repositoriesZbase_urlÚcommunity_enabledÚtesting_enabled)Úalpine_baseurlrrrrztemplate_name-z.tmpl)ÚprefixÚsuffixé)Zcontentz3Generating Alpine repository configuration file: %sN) rÚDEFAULT_MIRRORrZmkstemprZ write_fileÚREPOSITORIES_TEMPLATErrrZrender_to_fileZdel_file)rrrZ repo_filerZparamsZtfileZ template_fnrrrrss  û r)Ú__doc__ZloggingZ cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.settingsrZ getLoggerÚ__name__rr#r$r Ú__annotations__ÚstrÚlistrrrrrrÚs      ü5