| Server IP : 23.254.227.96 / Your IP : 216.73.216.21 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3
��b= � @ s� U d Z ddlmZ ddlmZ ddlmZmZmZ ddl m
Z
mZ ddlm
Z
eje�ZdZdZe
Zd gZd
dded
�eed�ed�ed�ged�Ze
ee�Z dd� Zdd� ZdS )z0Apk Configure: Configures apk repositories file.� )�dedent)�log)�
temp_utils� templater�util)�
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 %}
ZalpineZcc_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'
)�id�name�title�description�distrosZexamples� frequencyc C s� |j d�}|stjd| � dS tj|dd�r<tjd| � dS |j d�}|sZtjd| � dS |j d �}|sxtjd
| � dS |j dd�}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
Z apk_reposz6Skipping module named %s, no 'apk_repos' section foundNZpreserve_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_repoZlocal_repo_base_url� )�get�LOG�debugr Zget_cfg_option_bool�_write_repositories_file) r ZcfgZcloudr Z_argsZapk_sectionr �alpine_version�
local_repo� r �&/usr/lib/python3.6/cc_apk_configure.py�handlel s.
r c C sx d}| j dt�}||| j d�| j d�|d�}tjddd�}|d }tj|td
� tjd|� t j
|||� tj|� dS )
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_baseurlr r r r ztemplate_name-z.tmpl)�prefix�suffix� )Zcontentz3Generating Alpine repository configuration file: %sN)r �DEFAULT_MIRRORr Zmkstempr Z
write_file�REPOSITORIES_TEMPLATEr r r Zrender_to_fileZdel_file)r r r Z repo_filer ZparamsZtfileZtemplate_fnr r r r � s r N)�__doc__�textwrapr Z cloudinitr Zloggingr r r Zcloudinit.config.schemar r Zcloudinit.settingsr Z getLogger�__name__r r"