܍~c VUdZddlmZddlmZddlmZddlmZmZm Z ddl m Z ddl m Z ddlmZmZdd lmZejeZd Zd ZeZd gZd ddedeedededgedgdZeed<eeZdede de dededdf dZdZdS) z0Apk Configure: Configures apk repositories file.)Logger)dedent)log) temp_utils templaterutil)Cloud)Config) MetaSchema get_meta_doc) 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 %} alpinecc_apk_configurez APK ConfigurezConfigure apk repositories filez This module handles configuration of the /etc/apk/repositories file. .. note:: To ensure that apk configuration is valid yaml, any strings containing special characters, especially ``:`` should be quoted. z # Keep the existing /etc/apk/repositories file unaltered. apk_repos: preserve_repositories: true z # Create repositories file for Alpine v3.12 main and community # using default mirror site. apk_repos: alpine_repo: community_enabled: true version: 'v3.12' a # Create repositories file for Alpine Edge main, community, and # testing using a specified mirror site and also a local repo. apk_repos: alpine_repo: base_url: 'https://some-alpine-mirror/alpine' community_enabled: true testing_enabled: true version: 'edge' local_repo_base_url: 'https://my-local-server/local-alpine' apk_repos)idnametitle descriptiondistrosexamples frequencyactivate_by_schema_keysmetarcfgcloudrargsreturnNc|d}|std|dStj|ddrtd|dS|d}|std|dS|d }|std |dS|d d }t |||dS) 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 rz6Skipping module named %s, no 'apk_repos' section foundNpreserve_repositoriesFz8Skipping module named %s, 'preserve_repositories' is set alpine_repoz>Skipping module named %s, no 'alpine_repo' configuration foundversionz@Skipping module named %s, 'version' not specified in alpine_repolocal_repo_base_url)getLOGdebugrget_cfg_option_bool_write_repositories_file) rrrrr apk_sectionr alpine_version local_repos C/usr/lib/python3/dist-packages/cloudinit/config/cc_apk_configure.pyhandler-ps#''+&&K  Dd      -DeLL F     //-00K  L     !__Y//N  N     !6;;J[.*EEEEEcd}|dt}|||d|d|d}tjdd}|d }t j|t td |tj |||t j |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/repositoriesbase_urlcommunity_enabledtesting_enabled)alpine_baseurlr*r1r2r+ztemplate_name-z.tmpl)prefixsuffix)contentz3Generating Alpine repository configuration file: %sN) r$DEFAULT_MIRRORrmkstempr write_fileREPOSITORIES_TEMPLATEr%r&rrender_to_filedel_file)r r*r+ repo_filer3paramstfile template_fns r,r(r(s(I __Z@@N)((__-@AA&??+<== F  &6w G G GE(KOK)>????IICYOOO [)V<<<M+r.) __doc__loggingrtextwrapr cloudinitrrrrcloudinit.cloudr cloudinit.configr cloudinit.config.schemar r cloudinit.settingsr getLogger__name__r%r8r;rrr__annotations__strlistr-r(r.r,rPs766$$$$$$1111111111!!!!!!######<<<<<<<<++++++g!!?>  *   .6          %@ +}_00j000d ,t  4F 4F4F#(4F/54F=A4F 4F4F4F4Fnr.