404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@13.59.58.185: ~ $
3

\�me0�
@s�UdZddlZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZddl
mZmZddlmZdd	lmZd
gZeZeje�Zddd
ed�eed�ed�ed�ed�gedgd�Zeee�ZdZdd�Zdd�Zeee
edd�dd�ZdS)z<Snap: Install, configure and manage snapd and snap packages.�N)�dedent)�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�PER_INSTANCE)�prepend_base_commandZubuntuZcc_snapZSnapz5Install, configure and manage snapd and snap packagesah        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.
        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>
    ay        # 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
    �snap)�id�name�title�description�distrosZexamples�	frequencyZactivate_by_schema_keyscCs�|sdStjd�t|t�r&|j�}nt|t�s@tdj|d���td|g}dj	|�}x&|D]}tjd|j
d�dd	��qZWtj||j
d
��tj|dd�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})�
assertionsZack�
zSnap acking: %sr�zutf-8T)Zcapture)�LOG�debug�
isinstance�dict�values�list�	TypeError�format�SNAP_CMD�join�splitrZ
write_file�encoder)rZassertions_fileZsnap_cmdZcombinedZasrt�r!�/usr/lib/python3.6/cc_snap.py�add_assertionsws







r#cCs�|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})�commandsr)�shellZ	status_cbz.Failures running snap commands:
{cmd_failures})�cmd_failures)rrrr�sorted�itemsrrrr
�strr�sys�stderr�writeZProcessExecutionError�appendrZlogexc�RuntimeError)r(Zfixed_snap_commandsr*Zcommandr)�e�msgr!r!r"�run_commands�s,	






$r5)r
�cfg�cloud�args�returncCsV|jdi�}|s tjd|�dSt|jdg�tjj|jj�d��t	|jdg��dS)Nrz8Skipping module named %s, no 'snap' key in configurationrzsnapd.assertionsr()
�getrrr#�os�pathr�pathsZ
get_ipath_curr5)r
r6r7r8Zcfginr!r!r"�handle�s
r>) �__doc__Zloggingr;r.�textwraprZ	cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrZcloudinit.settingsr	Zcloudinit.subpr
rrZ	getLogger�__name__r�metarr#r5r-rr>r!r!r!r"�<module>sD
	'

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 128 B 0644
__init__.cpython-36.pyc File 128 B 0644
cc_ansible.cpython-36.opt-1.pyc File 8.63 KB 0644
cc_ansible.cpython-36.pyc File 8.63 KB 0644
cc_apk_configure.cpython-36.opt-1.pyc File 4.51 KB 0644
cc_apk_configure.cpython-36.pyc File 4.51 KB 0644
cc_apt_configure.cpython-36.opt-1.pyc File 30.42 KB 0644
cc_apt_configure.cpython-36.pyc File 30.42 KB 0644
cc_apt_pipelining.cpython-36.opt-1.pyc File 2.44 KB 0644
cc_apt_pipelining.cpython-36.pyc File 2.44 KB 0644
cc_bootcmd.cpython-36.opt-1.pyc File 2.51 KB 0644
cc_bootcmd.cpython-36.pyc File 2.51 KB 0644
cc_byobu.cpython-36.opt-1.pyc File 3.04 KB 0644
cc_byobu.cpython-36.pyc File 3.04 KB 0644
cc_ca_certs.cpython-36.opt-1.pyc File 7.05 KB 0644
cc_ca_certs.cpython-36.pyc File 7.05 KB 0644
cc_chef.cpython-36.opt-1.pyc File 9.13 KB 0644
cc_chef.cpython-36.pyc File 9.13 KB 0644
cc_disable_ec2_metadata.cpython-36.opt-1.pyc File 1.72 KB 0644
cc_disable_ec2_metadata.cpython-36.pyc File 1.72 KB 0644
cc_disk_setup.cpython-36.opt-1.pyc File 23.1 KB 0644
cc_disk_setup.cpython-36.pyc File 23.1 KB 0644
cc_fan.cpython-36.opt-1.pyc File 2.74 KB 0644
cc_fan.cpython-36.pyc File 2.74 KB 0644
cc_final_message.cpython-36.opt-1.pyc File 3.07 KB 0644
cc_final_message.cpython-36.pyc File 3.07 KB 0644
cc_growpart.cpython-36.opt-1.pyc File 15.91 KB 0644
cc_growpart.cpython-36.pyc File 15.91 KB 0644
cc_grub_dpkg.cpython-36.opt-1.pyc File 4.92 KB 0644
cc_grub_dpkg.cpython-36.pyc File 4.92 KB 0644
cc_install_hotplug.cpython-36.opt-1.pyc File 3.25 KB 0644
cc_install_hotplug.cpython-36.pyc File 3.25 KB 0644
cc_keyboard.cpython-36.opt-1.pyc File 1.98 KB 0644
cc_keyboard.cpython-36.pyc File 1.98 KB 0644
cc_keys_to_console.cpython-36.opt-1.pyc File 3.11 KB 0644
cc_keys_to_console.cpython-36.pyc File 3.11 KB 0644
cc_landscape.cpython-36.opt-1.pyc File 4.71 KB 0644
cc_landscape.cpython-36.pyc File 4.71 KB 0644
cc_locale.cpython-36.opt-1.pyc File 1.58 KB 0644
cc_locale.cpython-36.pyc File 1.58 KB 0644
cc_lxd.cpython-36.opt-1.pyc File 13.04 KB 0644
cc_lxd.cpython-36.pyc File 13.04 KB 0644
cc_mcollective.cpython-36.opt-1.pyc File 4.24 KB 0644
cc_mcollective.cpython-36.pyc File 4.24 KB 0644
cc_migrator.cpython-36.opt-1.pyc File 2.92 KB 0644
cc_migrator.cpython-36.pyc File 2.92 KB 0644
cc_mounts.cpython-36.opt-1.pyc File 14.08 KB 0644
cc_mounts.cpython-36.pyc File 14.08 KB 0644
cc_ntp.cpython-36.opt-1.pyc File 13.15 KB 0644
cc_ntp.cpython-36.pyc File 13.15 KB 0644
cc_package_update_upgrade_install.cpython-36.opt-1.pyc File 3.78 KB 0644
cc_package_update_upgrade_install.cpython-36.pyc File 3.78 KB 0644
cc_phone_home.cpython-36.opt-1.pyc File 4.1 KB 0644
cc_phone_home.cpython-36.pyc File 4.1 KB 0644
cc_power_state_change.cpython-36.opt-1.pyc File 6.24 KB 0644
cc_power_state_change.cpython-36.pyc File 6.24 KB 0644
cc_puppet.cpython-36.opt-1.pyc File 9.46 KB 0644
cc_puppet.cpython-36.pyc File 9.46 KB 0644
cc_reset_rmc.cpython-36.opt-1.pyc File 3.59 KB 0644
cc_reset_rmc.cpython-36.pyc File 3.59 KB 0644
cc_resizefs.cpython-36.opt-1.pyc File 7.02 KB 0644
cc_resizefs.cpython-36.pyc File 7.02 KB 0644
cc_resolv_conf.cpython-36.opt-1.pyc File 4.27 KB 0644
cc_resolv_conf.cpython-36.pyc File 4.27 KB 0644
cc_rh_subscription.cpython-36.opt-1.pyc File 12.06 KB 0644
cc_rh_subscription.cpython-36.pyc File 12.06 KB 0644
cc_rightscale_userdata.cpython-36.opt-1.pyc File 2.77 KB 0644
cc_rightscale_userdata.cpython-36.pyc File 2.77 KB 0644
cc_rsyslog.cpython-36.opt-1.pyc File 10.34 KB 0644
cc_rsyslog.cpython-36.pyc File 10.34 KB 0644
cc_runcmd.cpython-36.opt-1.pyc File 2.43 KB 0644
cc_runcmd.cpython-36.pyc File 2.43 KB 0644
cc_salt_minion.cpython-36.opt-1.pyc File 4.36 KB 0644
cc_salt_minion.cpython-36.pyc File 4.36 KB 0644
cc_scripts_per_boot.cpython-36.opt-1.pyc File 1.4 KB 0644
cc_scripts_per_boot.cpython-36.pyc File 1.4 KB 0644
cc_scripts_per_instance.cpython-36.opt-1.pyc File 1.57 KB 0644
cc_scripts_per_instance.cpython-36.pyc File 1.57 KB 0644
cc_scripts_per_once.cpython-36.opt-1.pyc File 1.51 KB 0644
cc_scripts_per_once.cpython-36.pyc File 1.51 KB 0644
cc_scripts_user.cpython-36.opt-1.pyc File 1.58 KB 0644
cc_scripts_user.cpython-36.pyc File 1.58 KB 0644
cc_scripts_vendor.cpython-36.opt-1.pyc File 2.04 KB 0644
cc_scripts_vendor.cpython-36.pyc File 2.04 KB 0644
cc_seed_random.cpython-36.opt-1.pyc File 4.07 KB 0644
cc_seed_random.cpython-36.pyc File 4.07 KB 0644
cc_set_hostname.cpython-36.opt-1.pyc File 4 KB 0644
cc_set_hostname.cpython-36.pyc File 4 KB 0644
cc_set_passwords.cpython-36.opt-1.pyc File 8.4 KB 0644
cc_set_passwords.cpython-36.pyc File 8.4 KB 0644
cc_snap.cpython-36.opt-1.pyc File 5.94 KB 0644
cc_snap.cpython-36.pyc File 5.94 KB 0644
cc_spacewalk.cpython-36.opt-1.pyc File 2.87 KB 0644
cc_spacewalk.cpython-36.pyc File 2.87 KB 0644
cc_ssh.cpython-36.opt-1.pyc File 11.02 KB 0644
cc_ssh.cpython-36.pyc File 11.02 KB 0644
cc_ssh_authkey_fingerprints.cpython-36.opt-1.pyc File 3.54 KB 0644
cc_ssh_authkey_fingerprints.cpython-36.pyc File 3.54 KB 0644
cc_ssh_import_id.cpython-36.opt-1.pyc File 3.85 KB 0644
cc_ssh_import_id.cpython-36.pyc File 3.85 KB 0644
cc_timezone.cpython-36.opt-1.pyc File 1.24 KB 0644
cc_timezone.cpython-36.pyc File 1.24 KB 0644
cc_ubuntu_advantage.cpython-36.opt-1.pyc File 12.42 KB 0644
cc_ubuntu_advantage.cpython-36.pyc File 12.42 KB 0644
cc_ubuntu_autoinstall.cpython-36.opt-1.pyc File 3.89 KB 0644
cc_ubuntu_autoinstall.cpython-36.pyc File 3.89 KB 0644
cc_ubuntu_drivers.cpython-36.opt-1.pyc File 3.63 KB 0644
cc_ubuntu_drivers.cpython-36.pyc File 3.63 KB 0644
cc_update_etc_hosts.cpython-36.opt-1.pyc File 4.3 KB 0644
cc_update_etc_hosts.cpython-36.pyc File 4.3 KB 0644
cc_update_hostname.cpython-36.opt-1.pyc File 3.01 KB 0644
cc_update_hostname.cpython-36.pyc File 3.01 KB 0644
cc_users_groups.cpython-36.opt-1.pyc File 7.58 KB 0644
cc_users_groups.cpython-36.pyc File 7.58 KB 0644
cc_wireguard.cpython-36.opt-1.pyc File 8.39 KB 0644
cc_wireguard.cpython-36.pyc File 8.39 KB 0644
cc_write_files.cpython-36.opt-1.pyc File 5.61 KB 0644
cc_write_files.cpython-36.pyc File 5.61 KB 0644
cc_write_files_deferred.cpython-36.opt-1.pyc File 1.73 KB 0644
cc_write_files_deferred.cpython-36.pyc File 1.73 KB 0644
cc_yum_add_repo.cpython-36.opt-1.pyc File 6.03 KB 0644
cc_yum_add_repo.cpython-36.pyc File 6.03 KB 0644
cc_zypper_add_repo.cpython-36.opt-1.pyc File 5.66 KB 0644
cc_zypper_add_repo.cpython-36.pyc File 5.66 KB 0644
modules.cpython-36.opt-1.pyc File 7.31 KB 0644
modules.cpython-36.pyc File 7.31 KB 0644
schema.cpython-36.opt-1.pyc File 39.45 KB 0644
schema.cpython-36.pyc File 39.45 KB 0644