404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.128.78.107: ~ $
3

\�me���
@s6
ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZ
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZddlmZmZddlm Z ddl!m"Z"m#Z#ddlm$Z$m%Z%ddl&m'Z'ddl(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0dd	l1m2Z2dd
l3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=ddl>m?Z?da@ejAeB�ZCe
jDdiZEd
ejFejGZH�d}ZI�d~ZJdd�ZKe$��ddd��ZLe$��d�dd��ZM�d�dd�ZN�d�dd �ZOePePd!�d"d#�ZQd$d%�ZRGd&d'�d'�ZSGd(d)�d)eT�ZUGd*d+�d+eT�ZVd,d-�ZW�d�d.d/�ZX�d�d0d1�ZY�d�d2d3�ZZ�d�d5d6�Z[�d�d7d8�Z\dd9�e+d:�d;d<�Z]d=d>�Z^d?d@�Z_dAdB�Z`�d�dDdE�ZadFdG�ZbeceddH�dIdJ�ZedKdL�ZfdCdCdejgdCfdMdN�Zhe$�dOdP��Zie$�dQdR��Zje$�dSdT��Zke$�dUdV��Zle$�dWdX��Zme$�dYdZ��Zn�d�d\d]�Zo�d�d^d_�Zp�d�d`da�Zq�d�dbdc�Zre$�ddde��Zsdfdg�Zte$�dhdi��Zu�d�djdk�Zv�d�dldm�Zwdndo�Zx�d�dpdq�Zy�d�e/e-eddr�dsdt�Zzej{dudv��Z|ej{dwdx��Z}dydz�Z~d{d|�Z�d�dd��Z��d�d�d��Z�dedffd�d��Z��d�d�d��Z�dd9�edd:�d�d��Z�dd9�edd:�d�d��Z��d�d�d��Z��d�d�d��Z�d�d��Z�ed�d�d�d�g�Z��d�d�d��Z��d�d�d��Z�e�d:�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z�d�d��Z��d�d�d��Z��d�d�d��Z��d�d�d��Z��d�d�d��Z��d�d�d��Z��d�d�d��Z�d�d��Z��d�d�d��Z�e$�d�d���Z�d�d��Z�e�d:�d�d��Z��d�d�d��Z��d�d�d„Z��d�d�dĄZ�d�dƄZ�d�dȄZ�d�dʄZ��d�ececd˜d�d̈́Z�e
j�ePdΜd�dЄZ�d�d҄Z�d�dԄZ�d�dքZ��d�d�dلZ�edffd�dۄZ�d�d݄Z��d�d�d߄Z�ej{d�d��Z�d�d�Z��d�d�d�Z�d�d�Z�d�d�Z��d�d�d�Z�d�d�Z�d�d�Zd�d�Z�e$�d�d��Z�d�d��Z�d�d��Z��d�d[d��e�e�dd��d�d��Z�d�d��Z�d��d�Z�ece��d��d�d�Z�ece��d��d�d�Z�ecec�d��d�d�Z�ecec�d��d	�d
�Z�ece,ec�d��d�d
�Z��d�dCdd�d��d�d�Zd�d�ZÐd��d�d�ZĐd��d�d�ZŐd��d�d�ZƐd�d�Zǐd�d�ZȐd �d!�Zɐd"�d#�Z�e$��d$�d%��Zːd&�d'�Z̐d��d)�d*�Z͐d+�d,�Zΐd-�d.�Zϐd/�d0�Z�eCd[f�d1�d2�Zѐd3�d4�ZҐd5�d6�ZӐd7�d8�ZԐd9�d:�ZՐd;�d<�Z֐d��d=�d>�Z�eCd[f�d?�d@�Z�ece��dA��dB�dC�Z�e0�dD�Zڐd�e)�dEe�feڐdF��dG�dH�ZېdI�dJ�Z�dde
j�jDf�dK�dL�Zސd��dN�dO�ZߐdP�dQ�Z�d��dR�dS�Z�dT�dU�Z�d��dV�dW�Z�dX�dY�Z�dZ�d[�Z�d��d\�d]�Z�d��d_�d`�Z�da�db�Z�d��dc�dd�Z�de�df�Z�dg�dh�Z�di�dj�Z�d��dm�dn�Z�e%G�do�dp��dpe�dp�dq�dr�ds�dtg���Z�dd~d[�du�ecece.ece�e��dv��dw�dx�Z�d~�dy�ecece��dz��d{�d|�Z�dS(��N)�	b64decode)�deque�
namedtuple)�suppress)�EACCES�ENOENT)�	lru_cache�total_ordering)�Path)�Callable�Deque�Dict�List�Mapping�Optional�Sequence�TypeVar)�parse)
�features�importer�mergers�net�safeyaml�subp�
temp_utils�
type_utils�
url_helper�version)�CFG_BUILTIN�_z_-.()�true�1�on�yes�off�0�no�falsecCs"ttttj�jjd�dd���S)N�.�)�tuple�map�int�os�uname�release�split�r1r1�/usr/lib/python3.6/util.py�kernel_versionRsr3cCstjddgd|d�}|jj�S)z�Return the sanitized string output by `dpkg --print-architecture`.

    N.B. This function is wrapped in functools.lru_cache, so repeated calls
    won't shell out every time.
    Zdpkgz--print-architectureT)�capture�target)r�stdout�strip)r5�outr1r1r2�get_dpkg_architectureVsr9c	s�ddddd�}i�y�tjddgd|d	�}x:|jj�D],}|jd
�\}}}||kr4|j��||<q4W�fdd�|j�D�}t|�r�tjd
dj	|��WnFtj
k
r�}z(tjd|�tdd�|j�D���WYdd}~XnX�S)N�codename�description�idr/)ZCodenameZDescriptionzDistributor IDZRelease�lsb_releasez--allT)r4r5�:csg|]}|�kr|�qSr1r1)�.0�k)�datar1r2�
<listcomp>sszlsb_release.<locals>.<listcomp>z.Missing fields in lsb_release --all output: %s�,z#Unable to get lsb_release --all: %scss|]}|dfVqdS)ZUNAVAILABLENr1)r?�vr1r1r2�	<genexpr>|szlsb_release.<locals>.<genexpr>)rr6�
splitlines�	partitionr7�values�len�LOG�warning�join�ProcessExecutionError�dict)	r5Zfmapr8�line�fnamer�val�missing�errr1)rAr2r=cs((r=�utf-8cCst|t�r|S|j|�S)N)�
isinstance�str�decode)�blob�encodingr1r1r2�
decode_binary�s
rZcCst|t�r|S|j|�S)N)rU�bytes�encode)�textrYr1r1r2�encode_text�s
r^)rA�returncCsBt|t�stdt|���yt|dd�Stjk
r<|SXdS)z�base64 decode data

    If data is base64 encoded bytes, return b64decode(data).
    If not, return data unmodified.

    @param data: data as bytes. TypeError is raised if not bytes.
    zdata is '%s', expected bytesT)ZvalidateN)rUr[�	TypeError�typer�binascii�Error)rAr1r1r2�maybe_b64decode�s
rdcCsP|jdd�}|j�dkrLt|t�rL|j�}|r<|jr<|j}nd}|j|d�S|S)NT)rWr]zutf-8�surrogateescape)Zget_payloadZget_content_maintyperUr[Zget_charsetZinput_codecrW)�partZcte_payload�charsetrYr1r1r2�fully_decoded_payload�s
rhc@s&eZdZd	dd�Zdd�Zdd�ZdS)
�SeLinuxGuardFcCs<ytjd�|_Wntk
r*d|_YnX||_||_dS)N�selinux)r�
import_modulerj�ImportError�path�	recursive)�selfrmrnr1r1r2�__init__�szSeLinuxGuard.__init__cCs|jr|jj�rdSdSdS)NTF)rj�is_selinux_enabled)ror1r1r2�	__enter__�szSeLinuxGuard.__enter__cCs�|js|jj�rdStjj|j�s*dStjj|j�}y"tj|�}|jj||tj	�Wnt
k
rndSXtjd||j
�y|jj||j
d�Wn4t
k
r�}ztjd||j
|�WYdd}~XnXdS)Nz,Restoring selinux mode for %s (recursive=%s))rnz,restorecon failed on %s,%s maybe badness? %s)rjrqr-rm�lexists�realpath�lstatZmatchpathcon�stat�ST_MODE�OSErrorrJ�debugrnZ
restoreconrK)roZ	excp_typeZ
excp_valueZexcp_tracebackrmZstats�er1r1r2�__exit__�s,
zSeLinuxGuard.__exit__N)F)�__name__�
__module__�__qualname__rprrr{r1r1r1r2ri�s

ric@seZdZdS)�MountFailedErrorN)r|r}r~r1r1r1r2r�src@seZdZdS)�DecompressionErrorN)r|r}r~r1r1r1r2r��sr�cOsttj�}|dkr\y|||�tjd�Wqptk
rXttdtj|��tjd�YqpXntjd|tj|��dS)Nrz&Failed forking and calling callback %s�z(Forked child %s who will run callback %s)	r-�fork�_exit�	Exception�logexcrJr�obj_namery)Zchild_cb�args�kwargsZfidr1r1r2�fork_cb�s
r�cCsBt|t�r|dkSt}|r&t|�|}t|�j�j�|kr>dSdS)NTF)rU�bool�TRUE_STRINGS�listrV�lowerr7)rQ�addons�	check_setr1r1r2�is_true�s
r�cCsBt|t�r|dkSt}|r&t|�|}t|�j�j�|kr>dSdS)NFT)rUr��
FALSE_STRINGSr�rVr�r7)rQr�r�r1r1r2�is_falses
r�cCs |sdSt|t�r|St||�S)NF)rUr�r�)rQr�r1r1r2�translate_bools

r�� cs8tj���stjtj�dj��fdd�td|�D��S)N�csg|]}�j���qSr1)Zchoice)r?Z_x)�r�select_fromr1r2rB"szrand_str.<locals>.<listcomp>r)�randomZSystemRandom�string�
ascii_letters�digitsrL�range)�strlenr�r1)r�r�r2�rand_strsr�cCs.|sd}x tdd�d|}||kr
Pq
W|S)Nr��)r�r)r�)Z
dictionaryZpostfixZnewkeyr1r1r2�
rand_dict_key%sr�)�instance_data_file)r_c Cs�ddlm}m}m}yt|�}Wn2tk
rR}z|jtkr@iS�WYdd}~XnX|r�tj	j
|�r�y||||�}tjd||�WnH|k
r�Yn6|k
r�}ztj
d||t|��WYdd}~XnX|dkr�iSt|id�S)z>Read a yaml config with optional template, and convert to dictr)�JinjaLoadError�
NotJinjaError�render_jinja_payload_from_fileNz?Applied instance data in '%s' to configuration loaded from '%s'z:Could not apply Jinja template '%s' to '%s'. Exception: %s)�default)Z!cloudinit.handlers.jinja_templater�r�r��	load_file�IOError�errnorr-rm�existsrJryrK�repr�	load_yaml)rPr�r�r�r�Zconfig_filerzr1r1r2�	read_conf/s8

r�cGstt|��S)N)�sorted�
uniq_merge)�listsr1r1r2�uniq_merge_sortedasr�cGsJg}x<|D]4}t|t�r4|j�jd�}dd�|D�}|j|�q
Wt|�S)NrCcSsg|]}|r|�qSr1r1)r?�ar1r1r2rBsszuniq_merge.<locals>.<listcomp>)rUrVr7r0�extend�	uniq_list)r�Z
combined_list�a_listr1r1r2r�ms

r�cCslx tj�D]\}}|j||�}q
Wg}x|D]}|tkr,|j|�q,Wx|D]}|j|d�}qLW|j�}|S)Nr�)�FN_REPLACEMENTS�items�replace�
FN_ALLOWED�appendr7)�fnr@rDZremovalsr1r1r2�clean_filenamexs

r�TcCs�yLtjt|��}tjtjddd|���}|r8t|j��S|j�SWdQRXWn8t	k
r�}z|rf|St
t|��|�WYdd}~XnXdS)N�rbr�)�io�BytesIOr^�
contextlib�closing�gzipZGzipFilerZ�readr�r�rV)rA�quietrW�bufZghrzr1r1r2�decomp_gzip�sr�cCs�|sdS|jdd�}|dj�}t|�dkr:|dj�}nd}|sX|dksX|j�dkr\d}|sv|dksv|j�dkrzd}||fS)Nr>r�rr)z-1Znone)NN)r0r7rIr�)Zug_pairZ	ug_parted�u�gr1r1r2�extract_usergroup�sr�)�root_dirr_cCslt�}x`tjtjj|d��D]H}tjj|�s.qtjj|�dd�}|j�}|r|jd�dkr|||<qW|S)Nz*.pyr�r(r�������)	rN�globr-rmrL�isfile�basenamer7�find)r��entriesrP�modnamer1r1r2�get_modules_from_dir�sr�c	Cs,t|d��}|j|�|j�WdQRXdS)N�w)�open�write�flush)�conpathr]Zwfhr1r1r2�write_to_console�s
r�c	
Cs�|rtjj|�|r�d}d}tjj|�rxyt||�d}Wn<tk
rvd}tjj|�d��|rr|j	t
j|�YnX|r�|r�tjj|�|r�|ddkr�|j	||dd��n|j	||�dS)	Nz/dev/consoleFTzFailed to write to /dev/console�
r�r�r�)�sys�stderrr�r-rmr�r�rxr6�log�loggingZWARNING)	r]Zconsoler�r�Z	log_levelZfallback_to_stdoutr�Zwriting_to_console_workedZ
console_errorr1r1r2�	multi_log�s(


r�cCsdtj�kS)NZLinux)�platform�systemr1r1r1r2�is_Linux�sr�cCs$dtj�krdStj�dkr dSdS)NZBSDTZ	DragonFlyF)r�r�r1r1r1r2�is_BSD�s
r�cCst�ddkS)N�variant�freebsd)�system_infor1r1r1r2�
is_FreeBSD�sr�cCst�ddkS)Nr��	dragonfly)r�r1r1r1r2�is_DragonFlyBSD�sr�cCst�ddkS)Nr��netbsd)r�r1r1r1r2�	is_NetBSD�sr�cCst�ddkS)Nr��openbsd)r�r1r1r1r2�
is_OpenBSDsr�FcCs||kr|St||�S)N)r�)�yobj�keyr�r1r1r2�get_cfg_option_boolsr�cCs*||kr|S||}t|t�s&t|�}|S)N)rUrV)r�r�r�rQr1r1r2�get_cfg_option_strs
r�cCstt|||d��S)N)r�)r,r�)r�r�r�r1r1r2�get_cfg_option_intsr�cCs�|sd}tjj|�siSt|�}d}d|kr0d}tj||�}|r�|j�}d|dkr`|d|d<|dj�jd�d|d<|dd	kr�d
|d<|d|d|dd�SiS)
z�Return a dictionary of distro info fields from /etc/redhat-release.

    Dict keys will align with /etc/os-release keys:
        ID, VERSION_ID, VERSION_CODENAME
    z/etc/redhat-releasezA(?P<name>.+) release (?P<version>[\d\.]+) \((?P<codename>[^)]+)\)Z	Virtuozzoz)(?P<name>.+) release (?P<version>[\d\.]+)�namer:z linuxrzred hat enterprise�redhatr)�ID�
VERSION_ID�VERSION_CODENAME)	r-rmr�r��re�match�	groupdictr�rG)Zrelease_fileZredhat_releaseZredhat_regexr��groupr1r1r2�_parse_redhat_releases(r�c	Csvd}d}d}i}d}tjjd�r,ttd��}|s:d}t�}|r�|jdd�}|jdd�}d|ksfd|krptj�}nn|d	ks�|d
kr�|jdd�}nP|dkr�|r�|jdd�}n4|jd
d�}|s�t	j
d|jdd��}|r�|j�d}|dkr�d}n�t��r
tj
�j�}tj�}nbd}z(ytj�}Wntk
�r2YnXWdd}x|D]}|�rBd}�qBW|�sftjd�X|S|||fS)Nr�Fz/etc/os-releaseTr�r��sles�suse�alpine�photonZPRETTY_NAME�	virtuozzor�z[^ ]+ \((?P<codename>[^)]+)\)�VERSIONr:�rhelr�r�zPUnable to determine distribution, template expansion may have unexpected results)r�r�r�)r-rmr��load_shell_contentr�r��getr��machiner�r�r�r�r�r�r/�distr�rJrK)	Zdistro_nameZdistro_versionZflavorZ
os_releaseZos_release_rhelr�r�found�entryr1r1r2�get_linux_distro@sZ




r
cCsv|dj�}d}|dkrf|ddj�}|d*kr6|}qr|d+krDd}qr|dkrRd}qr|d,kr`d}qrd}n|d-krr|}|S).Nr��unknown�linuxrr�	almalinuxr��arch�centos�
cloudlinux�debian�	eurolinux�fedora�mariner�miraclelinux�	openeuler�opencloudos�openmandrivarr�rockyr��	tencentosr�ubuntu�	linuxmint�mintr��opensuse�
opensuse-leap�opensuse-microos�opensuse-tumbleweed�sle_hpc�	sle-micror��windows�darwinr�r�r�r�)r
r�rrrrrrrrrrrrrrr�rr)rrr)rrr r!r"r#r�)r$r%r�r�r�r�)r�)�infor�r�Z
linux_distr1r1r2�_get_variant~s`r'cCs<tj�tj�tj�tj�ttj��t�d�}t|�|d<|S)N)r�r�r/�pythonr.rr�)r�r�r/Zpython_versionr�r.r
r')r&r1r1r2r��s

r�cCsX||kr|S||dkrgS||}t|t�r@dd�|D�}|St|t�sRt|�}|gS)a�
    Gets the C{key} config option from C{yobj} as a list of strings. If the
    key is present as a single string it will be returned as a list with one
    string arg.

    @param yobj: The configuration object.
    @param key: The configuration key to get.
    @param default: The default to return if key is not found.
    @return: The configuration option as a list of strings or default if key
        is not found.
    NcSsg|]}|�qSr1r1)r?rDr1r1r2rB�sz'get_cfg_option_list.<locals>.<listcomp>)rUr�rV)r�r�r�rQZcvalr1r1r2�get_cfg_option_list�s

r)cCs>t|t�r|jd�}|}x |D]}||kr.|S||}qW|S)a�Return the value of the item at path C{keyp} in C{yobj}.

    example:
      get_cfg_by_path({'a': {'b': {'num': 4}}}, 'a/b/num') == 4
      get_cfg_by_path({'a': {'b': {'num': 4}}}, 'c/d') == None

    @param yobj: A dictionary.
    @param keyp: A path inside yobj.  it can be a '/' delimited string,
                 or an iterable.
    @param default: The default to return if the path does not exist.
    @return: The value of the item at keyp."
        is not found.�/)rUrVr0)r�Zkeypr�Zcur�tokr1r1r2�get_cfg_by_path�s


r,cCs t||�\}}t||�||fS)N)�get_output_cfg�redirect_output)�cfg�mode�outfmt�errfmtr1r1r2�fixup_output�s
r3c
Cs�ttjjd��rtjd�dS|s(tj}|s2tj}dd�}|�rtjd||�|j	dd�\}}|dksn|d	kr�d
}|dkr~d}t
||�}n0|dkr�tj|d
tj
|d�}	|	j}ntd|��|r�tj|j�|j��||k�rtjd||�tj|j�|j��dS|�r�tjd||�|j	dd�\}}|dk�s:|d	k�rXd
}|dk�rLd}t
||�}n2|dk�r~tj|d
tj
|d�}	|	j}ntd|��|�r�tj|j�|j��dS)NZ_CLOUD_INIT_SAVE_STDOUTz5Not redirecting output due to _CLOUD_INIT_SAVE_STDOUTcSs>tjd�ytjd�j}Wntk
r.YnXtj|�dS)a�Reconfigure umask and group ID to create output files securely.

        This is passed to subprocess.Popen as preexec_fn, so it is executed in
        the context of the newly-created process.  It:

        * sets the umask of the process so created files aren't world-readable
        * if an adm group exists in the system, sets that as the process' GID
          (so that the created file(s) are owned by root:adm)
        �ZadmN)r-�umask�grp�getgrnam�gr_gid�KeyError�setgid)Zgroup_idr1r1r2�set_subprocess_umask_and_gids

z5redirect_output.<locals>.set_subprocess_umask_and_gidzRedirecting %s to %s� r��>z>>�ab�wb�|T)�shell�stdinZ
preexec_fnz"Invalid type for output format: %sz!Invalid type for error format: %s)r�r-�environrrJryr�r6r�r0r��
subprocess�Popen�PIPErBr`�dup2�fileno)
r1r2Zo_outZo_errr;r0�argZowithZnew_fp�procr1r1r2r.
s`



r.)�sourcesr_cCsV|rtt|��}i}x<|D]4}|rtj|�}|s8tj�}tj|�}|j||�}qW|S)aFMerge multiple dicts according to the dict merger rules.

    Dict merger rules can be found in cloud-init documentation. If no mergers
    have been specified, entries will be recursively added, but no values
    get replaced if they already exist. Functionally, this means that the
    highest priority keys must be specified first.

    Example:
    a = {
        "a": 1,
        "b": 2,
        "c": [1, 2, 3],
        "d": {
            "a": 1,
            "b": 2,
        },
    }

    b = {
        "a": 10,
        "c": [4],
        "d": {
            "a": 3,
            "f": 10,
        },
        "e": 20,
    }

    mergemanydict([a, b]) results in:
    {
        'a': 1,
        'b': 2,
        'c': [1, 2, 3],
        'd': {
            'a': 1,
            'b': 2,
            'f': 10,
        },
        'e': 20,
    }
    )r��reversedrZdict_extract_mergersZdefault_mergersZ	construct�merge)rK�reverseZ
merged_cfgr/Zmergers_to_applyZmergerr1r1r2�
mergemanydictZs*


rOccs.tj�}ztj|�|VWdtj|�XdS)N)r-�getcwd�chdir)ZndirZcurrr1r1r2rQ�s


rQccs&tj|�}z
|VWdtj|�XdS)N)r-r5)Zn_msk�oldr1r1r2r5�s

r5cCsdj||d|d�S)Nz{0:{fill}{align}{size}}�^)�fillZalign�size)�format)r]rTZmax_lenr1r1r2�center�srWcCstjd|�tj|�dS)NzRecursively deleting %s)rJry�shutilZrmtree)rmr1r1r2�del_dir�srYr��cCsjy.t|||�\}}}||d<||d<||d<dStjk
rd}z|jtjkrRdS�WYdd}~XnXdS)Nz	user-datazvendor-dataz	meta-dataTF)�read_seededr�UrlError�codeZ	NOT_FOUND)rT�base�ext�timeout�md�ud�vdrzr1r1r2�read_optional_seed�srdcCs�i}|sddg}n(tjj|jd�d�tjj|jd�d�g}t|�}dd�|D�}d}x2|D]*}tjjtjj|d��rZtjj|d�}PqZWd}x2|D]*}tjjtjj|d��r�tjj|d�}Pq�W|r�|r�||d	<||d
<n|r�||d	<|S)Nz/var/lib/cloud/data/sslz /var/lib/cloud/instance/data/sslrAZsslcSs g|]}|rtjj|�r|�qSr1)r-rm�isdir)r?�dr1r1r2rB�sz%fetch_ssl_details.<locals>.<listcomp>zcert.pemzkey.pem�	cert_file�key_file)r-rmrLZ
get_ipath_curZ	get_cpathr�r�)�pathsZssl_detailsZssl_cert_pathsrgrfrhr1r1r2�fetch_ssl_details�s0


rjcCs |}t|�}y\tjdt|�|�tj|�}|dkrBtjd�|}n t||�sbtd|tj	|�f��|}Wn�tj
ttfk
�r}z�d}d}t|d�r�t
|d�r�t
|d�}nt|d�r�t
|d�r�t
|d�}|r�|dj|jd|jd|d	�7}n|d
j|d�7}tj|�WYdd}~XnX|S)NzKAttempting to load yaml from string of length %s with allowed root types %sz-loaded blob returned None, returning default.z2Yaml load allows %s root types, but got %s insteadzFailed loading yaml blobZcontext_markZproblem_markz5. Invalid format at line {line} column {col}: "{err}"r�)rO�colrSz. {err})rS)rZrJryrIr�loadrUr`rr�Z	YAMLError�
ValueError�hasattr�getattrrVrO�columnrK)rXr�ZallowedZloadedZ	convertedrz�msgZmarkr1r1r2r��s<



r��
cCsV|jd�dkr@|jdd|�}|jdd|�}|jdd|�}nTtjrj|ddkrjtj|�jdkrj|d7}d	|d|f}d	|d|f}d	|d|f}tj|||d
�}d}	|j	�r�t
t|j�id�}	tj|||d
�}
d}|
j	�r�|
j}d}ytj|||d
�}
Wn2tj
k
�r.}ztjd|�WYdd}~XnX|
j	��rB|
j}n
tjd
�|	||fS)Nz%srz	user-datazvendor-dataz	meta-datar�r*r�z%s%s%s)r`�retries)r�z!Error in vendor-data response: %szError in vendor-data responser�)r�r�rZ%NOCLOUD_SEED_URL_APPEND_FORWARD_SLASHr�urlparseZqueryrZread_file_or_url�okr�rZ�contentsr\rJry)r^r_r`rsZfile_retriesZud_urlZvd_urlZmd_urlZmd_respraZud_resprbrcZvd_resprzr1r1r2r[
s<

r[cs�ttj��dd�}dd�|D�}�fdd�|D�}g}xh|D]`}y |jttjj�|�|d��Wq<tk
r�}z|jt	kr�t
jd�|�WYdd}~Xq<Xq<Wt|�S)	zRead configuration directory.T)rNcSsg|]}|jd�r|�qS)z.cfg)�endswith)r?�fr1r1r2rB;szread_conf_d.<locals>.<listcomp>cs&g|]}tjjtjj�|��r|�qSr1)r-rmr�rL)r?rx)�confdr1r2rB>s)r�z,REDACTED config part %s/%s for non-root userN)
r�r-�listdirr�r�rmrLrxr�rrJrKrO)ryr�Zconfs�cfgsr�rzr1)ryr2�read_conf_d5s

 r|cCs�t�}i}yt||d�}Wn8tk
rR}z|jtkrBtjd|�WYdd}~XnX|j|�d}d|kr�|d}|r�t|t	�s�t
d|tj|�f��q�t	|�j
�}ntjj|�d��r�|�d�}|r�tjj|�r�t||d�}|j|�t|�S)aRead yaml file along with optional ".d" directory, return merged config

    Given a yaml file, load the file as a dictionary. Additionally, if there
    exists a same-named directory with .d extension, read all files from
    that directory in order and return the merged config. The template
    file is optional and will be applied to any applicable jinja file
    in the configs.

    For example, this function can read both /etc/cloud/cloud.cfg and all
    files in /etc/cloud/cloud.cfg.d and merge all configs into a single dict.
    )r�z)REDACTED config part %s for non-root userNr�Zconf_dz8Config file %s contains 'conf_d' with non-string type %sz.d)rr�rxr�rrJrKr�rUrVr`rr�r7r-rmrer|�
appendleftrO)Zcfgfiler�r{r/rzryZ	confd_cfgr1r1r2�read_conf_with_confdSs.




r~cCstt|d��S)N)�cmdline)r��read_cc_from_cmdline)rr1r1r2�read_conf_from_cmdlinesr�c	Cs�|dkrt�}d|��}d}d}t|�}t|�}t|�}g}|j|�}x`|dkr�|j|||�}|dkrl|}|jtj||||�j��jdd��|j|||�}qHWdj|�S)Nr<z cc:Zend_ccrz\nr�)	�get_cmdlinerIr�r�rZunquote�lstripr�rL)	rZ	tag_beginZtag_endZbegin_lZend_lZclen�tokensZbegin�endr1r1r2r��s&




r�cCs2|jd�}|dks"||ddkr&|S|jdd�S)Nr�rr��
z
)r�r�)rv�posr1r1r2�dos2unix�s
r��HostnameFqdnInfo�hostname�fqdn�
is_defaultcCs�d}d|kr,|d}t|d|jd�d�}nld|krf|djd�dkrf|d}|dd|jd��}n2|jd|d�j}d|kr�|d}n|j|d	�\}}t|||�S)
a�Get hostname and fqdn from config if present and fallback to cloud.

    @param cfg: Dictionary of merged user-data configuration (from init.cfg).
    @param cloud: Cloud instance from init.cloudify().
    @param metadata_only: Boolean, set True to only query cloud meta-data,
        returning None if not present in meta-data.
    @return: a namedtuple of
        <hostname>, <fqdn>, <is_default> (str, str, bool).
        Values can be none when
        metadata_only is True and no cfg or metadata provides hostname info.
        is_default is a bool and
        it's true only if hostname is localhost and was
        returned by util.get_hostname() as a default.
        This is used to differentiate with a user-defined
        localhost hostname.
    Fr�r�r(rNT)r��
metadata_only)r�)r�r0r��get_hostnamer�r�)r/Zcloudr�r�r�r�r1r1r2�get_hostname_fqdn�s
r��
/etc/hostscCs�d}yvxpt|�j�D]`}|jd�}|dkr6|d|�}|j�}|sDq|j�}t|�dkrZq||dd�kr|d}PqWWntk
r�YnX|S)a�
    For each host a single line should be present with
      the following information:

        IP_address canonical_hostname [aliases...]

      Fields of the entry are separated by any number of  blanks  and/or  tab
      characters.  Text  from a "#" character until the end of the line is a
      comment, and is ignored. Host  names  may  contain  only  alphanumeric
      characters, minus signs ("-"), and periods (".").  They must begin with
      an  alphabetic  character  and  end  with  an  alphanumeric  character.
      Optional aliases provide for name changes, alternate spellings, shorter
      hostnames, or generic hostnames (for example, localhost).
    N�#rr�r)r�)r�rFr�r7r0rIr�)r��filenamer�rOZhashpos�toksr1r1r2�get_fqdn_from_hosts�s$

r�cCs<tj|�}|j}tdkr�t�}d}i}x�|D]�}ydtj|dddtjtj�}g||<x>|D]6\}}	}
}}||j	d||df�|j
|d�qXWWq,tjtjfk
r�Yq,Xq,W|a|r�t
jd|�yNtt��tj|jjd��r�d	SWdQRXtj|d�}|dd
d}
|
tkStjtjfk
�r6dSXdS)
a�determine if a url's network address is resolvable, return a boolean
    This also attempts to be resilent against dns redirection.

    Note, that normal nsswitch resolution is used here.  So in order
    to avoid any utilization of 'search' entries in /etc/resolv.conf
    we have to append '.'.

    The top level 'invalid' domain is invalid per RFC.  And example.com
    should also not exist.  The '__cloud_init_expected_not_found__' entry will
    be resolved inside the search list.
    N�does-not-exist.example.com.�example.invalid.�!__cloud_init_expected_not_found__rz%s: %szdetected dns redirection: %sz[]T�F)r�r�r�)rrtr��_DNS_REDIRECT_IP�set�socketZgetaddrinfoZSOCK_STREAMZAI_CANONNAMEr��addZgaierror�errorrJryrrmrZ
is_ip_addressZnetlocr7)�urlZ
parsed_urlr�ZbadipsZbadnamesZ
badresultsZiname�resultZ_famZ_stypeZ_protoZcnameZsockaddrZaddrr1r1r2�
is_resolvables<



r�cCstj�}|S)N)r�Zgethostname)r�r1r1r2r�;sr�cCs*ytj|�dStjk
r$dSXdS)Nr)r��
gethostbyaddrZherror)Zipr1r1r2r�@sr�cCsttjd|t|fd�S)z5determine if this url is resolvable (existing or ip).zResolving URL: )�logfuncrq�funcr�)�log_timerJryr�)r�r1r1r2�is_resolvable_urlGs
r�cCs\|dkrdStjd|�x>|D]6}yt|�r<tjd|�|SWqtk
rRYqXqWdS)zc
    Search through a list of mirror urls for one that works
    This needs to return quickly.
    Nz%search for mirror in candidates: '%s'zfound working mirror: '%s')rJryr�r�)Z
candidatesZcandr1r1r2�search_for_mirrorQs

r�c
CsDttjjd��rdSttj��}tj|j�tj	j��WdQRXdS)z�
    reopen stdin as /dev/null so even subprocesses or other os level things get
    /dev/null as input.

    if _CLOUD_INIT_SAVE_STDIN is set in environment to a non empty and true
    value then input will not be closed (useful for debugging).
    Z_CLOUD_INIT_SAVE_STDINN)
r�r-rCrr��devnullrGrHr�rB)�fpr1r1r2�close_stdindsr��devicecCsvg}|stjd�tjd�S|jd�rL|jd�}dd�d|d|gD�}n&|dkr`tjd�}n|d	krrtjd�}|S)
Nz/dev/msdosfs/*z/dev/iso9660/*zLABEL=cSsg|]}tjj|�r|�qSr1)r-rmr�)r?�pr1r1r2rB{sz*find_devs_with_freebsd.<locals>.<listcomp>z
/dev/msdosfs/z
/dev/iso9660/z	TYPE=vfatzTYPE=iso9660)r��
startswithr�)�criteria�oformat�tag�no_cacherm�devlist�labelr1r1r2�find_devs_with_freebsdrs


r�cCs�g}d}d}|r8|jd�r$|jd�}|jd�r8|jd�}tjdddgdgd�}xx|jj�D]j}	|sf|r�tjd|	gdd	gd�\}
}|r�d
||
kr�qZ|dkr�d|
kr�qZ|d
kr�d|
kr�qZ|jd|	�qZW|S)NzLABEL=zTYPE=�sysctlz-nzhw.disknamesr)�rcsZ	mscdlabelr�z
label "%s"�iso9660zISO filesystem�vfatz/dev/)r�r�rr6r0r�)r�r�r�r�rmr�r��_typer8�devZ
mscdlabel_outrr1r1r2�find_devs_with_netbsd�s(



r�cCs�tjdddgdgd�}g}xd|jj�jd�D]P}|jd�s<q,|dkrFq,|j|dd�d
�|jd�s,|j|dd�d�q,Wd
d�|D�S)Nr�z-nzhw.disknamesr)r�rCr>zfd0:r�r��cd�icSsg|]}d|�qS)z/dev/r1)r?r�r1r1r2rB�sz*find_devs_with_openbsd.<locals>.<listcomp>r�r�)rr6�rstripr0rwr�r�)r�r�r�r�rmr8r�r	r1r1r2�find_devs_with_openbsd�s

r�cCs�tjdddgdgd�}dd�t|jj�dd	�D�}|d
krJdd�|D�}n(|dkrbdd�|D�}n|rrtjd|�dd�|D�S)Nr�z-nz
kern.disksr)r�cSs(g|] }|jd�r|jd�r|�qS)raZvn)r�)r?r�r1r1r2rB�sz/find_devs_with_dragonflybsd.<locals>.<listcomp>T)rNzTYPE=iso9660cSsg|]}|jd�r|�qS)r��acd)r�r�)r�)r?r�r1r1r2rB�s�LABEL=CONFIG-2�	TYPE=vfatcSsg|]}|jd�s|�qS)r�r�)r�r�)r�)r?r�r1r1r2rB�szUnexpected criteria: %scSsg|]}d|�qS)z/dev/r1)r?r�r1r1r2rB�s)r�r�)rr�r6r0rJry)r�r�r�r�rmr8r�r1r1r2�find_devs_with_dragonflybsd�sr�c
CsJt�rt|||||�St�r,t|||||�St�rBt|||||�St�rXt|||||�Sdg}g}|rt|jd|�|r�|jd|�|r�|j	ddg�|r�|jd|�|r�|j|�||}yt
j
|ddgd	�\}}	Wn:t
jk
�r}
z|
jt
k�rd
}n�WYdd}
~
XnXg}x*|j�D]}|j�}|�r$|j|��q$W|S)z�
    find devices matching given criteria (via blkid)
    criteria can be *one* of:
      TYPE=<filesystem>
      LABEL=<label>
      UUID=<uuid>
    �blkidz-t%sz-s%sz-cz	/dev/nullz-o%srr))r�r�N)r�r�r�r�r�r�r�r�r�r�rrMr�rrFr7)
r�r�r�r�rmZ
blk_id_cmd�options�cmdr8�_errrzr�rOr1r1r2�find_devs_with�sD

r�c	Cs�|dkrg}nt|�}dddg}|r2|jddg�|j|�tj|ddd	�}i}x:|jj�D],}|jd
�\}}}t|�||<|||d<q\W|S)z�Get all device tags details from blkid.

    @param devs: Optional list of device paths you wish to query.
    @param disable_cache: Bool, set True to start with clean cache.

    @return: Dict of key value pairs of info for the device.
    Nr�z-oZfullz-cz	/dev/nullTr�)r4rWr>ZDEVNAME)r�r�rr6rFrGr)	ZdevsZ
disable_cacher�r8�retrOr�rrAr1r1r2r�s

r�cCs,g}x"|D]}||krq
q
|j|�q
W|S)N)r�)Zin_listZout_listr�r1r1r2r�"s
r�cCs�tjd||�tj�}y(t|d��}t|||d�WdQRXWn4tk
rr}z|sV�|jtkrb�WYdd}~XnX|j	�}tjdt
|�|�|r�t|�S|SdS)NzReading from %s (quiet=%s)r�)�chunk_cbzRead %s bytes from %s)rJryr�r�r��pipe_in_outr�r�r�getvaluerIrZ)rPZread_cbr�rWZofhZifhrzrvr1r1r2r�,s
r�cCs�t�r\y td�}|jdd�dd�}Wq�tk
rX}ztjd|�d}WYdd}~Xq�Xn*ytd�j�}Wntk
r�d}YnX|S)	Nz/proc/1/cmdline�r<r�z"failed reading /proc/1/cmdline: %sr�z
/proc/cmdliner�)�is_containerr�r�r�rJrKr7)rvrrzr1r1r2�_get_cmdline?s
r�cCsdtjkrtjdSt�S)NZDEBUG_PROC_CMDLINE)r-rCr�r1r1r1r2r�Rs

r�cCs6d}yt|�j�}|dkSttfk
r0dSXdS)Nz/proc/sys/crypto/fips_enabledr!F)r�r7r�rx)Z	fips_procrvr1r1r2�fips_enabledYsr��cCsRd}x@|j|�}t|�dkr Pq|j|�|t|�7}|r||�qW|j�|S)Nr)r�rIr�r�)Zin_fhZout_fhZ
chunk_sizer�Zbytes_pipedrAr1r1r2r�es

r�cCs6|dkr|dkrdStjd|||�tj|||�dS)Nr�z%Changing the ownership of %s to %s:%sr�)Nr�r�)Nr�)rJryr-�chown)rP�uid�gidr1r1r2�	chownbyidtsr�cCsnd}d}y$|rtj|�j}|r*tj|�j}Wn0tk
r\}ztd|�|�WYdd}~XnXt|||�dS)Nr�zUnknown user or group: %sr�r�)	�pwd�getpwnamZpw_uidr6r7r8r9rxr�)rP�userr�r�r�rzr1r1r2�chownbyname|s r�c
Cszddg}|sd|kr|S|d}||kr4||}nd|kr@|S|d}t|t�rZ||g}t|t�r�t|�dkr||d|d<t|�dkr�|d|d<t|t�r�d|kr�|d|d<d|kr�|d|d<|ddkr�|d|d<ddd	g}x�tt|��D]|}||�sq�||j�}d
}x<|D]4}	|j|	��rd|	|t|	�d�j�f}d}P�qW|�sjdd|j�f}|||<q�W|S)
N�output�allrr�r�z&1z>>r=r@Fz%s %sT)	rUrVr�rIrNr�r�r�r7)
r/r0r�ZoutcfgZmodecfgZswlistr�rQr�sr1r1r2r-�sL






r-cCs�g}|st|t�r|S|jd�}|r2|j|�xvt|d�D]h}|sHq>tjd|�}|sZq>|jd�}|j�}t	|�dkr�|j|�q>ddg|dd�kr>|j|d�q>Wt
t|��S)	z�Return a list of log file paths from the configuration dictionary.

    @param cfg: The cloud-init merged configuration dictionary.
    Zdef_log_fileNz (?P<type>\||>+)\s*(?P<target>.*)r5r��teez-ar))rUrNrr�r-r�r�r�r0rIr�r�)r/ZlogsZdefault_log�fmtr�r5�partsr1r1r2�get_config_logfiles�s&


r�cGsB|r|j|f|��tj�}|dkr(d}|j|f|�d|i�dS)N�exc_info)NNN)rKr�r�ry)r�rqr�r�r1r1r2r��sr�)�routiner_cCs<tj|�}|jt|��|j�}|dk	r4|d|�S|SdS)Nr)�hashlib�new�updater^Z	hexdigest)rXr�Zmlen�hasher�digestr1r1r2�	hash_blob�s
r�)rxr_cs6tj�}x$t�fdd�d�D]}|j|�qW|j�S)z�Hash the content of a binary buffer using SHA1.

    @param f: buffered binary stream to hash.
    @return: digested data as bytes.
    cs�jtj�S)N)r�r��DEFAULT_BUFFER_SIZEr1)rxr1r2�<lambda>
szhash_buffer.<locals>.<lambda>�)r�Zsha1�iterr�r�)rxr��chunkr1)rxr2�hash_buffersr�cCs,ytj|�rdSWntk
r&dSXdS)NTF)r�r�r9)r�r1r1r2�is_users

r�cCs,ytj|�rdSWntk
r&dSXdS)NTF)r6r7r9)r�r1r1r2�is_groups

r�cCstjd||�tj||�dS)NzRenaming %s to %s)rJryr-�rename)�src�destr1r1r2r�sr���cCsx|D]}t||�qWdS)N)�
ensure_dir)Zdirlistr0rfr1r1r2�ensure_dirs%s
r�cCsHtjt|��}t|t|��sDdjdd�|D��}td|t|�f��|S)Nz, cSsg|]}t|��qSr1)rV)r?�tr1r1r2rB-szload_json.<locals>.<listcomp>z((%s) root types expected, got %s instead)�json�loadsrZrUr*rLr`ra)r]Z
root_typesZdecodedZexpected_typesr1r1r2�	load_json*sr�cCs<tjj|�}|tjj|�kr |Stjj|�r0|St|�SdS)z�Get the last directory in a path that does not exist.

    Example: when path=/usr/a/b and /usr/a does not exis but /usr does,
    return /usr/a
    N)r-rm�dirnamere�get_non_exist_parent_dir)rmZp_pathr1r1r2r�5sr�cCs�tjj|�s�t|�}ttjj|�dd��tj|�WdQRXt||�|sP|r�t|||�t	|j
|�ddd��}t	|�}x0|jD]}|j|�}t|||�q�Wn
t||�dS)NT)rnr�)
r-rmrer�rir��makedirs�chmodr�r
r0r�Zjoinpath)rmr0r�r�Znon_existed_parent_dirZsub_relative_dirZsub_pathrfr1r1r2r�Fs

r�ccs(z
|VWd|r"d|g}tj|�XdS)N�umount)r)r�Z
umount_cmdr1r1r2�	unmounter]s

r�c
Csi}y�tjjd�r$td�j�}d}ntjd�}|jj�}d}d}x�|D]�}yV|dkrj|j�\}}}}	}
}n4tj	||�}|j
d�}|j
d�}|j
d�}|j
d�}	Wntk
r�wFYnX|jd	d
�}|||	d�||<qFWt
jd||�Wn$ttfk
�rtt
d
�YnX|S)Nz/proc/mountsrJ�mountz*^(/dev/[\S]+) on (/.*) \((.+), .+, (.+)\)$r�r)r�r�z\040r<)�fstype�
mountpoint�optszFetched %s mounts from %szFailed fetching mount points)r-rmr�r�rFrr6r0r��searchr�r�r�rJryr�rxr�)
�mountedZ
mount_locs�methodr8ZmountreZmpliner�ZmprrZ_freqZ_passno�mr1r1r2�mountsgs8





rcCst|t�r|g}n:t|ttf�r*t|�}n"|dkr8d}ntdjt|�d���t�rb|dkr�dg}nVt�r�|dkrzdddg}x<t	|�D](\}}|dkr�d||<|dkr�d||<q�Wndg}t
�}tj���@}	d}
t
jj|�|kr�|t
jj|�d
}n�d}x�|D]�}d}yNdddg}
|�r&|
jd|g�|
j|�|
j|	�tj|
|d�|	}
|	}PWnJttfk
�r�}z(|�r�tjd||dj|
�|�|}WYdd}~XnX�q�W|�s�td||	|f��|jd��s�|d7}t|
��$|dk�r�||�}n
|||�}|SQRXWdQRXdS)a2
    Mount the device, call method 'callback' passing the directory
    in which it was mounted, then unmount.  Return whatever 'callback'
    returned.  If data != None, also pass data to callback.

    mtype is a filesystem type.  it may be a list, string (a single fsname)
    or a list of fsnames.
    Nz6Unsupported type provided for mtype parameter: {_type})r��auto�ufsZcd9660Zmsdosr�r��msdosfsr�Frrz-oZroz-t)Z
update_envzbFailed to mount device: '%s' with type: '%s' using mount command: '%s', which caused exception: %sr<z#Failed mounting %s to %s due to: %sr*)r�r)rUrVr�r*r`rVrar�r��	enumeraterrZtempdirr-rmrtr�r�rr�rxrJryrLrrwr�)r��callbackrAZmtypeZupdate_env_for_mountZ	log_errorZmtypes�indexrZtmpdr�rZfailure_reasonZmountcmd�excr�r1r1r2�mount_cb�sv










rcCs
tjt�S)N)�obj_copy�deepcopyrr1r1r1r2�get_builtin_cfg�srcCstjd|�tjj|�S)NzTesting if a link exists for %s)rJryr-rm�islink)rmr1r1r2�is_link�srcCshtjd||�|rXtjj|�rXtjjtjj|�dtd��}tj||�tj	||�dStj||�dS)Nz$Creating symbolic link from %r => %rZtmpr�)
rJryr-rmrsrLr�r��symlinkr�)�source�link�forceZtmp_linkr1r1r2�sym_link�srcCsPtjd|�ytj|�Wn0tk
rJ}z|jtkr:|�WYdd}~XnXdS)NzAttempting to remove %s)rJryr-�unlinkrxr�r)rmrzr1r1r2�del_files
rcCstjd||�tj||�dS)NzCopying %s to %s)rJryrX�copy)r�r�r1r1r2rsrcCs2ytjdtj��}Wntk
r,d}YnX|S)Nz%a, %d %b %Y %H:%M:%S %zz??)�timeZstrftimeZgmtimer�)Ztsr1r1r2�time_rfc2822s

rcs�ddl�ddl�d}G�fdd�d�j�}�j�jjd��}�j�}�j|�|_|�}|j	d|�j
|��j
|�dd�dkr�|j|jd	St
d
��dS)z�Use sysctlbyname(3) via ctypes to find kern.boottime

    kern.boottime is of type struct timeval. Here we create a
    private class to easier unpack it.

    @return boottime: float to be compatible with linux
    rN�cs eZdZd�jfd�jfgZdS)zboottime.<locals>.timeval�tv_sec�tv_usecN)r|r}r~Zc_int64Z_fields_r1)�ctypesr1r2�timeval'sr$�cs
kern.boottimer�g��.Az/Unable to retrieve kern.boottime on this systemr�)r#Zctypes.utilZ	StructureZCDLL�utilZfind_libraryZc_size_tZsizeof�valueZsysctlbynameZbyrefr!r"�RuntimeError)Z
NULL_BYTESr$ZlibcrUr�r1)r#r2�boottimes"	r)cCstd}d}yDtjjd�r4d}td�}|rJ|j�d}nd}ttj�t��}Wn"tk
rnt	t
d|�YnX|S)Nz??rz/proc/uptimerr#z&Unable to read uptime using method: %s)r-rmr�r�r0rVrr)r�r�rJ)Z
uptime_strrrvr1r1r2�uptime<sr*cCst||ddd�dS)Nr>)�omoder0)�
write_file)rm�contentr1r1r2�append_fileOsr.�)�
preserve_mode)r0r0r_cCst|dd||d�dS)Nr�r>)r-r+r0r0)r,)rmr0r0r1r1r2�ensure_fileSsr1cCs&yt|�Sttfk
r dSXdS)N)r,rmr`)Zpossible_intr1r1r2�safe_int[sr2c
Cs4t|�}|r0|r0t|��tj||�WdQRXdS)N)r2rir-r�)rmr0Z	real_moder1r1r2r�bs
r�)�grp_namer_cCs:d}ytj|�j}Wn tk
r4tjd|�YnX|S)zt
    Returns the group id of a group name, or -1 if no group exists

    @param grp_name: the name of the group
    r�z"Group %s is not a valid group namer�)r6r7r8r9rJry)r3r�r1r1r2�get_group_idisr4)rmr_cCstjtj|�j�S)z�
    Returns the octal permissions of the file/folder pointed by the path,
    encoded as an int.

    @param path: The full path of the file/folder.
    )rv�S_IMODEr-�st_mode)rmr1r1r2�get_permissionswsr7cCstj|�}tj|j�jS)zw
    Returns the owner of the file/folder pointed by the path.

    @param path: The full path of the file/folder.
    )r-rvr��getpwuid�st_uidZpw_name)rm�str1r1r2�	get_owner�s
r;cCstj|�}tj|j�jS)zw
    Returns the group of the file/folder pointed by the path.

    @param path: The full path of the file/folder.
    )r-rvr6�getgrgid�st_gid�gr_name)rmr:r1r1r2�	get_group�s
r?)�usernamer_cCsNg}x&tj�D]}||jkr|j|j�qWtj|�j}|jtj|�j�|S)zp
    Returns a list of all groups to which the user belongs

    @param username: the user we want to check
    )	r6ZgetgrallZgr_memr�r>r�r�Zpw_gidr<)r@�groupsr�r�r1r1r2�get_user_groups�s
rBr?)�ensure_dir_existsr�r�c!Cs�|r&yt|�}Wntk
r$YnX|r@ttjj|�||d�d|j�krZt|�}d}nt|�}d}yd|}	Wnt	k
r�d|}	YnXt
jd|||	t|�|�t
|d��.t||��}
|
j|�|
j�Wd	QRXWd	QRXt||�d	S)
a)
    Writes a file with the given content and sets the file mode as specified.
    Restores the SELinux context if possible.

    @param filename: The full path of the file to write.
    @param content: The content to write to the file.
    @param mode: The filesystem mode to set on the file.
    @param omode: The open mode used when opening the file (w, wb, a, etc.)
    @param preserve_mode: If True and `filename` exists, preserve `filename`s
                          current mode instead of applying `mode`.
    @param ensure_dir_exists: If True (the default), ensure that the directory
                              containing `filename` exists before writing to
                              the file.
    @param user: The user to set on the file.
    @param group: The group to set on the file.
    )r�r��br[Z
charactersz%oz%rzWriting to %s - %s: [%s] %s %s)rmN)r7rxr�r-rmr�r�r^rZr`rJryrIrir�r�r�r�)r�r-r0r+r0rCr�r�Z
write_typeZmode_rZfhr1r1r2r,�s8
r,cCsDx>tj|�D]0}tjj||�}tjj|�r4t|�qt|�qWdS)z�
    Deletes all contents of a directory without deleting the directory itself.

    @param dirname: The directory whose contents should be deleted.
    N)r-rzrmrLrerYr)r�ZnodeZ
node_fullpathr1r1r2�delete_dir_contents�s

rEr��createdcCs6tj�}t|�}|d|j�|f7}|dt�7}|S)Nz %s by cloud-init v. %sz on %s)rZversion_stringrV�titler)Zcomment_charr^Zci_ver�headerr1r1r2�make_header�s
rIcCs�t|ttf�s tdtj|���d}|r0|d7}dd}d}x�|D]�}t|ttf�r�g}x&|D]}|jdt|�jd|��q^Wd	|d
j	|�f}|d7}qBt|t�r�d	||f}|d7}qB|dkr�qBtdtj|�|f��qBWt
jd
|�|S)Nz8Input to shellify was type '%s'. Expected list or tuple.r�z
#!/bin/sh
z%s%s%s%s�'�\rz'%s'z%s%s
r<r�zCUnable to shellify type '%s'. Expected list, string, tuple. Got: %szShellified %s commands.)rJrKrJrJ)rUr*r�r`rr�r�rVr�rLrJry)ZcmdlistZ
add_headerr-ZescapedZ	cmds_mader�Zfixedrxr1r1r2�shellify�s4




rLcCsB|r|j|�r|t|�d�}|r>|j|�r>|dt|��}|S)N)r�rIrw)rO�prefix�suffixr1r1r2�strip_prefix_suffix"	s
rOcCs@tj|d�dkrdSytj|�Wntjk
r:dSXdS)NrFT)r�whichrM)r�r1r1r2�_cmd_exits_zero*	srQcCstdddg�S)Nzsystemd-detect-virtz--quietz--container)rQr1r1r1r2�_is_container_systemd4	srRcCs
tdg�S)Nzlxc-is-container)rQr1r1r1r2�_is_container_old_lxc8	srScCsDt�s
dSdddg}tj|d�dkr*dStj|�\}}|j�dkS)NFr�z-qnzsecurity.jail.jailedrr!)r�rrPr7)r�r8rr1r1r2�_is_container_freebsd<	s
rTcCs�tttf}x|D]}|�rdSqWy$td�}d|kr8dSd|krDdSWnttfk
r^YnXtjjd�r~tjjd�r~dSyHt	d�j
�}x6|D].}|jd�r�|j�j
d	d�\}}|d
kr�dSq�WWnttfk
r�YnXdS)zH
    Checks to see if this code running in a container of some sort
    Tr�Z	containerZLIBVIRT_LXC_UUIDz/proc/vzz/proc/bcz/proc/self/statuszVxID:r>r%F)rRrTrS�get_proc_envr�rxr-rmrer�rFr�r7r0)Zchecks�helperZpid1env�linesrOZ_keyrQr1r1r2r�F	s4


r�cCstjjd�S)z2Check to see if we are running in a lxd container.z
/dev/lxd/sock)r-rmr�r1r1r1r2�is_lxdt	srXr�cCs�tjjdt|�d�}yt|dd�}Wnttfk
r<iSXi}d
\}}|rbd\}}|j||�}x4|j|�D]&}|sxqn|j|d	�\}	}
|	rn|
||	<qnW|S)aH
    Return the environment in a dict that a given process id was started with.

    @param encoding: if true, then decoding will be done with
                     .decode(encoding, errors) and text will be returned.
                     if false then binary will be returned.
    @param errors:   only used if encoding is true.z/procrCF)rWr �=r��=r�)r rY)r�rZ)	r-rmrLrVr�r�rxrWr0)�pidrY�errorsr�rv�envZnullZequalr+r�rQr1r1r2rUy	s"rUcCsTi}xJ|j�D]>}y|jdd�\}}Wntk
rB|}d}YnX|||<qW|S)NrZr�T)r0rm)Zkvstringr�r+r�rQr1r1r2�keyval_str_to_dict�	s
r^cCs&|jd�r|dd�}tjjd|�S)Nz/dev/rZz/sys/class/block/%s/partition)r�r-rmr�)r�r1r1r2�is_partition�	s
r_cCs�t|t�s|g}g}x�|D]�}t|t�r4|j|�qt|ttf�r�t|�dksZt|�dkrbtd��t|�dkr�|dr�|j|t|��q|j|d�qtd��qW|S)Nr�r)z Invalid package & version tuple.rzInvalid package type.)rUr�rVr�r*rIr()Zversion_fmtZpkgsZpkglist�pkgr1r1r2�expand_package_list�	s 



racCs�dd�|jd�D�}d}d}d}d}�xHt|�D�]:\}	}
|
j�}t|�dkrj|jd|	dt|�|
�dS|d}d	d�|jd�D�}
t|
�t|�kr�q0tt|
�t|��}|
d
|�|d
|�kr�q0|dk	r�t|�t|
�kr�q0y|jd�}	Wn(tk
�r|jd|	d|
�dSXy||	d}||	d
}Wn(tk
�rZ|jd|	d|
�dSX|}|
}|d}q0W|�r�|�r�|�r�|�r�|�r�||||fSn|�r�|�r�|�r�|||fSdS)zRReturn the mount information for PATH given the lines from
    /proc/$$/mountinfo.cSsg|]}|r|�qSr1r1)r?rzr1r1r2rB�	sz$parse_mount_info.<locals>.<listcomp>r*Nrrz$Line %d has two few columns (%d): %sr�r�cSsg|]}|r|�qSr1r1)r?rzr1r1r2rB�	sr�-z,Did not find column named '-' in line %d: %sr)z/Too few columns after '-' column in line %d: %srZ)r0rrIry�minrrm�
IndexError)rmZmountinfo_linesr��get_mnt_opts�
path_elements�devpth�fs_type�match_mount_point�match_mount_point_elementsr�rOr��mount_point�mount_point_elements�x�
mount_optionsr1r1r2�parse_mount_info�	sX


rocCsBx<td�j�D],}|j�dd�\}}}||kr|||fSqWdS)z<On older kernels there's no /proc/$$/mountinfo, so use mtab.z	/etc/mtabNr�)r�rFr0)rmrOrgrkrhr1r1r2�
parse_mtab
s
rpcCs�|jd�}t|�dkr|dSt|�dkr2|dS|ddkr�|d	d�}tjd
ddg�\}}x<|jd
�D].}|j�}t|�dkrj|d|krj|d}PqjWt|�Stjd|�dS)Nr*r�rr�r)r��gptr
rZZglabel�statusz-sr�z)Unexpected input in find_freebsd_part: %s)r�rqr
)r0rIrrVrJrK)ZfsZsplittedZtarget_labelrfr�Zlabelsr�r1r1r2�find_freebsd_part
s
rscCsJd}x@|jd�D]2}|j�}t|�dkrtjj|d|�r|}PqW|S)Nr�r)r�)r0rIr-rmr�)rm�mnt_list�
path_foundrOr�r1r1r2�get_path_dev_freebsd/
s rvcCsltjdd|gddgd�\}}t|�rPtjddg�\}}t||�}|dkrLdS|}|j�}t|d�}d|S)Nrz-prr�)r�z/dev/)rrIrvr0rs)rmr�rSrtrur�Z
label_partr1r1r2�get_freebsd_devpth9
s
rwcCs�tjjd�stjd�dSytjdd|g�\}}Wn0tjk
rb}ztjd||�dSd}~XnXt|�rpdSd}xL|j	d�D]>}t
j||�r�||kr�d|kr�|j	�d	}tjd
||�|Sq�WdS)Nz/dev/zfsz"Cannot get zpool info, no /dev/zfs�zpoolrrz$Unable to get zpool status of %s: %sz.*(ONLINE).*r��staterzfound zpool "%s" on disk %s)r-rmr�rJryrrMrKrIr0r�r)rxZzpoolstatusrSr�rOZdiskr1r1r2�get_device_info_from_zpoolG
s 
rzcCs�tjdg�\}}d}dd�|jd�D�}d}d}d}d}	�x8|j�D�]*}
tj||
�}|s\qD|jd�}|jd�}d	d�|jd�D�}t|�t|�kr�qDtt|�t|��}
|d
|
�|d
|
�kr�qD|	dk	r�t|	�t|�kr�qD|}|}	|jd�}|jd�}|dk	�r"d
j|jd�j	d
�j	�jd��}t
jd||||�tjd|�}|�rbt��rb|dk�rbt
|�}|}||krDPqDW|�s�||k�r�dS|�r�|�r�|�r�|�r�|�r�||||fSn|�r�|�r�|�r�|||fSdS)z�Return the mount information for PATH given the lines ``mount(1)``
    This function is compatible with ``util.parse_mount_info()``rze^(?P<devpth>[\S]+?) on (?P<mountpoint>[\S]+?) (\(|type )(?P<type>[^,\(\) ]+)( \()?(?P<options>.*?)\)$cSsg|]}|r|�qSr1r1)r?rzr1r1r2rBh
szparse_mount.<locals>.<listcomp>r*NrgrcSsg|]}|r|�qSr1r1)r?rzr1r1r2rBs
srrar�rCz, zNfound line in mount -> devpth: %s, mount_point: %s, fs_type: %s, options: '%s'z^(/dev/.+)[sp]([0-9])$�zfs�nfs)r{r|)rr0rFr�rr�rIrcrLr7rJryr�rw)rmreZmountoutputr�ZregexrfrgrkrirjrOrrlrmrhrnZdevmZmatch_devpthr1r1r2�parse_mount[
sb






r}cCsTdtj�}tjj|�r2t|�j�}t||||�Stjjd�rFt|�St||�SdS)Nz/proc/%s/mountinfoz	/etc/mtab)	r-�getpidrmr�r�rFrorpr})rmr�reZmountinfo_pathrWr1r1r2�get_mount_info�
sr)�optr_cCs t|dd��^}}||jd�kS)NT)rerC)rr0)rmr�rZmnt_optsr1r1r2�
has_mount_opt�
sr��T.)r�r_c$Cs�|dkrg}|dkri}tj�}d}|rLytt��}Wntk
rJYnXz|||�}Wdtj�|}	d}
|dk	r�ytt��|}
Wntk
r�YnXd|	}|r�t|
t�r�|d|
7}n|d7}y|||�Wntk
r�YnXX|S)Nz took %0.3f secondsz (%0.2f)z (N/A))r�floatr*rmrUr�)r�rqr�r�r�Z
get_uptime�startZustartr�ZdeltaZudeltaZtmsgr1r1r2r��
s<
r�cCs(|jdd�}t|�dkr|S|dfSdS)Nr(r�)�rsplitrI)Zdottedr�r1r1r2�expand_dotted_devnamesr�cCs�|dkrg}|dkrg}g}i}xp||D]d}yt|||ddd�||<Wq*tk
r�}z$|jtkrj�||kr||j|�WYdd}~Xq*Xq*Wt|�r�tdjdj|�d���|S)NF)r�rWzMissing required files: {files}rC)�files)	r�r�r�rr�rIrmrVrL)r^ZrequiredZoptionalZdelimrRr�rxrzr1r1r2�pathprefix2dicts$
 r��
/proc/meminfoc	
Cs�dd
ddd�}ddd	d
�}i}x�t|�j�D]v}y|j�\}}}Wn$tk
rf|j�\}}d}YnX|r�t|�||||<q,||kr,t|�|||||<q,W|S)Nr)rr�r��)ZkBZmB�BZgBZtotalZfreeZ	available)z	MemTotal:zMemFree:z
MemAvailable:r�iii@)r�rFr0rmr,)	Zmeminfo�raw�mpliersZkmapr�rOr�r'Zunitr1r1r2�read_meminfo2s 
r�cCs�|}|jd�r|dd�}n|jd�r2|dd�}dddddd
�}|}d}x,|D]$}|j|�rP|}|dt|��}qPWyt|�}Wn0tk
r�}ztd|�|�WYdd}~XnX|dkr�td
|��t|||�S)a}Convert human string or integer to size in bytes

    In the original implementation, SI prefixes parse to IEC values
    (1KB=1024B). Later, support for parsing IEC prefixes was added,
    also parsing to IEC values (1KiB=1024B). To maintain backwards
    compatibility for the long-used implementation, no fix is provided for SI
    prefixes (to make 1KB=1000B may now violate user expectations).

    Future prospective callers of this function should consider implementing a
    new function with more standard expectations (1KB=1000B and 1KiB=1024B)

    Examples:
    10M => 10485760
    10MB => 10485760
    10MiB => 10485760
    ZiBNr)r�r�rrr�r��()r��K�M�Gr�rz'%s' is not valid input.z'%s': cannot be negative���r�iii@l)rwrIr�rmr,)rUZsize_inr�ZnumZmplierrrzr1r1r2�human2bytesJs&



 r�cCs<|dkrtj�d}|dkp6|ddko6|dd�dk}|S)z$Return True if platform is x86-basedNr�Zx86_64rr�r)Z86)r-r.)Z
uname_archZx86_arch_matchr1r1r2�is_x86us
r�cCs,tjdd�dkr"tjtj|��Stj|�S)Nr)�)r)r�)r��version_info�emailZmessage_from_filer��StringIO�message_from_string)r�r1r1r2r�sr�cCs~tjddg|dd�}t�}x^|jj�D]P}y|jdd�\}}}Wntk
rVw&YnX|jd
�r&|jtj	dd	|��q&W|S)Nz
dpkg-queryz--listT)r5r4r)�hi�iiz:.*r�)r�r�)
rr�r6rFr0rmr�r�r��sub)r5r8Z	pkgs_instrOryr`rr1r1r2�get_installed_packages�s
r�cCs�d}y,tt|dd��}|jdd�j�dkr.dSWn0tk
r`}ztjd||�WYdd}~XnXt�}d|krtdStd	dd�}d|j�kr�dStj	j
d
�r�dSdS)Nz/etc/os-releaseT)r�r�r�zubuntu-corez!Unexpected error loading '%s': %sz
snap_core=z/etc/system-image/channel.iniz/etc/system-image/config.d/F)rr�rr�rmrJrKr�r-rmre)ZorpathZorinforzrr-r1r1r2�system_is_snappy�s  r�cCs�d}x(|j�D]}|jd�r|dd�}PqW|dkr:dS|jd�rH|S|jd�rfd|td�d�S|jd�r�d|td�d�j�S|jd�r�d	|td�d�j�}tjj|�r�|St|�}|r�|d
S|Sd|S)Nzroot=rZz/dev/zLABEL=z/dev/disk/by-label/zUUID=z/dev/disk/by-uuid/z	PARTUUID=z/dev/disk/by-partuuid/r)r0r�rIr�r-rmr�r�)rrr+Z
disks_path�resultsr1r1r2�rootdev_from_cmdline�s,




r�cCsJdd�}i}x8||�D],}|jdd�\}}|s2|}|s:|r|||<qW|S)z�Given shell like syntax (key=value
key2=value2
) in content
    return the data in dictionary form.  If 'add_empty' is True
    then add entries in to the returned dictionary for 'VAR='
    variables.  Set their value to empty_val.cSstj|dd�S)NT)Zcomments)�shlexr0)rXr1r1r2�_shlex_split�sz(load_shell_content.<locals>._shlex_splitrZr�)r0)r-Z	add_emptyZ	empty_valr�rArOr�r'r1r1r2r�sr��?cCs�t|�}d}xr|tdd�|D��8}t|�dkrDtjd|||�gS|dkr\tjd|||�|||krjPtj|�||7}qWtjd|||�|S)NrcSsg|]}tjj|�r|�qSr1)r-rmr�)r?rxr1r1r2rB�sz"wait_for_files.<locals>.<listcomp>z)%sAll files appeared after %s seconds: %sz6%sWaiting up to %s seconds for the following files: %sz*%sStill missing files after %s seconds: %s)r�rIrJryrZsleep)�flistZmaxwaitZnaplenZlog_preZneedZwaitedr1r1r2�wait_for_files�s0
r�cCs&t|dd�}|djd�}|ddkS)z1Check whether the given mount point is mounted rwT)rer�rCrZrwr�)rr0)rkr�Z
mount_optsr1r1r2�mount_is_read_write�sr�cCsXtjd�sdSddg}|r:tjj|�r*dS|jd|g�|rN|jd|g�tj|�S)zAInvoke udevadm settle with optional exists and timeout parametersZudevadmNZsettlez--exit-if-exists=%sz--timeout=%s)rrPr-rmr�r�)r�r`Z
settle_cmdr1r1r2�udevadm_settles
r�cCs�d}yJtd|dd�}|rLtjdt|��}|r>t|jd��}ntjd||�Wn0tk
r~}ztjd||�WYd	d	}~XnX|S)
zH
    Return the parent pid of a process by parsing /proc/$pid/stat.
    rz
/proc/%s/statT)r�z ^\d+ \(.+\) [RSDZTtWXxKPI] (\d+)r�z6Unable to match parent pid of process pid=%s input: %sz Failed to load /proc/%s/stat. %sN)	r�r�rrVr,r�rJrKr�)r[�ppidrvrrzr1r1r2�get_proc_ppid_linuxs
 r�cCs&tjdddt|�g�\}}t|j��S)z;
    Return the parent pid of a process by checking ps
    Zpsz-oppid=z-p)rrVr,r7)r[r�rr1r1r2�get_proc_ppid_ps.sr�cCst�rt|�St|�SdS)z-
    Return the parent pid of a process.
    N)r�r�r�)r[r1r1r2�
get_proc_ppid6sr�r��	Error:
{}cCs&t|j|�tjd�|r"tj|�|S)a
    Print error to stderr and return or exit

    @param msg: message to print
    @param rc: return code (default: 1)
    @param fmt: format string for putting message in (default: 'Error:
 {}')
    @param sys_exit: exit when called (default: false)
    )�file)�printrVr�r��exit)rqZrcr�Zsys_exitr1r1r2r�@s	
r�cs^eZdZd�fdd�	Zeed�dd��Zdd�Zd	d
�Zdd�Z	d
d�Z
ed�dd�Z�Z
S)�Versionr�cstt|�j|||||�S)zPDefault of -1 allows us to tiebreak in favor of the most specific
        number)�superr��__new__)�cls�major�minor�patch�rev)�	__class__r1r2r�QszVersion.__new__)rcCs|ttt|jd����S)Nr()r�r+r,r0)r�rr1r1r2�from_strVszVersion.from_strcCsd|j|�kS)Nr�)�_compare_version)ro�otherr1r1r2�__gt__ZszVersion.__gt__cCs0|j|jko.|j|jko.|j|jko.|j|jkS)N)r�r�r�r�)ror�r1r1r2�__eq__]szVersion.__eq__ccs8x2|j|j|j|jfD]}|dkr.t|�VqPqWdS)z)Iterate over the version (drop sentinels)r�Nr�)r�r�r�r�rV)ro�nr1r1r2�__iter__eszVersion.__iter__cCs
dj|�S)Nr()rL)ror1r1r2�__str__mszVersion.__str__)r_cCsP||krdS|j|jkrdS|j|jkr,dS|j|jkr<dS|j|jkrLdSdS)z�
        return values:
            1: self > v2
            -1: self < v2
            0: self == v2

        to break a tie between 3.1.N and 3.1, always treat the more
        specific number as larger
        rr�r�)r�r�r�r�)ror�r1r1r2r�ps
zVersion._compare_versionr�r�r�r�)r�r�r�r�)r|r}r~r��classmethodrVr�r�r�r�r�r,r��
__classcell__r1r1)r�r2r�Osr�r�r�r�r�)�
extra_message�schedule�
return_log)�
deprecated�deprecated_versionr�r�r�c
Cs�ttd�st�t_|pd}t|||t|��}tj|�}t|j||j	�}|�d|�d|�d|��j
�}	|rt|	S|tjkr�tjj|�ttd�r�tj
|	�n
tj|	�dS)a�Mark a "thing" as deprecated. Deduplicated deprecations are
    logged.

    @param deprecated: Noun to be deprecated. Write this as the start
        of a sentence, with no period. Version and extra message will
        be appended.
    @param deprecated_version: The version in which the thing was
        deprecated
    @param extra_message: A remedy for the user's problem. A good
        message will be actionable and specific (i.e., don't use a
        generic "Use updated key." if the user used a deprecated key).
        End the string with a period.
    @param schedule: Manually set the deprecation schedule. Defaults to
        5 years. Leave a comment explaining your reason for deviation if
        setting this value.
    @param return_log: Return log text rather than logging it. Useful for
        running prior to logging setup.

    Note: uses keyword-only arguments to improve legibility
    �_logr�z is deprecated in z  and scheduled to be removed in z. r�N)rn�	deprecater�r��hashrVr�r�r�r�r�r�rJr�rK)
r�r�r�r�r��messageZdeduprZversion_removedZ
deprecate_msgr1r1r2r��s



r�)r�)r�r�r�cs���fdd�}|S)a~Mark a "thing" as deprecated. Deduplicated deprecations are
    logged.

    @param deprecated_version: The version in which the thing was
        deprecated
    @param extra_message: A remedy for the user's problem. A good
        message will be actionable and specific (i.e., don't use a
        generic "Use updated key." if the user used a deprecated key).
        End the string with a period.
    @param schedule: Manually set the deprecation schedule. Defaults to
        5 years. Leave a comment explaining your reason for deviation if
        setting this value.

    Note: uses keyword-only arguments to improve legibility
    cs tj������fdd��}|S)Ncs �||�}t��j��d�|S)N)r�r�r�r�)r�r|)r�r�r8)r�r�r�r�r1r2�	decorator�s
z2deprecate_call.<locals>.wrapper.<locals>.decorator)�	functools�wraps)r�r�)r�r�r�)r�r2�wrapper�szdeprecate_call.<locals>.wrapperr1)r�r�r�r�r1)r�r�r�r2�deprecate_call�sr�)r r!r"r#)r$r%r&r')N)N)rT)rT)N)N)N)r�N)N)TT)F)N)r)N)N)N)NN)F)r�r�rZ)N)r�r�rZrrr)N)N)F)r�)Nr�NFN)Nr�NFN)Nr�NFN)Nr�NFN)Nr�NFN)NF)NFT)r�N)NN)NN)N)r�)NNN)NNNT)F)r/)r/r?F)r�rF)T)NN)rTr�)F)NNF)r�F)N)N)FN)r�r�)NN)r�r�F)�rbr�rrr�r�r�r6r�r�r�r�r�r-Zos.pathr�r�r�r�r�rXr�rvr�rDr�r�base64r�collectionsrrrr�rrrr	Zpathlibr
Ztypingrrr
rrrrrZurllibrZ	cloudinitrrrrrrrrrrZcloudinit.settingsrr�Z	getLoggerr|rJ�sepr�r�r�r�r�r�r3r9r=rZr^r[rdrhrir�rr�r�r�r�r�r�r�r�r�r�r�r�r�rVrNr�r��DEBUGr�r�r�r�r�r�r�r�r�r�r�r
r'r�r)r,r3r.rO�contextmanagerrQr5rWrYrdrjr�r[r|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r-r�r�r��BufferedIOBaser�r�r�r�r�r�r�r�r�rrrrrrrr)r*r.r,r1r2r�r4r7r;r?rBr,rErIrLrOrQrRrSrTr�rXrUr^r_rarorprsrvrwrzr}rr�r�r�r�rmr�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r1r1r1r2�<module>s�(
0

.
2
&		(>8P8
		
!(+,#+(3
?
:
+X	#


4%

.N	
W'
'+

 ;(,

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
apport.cpython-36.opt-1.pyc File 5.92 KB 0644
apport.cpython-36.pyc File 5.96 KB 0644
atomic_helper.cpython-36.opt-1.pyc File 2.05 KB 0644
atomic_helper.cpython-36.pyc File 2.05 KB 0644
cloud.cpython-36.opt-1.pyc File 3.08 KB 0644
cloud.cpython-36.pyc File 3.08 KB 0644
dmi.cpython-36.opt-1.pyc File 5.32 KB 0644
dmi.cpython-36.pyc File 5.32 KB 0644
event.cpython-36.opt-1.pyc File 1.97 KB 0644
event.cpython-36.pyc File 1.97 KB 0644
features.cpython-36.opt-1.pyc File 1.47 KB 0644
features.cpython-36.pyc File 1.47 KB 0644
gpg.cpython-36.opt-1.pyc File 3.76 KB 0644
gpg.cpython-36.pyc File 3.76 KB 0644
helpers.cpython-36.opt-1.pyc File 13.31 KB 0644
helpers.cpython-36.pyc File 13.31 KB 0644
importer.cpython-36.opt-1.pyc File 1.68 KB 0644
importer.cpython-36.pyc File 1.68 KB 0644
log.cpython-36.opt-1.pyc File 4.61 KB 0644
log.cpython-36.pyc File 4.61 KB 0644
netinfo.cpython-36.opt-1.pyc File 12.67 KB 0644
netinfo.cpython-36.pyc File 12.67 KB 0644
persistence.cpython-36.opt-1.pyc File 2.82 KB 0644
persistence.cpython-36.pyc File 2.82 KB 0644
registry.cpython-36.opt-1.pyc File 1.38 KB 0644
registry.cpython-36.pyc File 1.38 KB 0644
safeyaml.cpython-36.opt-1.pyc File 8 KB 0644
safeyaml.cpython-36.pyc File 8 KB 0644
settings.cpython-36.opt-1.pyc File 1.14 KB 0644
settings.cpython-36.pyc File 1.14 KB 0644
signal_handler.cpython-36.opt-1.pyc File 1.58 KB 0644
signal_handler.cpython-36.pyc File 1.58 KB 0644
simpletable.cpython-36.opt-1.pyc File 2.53 KB 0644
simpletable.cpython-36.pyc File 2.53 KB 0644
ssh_util.cpython-36.opt-1.pyc File 15.36 KB 0644
ssh_util.cpython-36.pyc File 15.36 KB 0644
stages.cpython-36.opt-1.pyc File 25.15 KB 0644
stages.cpython-36.pyc File 25.15 KB 0644
subp.cpython-36.opt-1.pyc File 9.97 KB 0644
subp.cpython-36.pyc File 9.97 KB 0644
temp_utils.cpython-36.opt-1.pyc File 2.81 KB 0644
temp_utils.cpython-36.pyc File 2.81 KB 0644
templater.cpython-36.opt-1.pyc File 4.55 KB 0644
templater.cpython-36.pyc File 4.55 KB 0644
type_utils.cpython-36.opt-1.pyc File 437 B 0644
type_utils.cpython-36.pyc File 437 B 0644
url_helper.cpython-36.opt-1.pyc File 21.03 KB 0644
url_helper.cpython-36.pyc File 21.03 KB 0644
user_data.cpython-36.opt-1.pyc File 8.25 KB 0644
user_data.cpython-36.pyc File 8.25 KB 0644
util.cpython-36.opt-1.pyc File 73.64 KB 0644
util.cpython-36.pyc File 73.64 KB 0644
version.cpython-36.opt-1.pyc File 429 B 0644
version.cpython-36.pyc File 429 B 0644
warnings.cpython-36.opt-1.pyc File 3.25 KB 0644
warnings.cpython-36.pyc File 3.25 KB 0644