Current Dir: /snap/core22/2437/usr/lib/python3/dist-packages/cloudinit/config/__pycache__/

[FILE] cc_ansible.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_apk_configure.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_apt_configure.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_apt_pipelining.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_bootcmd.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_byobu.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ca_certs.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_chef.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_disable_ec2_metadata.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_disk_setup.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_fan.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_final_message.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_growpart.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_grub_dpkg.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_install_hotplug.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_keyboard.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_keys_to_console.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_landscape.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_locale.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_lxd.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_mcollective.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_mounts.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ntp.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_package_update_upgrade_install.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_phone_home.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_power_state_change.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_puppet.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_raspberry_pi.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_reset_rmc.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_resizefs.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_resolv_conf.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_rh_subscription.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_rsyslog.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_runcmd.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_salt_minion.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_per_boot.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_per_instance.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_per_once.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_user.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_scripts_vendor.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_seed_random.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_set_hostname.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_set_passwords.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_snap.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_spacewalk.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ssh.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ssh_authkey_fingerprints.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ssh_import_id.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_timezone.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ubuntu_autoinstall.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ubuntu_drivers.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_ubuntu_pro.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_update_etc_hosts.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_update_hostname.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_users_groups.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_wireguard.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_write_files.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_write_files_deferred.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_yum_add_repo.cpython-310.pyc [ edit | delete | rename ]
[FILE] cc_zypper_add_repo.cpython-310.pyc [ edit | delete | rename ]
[FILE] modules.cpython-310.pyc [ edit | delete | rename ]
[FILE] schema.cpython-310.pyc [ edit | delete | rename ]
[FILE] __init__.cpython-310.pyc [ edit | delete | rename ]

Viewing: /snap/core22/2437/usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_raspberry_pi.cpython-310.pyc

o

�t�h��
@sUddlZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZe�
e�ZdZd	Zd
Zddd
dd�ZdZdZddgeegd�Ze
ed<deddfdd�Zdefdd�Zdeeefdededdfdd �Zd!ededdfd"d#�Zd$ededed%eddf
d&d'�Z dS)(�N)�Union)�subp)�Cloud)�Config)�
MetaSchema)�PER_INSTANCE�rpi�
interfaces�enable_rpi_connect�do_spi�do_i2c�	do_serial�
do_onewire)�spi�i2c�serial�onewire�do_serial_cons�do_serial_hw�cc_raspberry_pizraspberry-pi-os)�id�distros�	frequency�activate_by_schema_keys�meta�enable�returnc
Csht�d|�|r
dnd}z
t�ddt|�g�WdStjy3}z
t�d|�WYd}~dSd}~ww)NzConfiguring rpi-connect: %sr��/usr/bin/raspi-config�do_rpi_connectz#Failed to configure rpi-connect: %s)�LOG�debugr�str�ProcessExecutionError�error)r�num�e�r'�B/usr/lib/python3/dist-packages/cloudinit/config/cc_raspberry_pi.py�configure_rpi_connect%s��r)cCs,z
t�gd��WdStjyYdSw)N)r�nonint�	is_pifiveTF)rr#r'r'r'r(r+0s�r+�cfg�instCfg�cloudc
Cs$ddtdtfdd�}d}d}t|t�r||d�}||d�}nt|t�r%|}t�s,|r,d}zKt�d	d
tt|r7dnd�g�zt�d	d
tt|rGdnd�g�Wntjyf}zt	�
d
|�WYd}~nd}~ww|jjdddd�}t�|�WdStjy�}z
t	�
d|�WYd}~dSd}~ww)NF�cfg_dict�namecSs.|�||�}t|t�st�dt||�|S|S)Nz"Invalid value for %s.serial.%s: %s)�get�
isinstance�boolr �warning�RPI_INTERFACES_KEY)r/r0�default�valr'r'r(�get_bool_field;s
�z2configure_serial_interface.<locals>.get_bool_field�console�hardwareTrr*rrz'Failed to configure serial hardware: %s�reboot�nowz)Rebooting to apply serial console changes)�mode�delay�messagez&Failed to configure serial console: %s)F)
�dictr"r2r3r+r�RASPI_CONFIG_SERIAL_CONS_FN�RASPI_CONFIG_SERIAL_HW_FNr#r r$�distro�shutdown_command)r,r-r.r8�enable_console�	enable_hwr&�cmdr'r'r(�configure_serial_interface8sP



��	�������rH�ifacec
Cs�|t��vr
|dksJd|����zt�ddt|t|rdnd�g�WdStjy@}zt�d||�WYd}~dSd}~ww)NrzUnsupported interface: rr*rrzFailed to configure %s: %s)�SUPPORTED_INTERFACES�keysrr"r#r r$)rIrr&r'r'r(�configure_interfacezs��
���rLr0�argscCs�t|vrdSt|tt�st�dt|t�dS|ts$t�dt�dS|tD]�}|tkrF|t|}t|t�r>t|�nt�dt|�q(|t	kr�t|t|t�sat�dt|t|�dS|t|spt�d|�dSt
|t|���}d|vr�|�|�
|�d���|D]F}|t��vr�t�dt	|�q�|t||}|dkr�t|ttf�s�t�dt	||�nt|||�q�t|t�r�t||�q�t�dt	||�q�q(t�d|�q(dS)NzInvalid value for %s: %szEmpty value for %s. Skipping...rzInvalid key for %s: %szInvalid value for %s.%s: %szUnsupported key: %s)�RPI_BASE_KEYr2r@r r4r!�ENABLE_RPI_CONNECT_KEYr3r)r5�listrK�append�pop�indexrJrHrL)r0r,r.rM�keyr�subkeys�subkeyr'r'r(�handle�s��

�
���
���rW)!�logging�typingr�	cloudinitr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar�cloudinit.settingsr�	getLogger�__name__r rNr5rOrJrArBr�__annotations__r3r)r+r@rHr"rLrPrWr'r'r'r(�<module>sH

��
���
�B"
Upload File: