Ë
    x[hë  ã            
       óÀ   — U d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ  ej                  e«      ZdZd	Zd
dgedgdœZeed<   dede	dededdf
d„Zd„ Zy)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 %}

Úcc_apk_configureÚalpineÚ	apk_repos)ÚidÚdistrosÚ	frequencyÚactivate_by_schema_keysÚmetaÚnameÚcfgÚcloudÚargsÚreturnc                 óš  — |j                  d«      }|st        j                  d| «       yt        j                  |dd«      rt        j                  d| «       y|j                  d«      }|st        j                  d| «       y|j                  d	«      }|st        j                  d
| «       y|j                  dd«      }t        |||«       y)a{  
    Call to handle apk_repos sections in cloud-config file.

    @param name: The module name "apk_configure" from cloud.cfg
    @param cfg: A nested dict containing the entire cloud config contents.
    @param cloud: The CloudInit object in use.
    @param log: Pre-initialized Python logger object to use for logging.
    @param _args: Any module arguments from cloud.cfg
    r   z6Skipping module named %s, no 'apk_repos' section foundNÚpreserve_repositoriesFz8Skipping module named %s, 'preserve_repositories' is setÚalpine_repoz>Skipping module named %s, no 'alpine_repo' configuration foundÚversionz@Skipping module named %s, 'version' not specified in alpine_repoÚlocal_repo_base_urlÚ )ÚgetÚLOGÚdebugr   Úget_cfg_option_boolÚ_write_repositories_file)r   r   r   r   Úapk_sectionr   Úalpine_versionÚ
local_repos           úC/usr/lib/python3/dist-packages/cloudinit/config/cc_apk_configure.pyÚhandler&   >   sÇ   € ð —'‘'˜+Ó&€KÙÜ�	‰	ØDÀdô	
ð 	ô ×Ñ Ð-DÀeÔLÜ�	‰	ØFÈô	
ð 	ð
 —/‘/ -Ó0€KÙÜ�	‰	ØLØô	
ð 	ð !—_‘_ YÓ/€NÙÜ�	‰	ØNØô	
ð 	à—‘Ð!6¸Ó;€Jä˜[¨.¸*ÕEó    c                 ór  — d}| j                  dt        «      }||| j                  d«      | j                  d«      |dœ}t        j                  dd¬«      }|d	   }t	        j
                  |t        ¬
«       t        j                  d|«       t        j                  |||«       t	        j                  |«       y)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/repositoriesÚbase_urlÚcommunity_enabledÚtesting_enabled)Úalpine_baseurlr#   r*   r+   r$   ztemplate_name-z.tmpl)ÚprefixÚsuffixé   )Úcontentz3Generating Alpine repository configuration file: %sN)r   ÚDEFAULT_MIRRORr   Úmkstempr   Ú
write_fileÚREPOSITORIES_TEMPLATEr   r   r   Úrender_to_fileÚdel_file)r   r#   r$   Ú	repo_filer,   ÚparamsÚtfileÚtemplate_fns           r%   r!   r!   s   sŸ   € ð (€Ià —_‘_ Z´Ó@€Nð )Ø(Ø(Ÿ_™_Ð-@ÓAØ&Ÿ?™?Ð+<Ó=Ø ñ€Fô ×ÑÐ&6¸wÔG€EØ˜‘(€KÜ‡O�O�KÔ)>Õ?ä‡I�IÐCÀYÔOÜ×Ñ˜[¨)°VÔ<ä‡M�M�+Õr'   )Ú__doc__ÚloggingÚ	cloudinitr   r   r   Úcloudinit.cloudr   Úcloudinit.configr   Úcloudinit.config.schemar   Úcloudinit.settingsr	   Ú	getLoggerÚ__name__r   r1   r4   r   Ú__annotations__ÚstrÚlistr&   r!   © r'   r%   ú<module>rH      s”   ðò 7ã ç 1Ñ 1Ý !Ý #Ý .Ý +à€g×Ñ˜Ó!€ð ?€ðÐ ð> ØˆzØØ +˜}ñ	€€jó ð2F�ð 2F˜6ð 2F¨%ð 2F°tð 2FÀó 2Fójr'   