U
    ¯AdH  ã                   @   sÌ   U d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ eZd	d
gZdZdZdddedƒeedddddgdgdœZeed< eeƒZ ee
eeeddœdd„Zdd„ ZdS )z)Apt Pipelining: configure apt pipelining.é    )ÚLogger)Údedent)Úutil)ÚCloud)ÚConfig)Ú
MetaSchemaÚget_meta_doc)ÚPER_INSTANCEZubuntuZdebianz+/etc/apt/apt.conf.d/90cloud-init-pipeliningzQ//Written by cloud-init per 'apt_pipelining'
Acquire::http::Pipeline-Depth "%s";
Zcc_apt_pipeliningzApt PipeliningzConfigure apt pipelininga          This module configures apt's ``Acquite::http::Pipeline-Depth`` option,
        which controls how apt handles HTTP pipelining. It may be useful for
        pipelining to be disabled, because some web servers, such as S3 do not
        pipeline properly (LP: #948461).

        Value configuration options for this module are:

        * ``false`` (Default): disable pipelining altogether
        * ``none``, ``unchanged``, or ``os``: use distro default
        * ``<number>``: Manually specify pipeline depth. This is not recommended.zapt_pipelining: falsezapt_pipelining: nonezapt_pipelining: unchangedzapt_pipelining: oszapt_pipelining: 3Úapt_pipelining)ÚidÚnameÚtitleZdescriptionÚdistrosÚ	frequencyZexamplesZactivate_by_schema_keysÚmetaN)r   ÚcfgÚcloudÚlogÚargsÚreturnc                 C   st   |  dd¡}t|ƒ ¡  ¡ }|dkr2td|tƒ n>|dkr>d S |dd„ tdd	ƒD ƒkrdt||tƒ n| d
|¡ d S )Nr
   ÚosZfalseÚ0)ZnoneZ	unchangedr   c                 S   s   g | ]}t |ƒ‘qS © )Ústr)Ú.0Úbr   r   úD/usr/lib/python3/dist-packages/cloudinit/config/cc_apt_pipelining.pyÚ
<listcomp>H   s     zhandle.<locals>.<listcomp>r   é   z%Invalid option for apt_pipelining: %s)Úgetr   ÚlowerÚstripÚwrite_apt_snippetÚDEFAULT_FILEÚrangeZwarning)r   r   r   r   r   Zapt_pipe_valueZapt_pipe_value_sr   r   r   Úhandle>   s    r%   c                 C   s&   t |  }t ||¡ | d|| ¡ dS )z0Writes f_name with apt pipeline depth 'setting'.z+Wrote %s with apt pipeline depth setting %sN)ÚAPT_PIPE_TPLr   Z
write_fileÚdebug)Zsettingr   Zf_nameZfile_contentsr   r   r   r"   N   s    r"   )Ú__doc__Zloggingr   Útextwrapr   Z	cloudinitr   Zcloudinit.cloudr   Zcloudinit.configr   Zcloudinit.config.schemar   r   Zcloudinit.settingsr	   r   r   r#   r&   r   Ú__annotations__r   Úlistr%   r"   r   r   r   r   Ú<module>   sJ   ÿ
ÿûæ    þ