name : cc_landscape.cpython-39.pyc
a

'�Dg;�@s�UdZddlZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZdd	lmZd
Zddd
ddd�iZddgedgd�Zeed<e�e�Zee
eedd�dd�Zdd�ZdS)z&install and configure landscape client�N)�chain)�	ConfigObj)�subp�
type_utils�util)�Cloud)�Config)�
MetaSchema)�PER_INSTANCEz/etc/landscape/client.conf�client�infoz.https://landscape.canonical.com/message-systemz#http://landscape.canonical.com/pingz/var/lib/landscape/client)Z	log_level�urlZping_urlZ	data_pathZcc_landscapeZubuntu�	landscape)�idZdistrosZ	frequencyZactivate_by_schema_keys�meta)�name�cfg�cloud�args�returnc	
Cs�|�di�}t|t�s,tdjt�|�d���|s4dS|j�dg�t	t
|g}ttdd�t
t|�d���D���}z*tjgd	�d
gd�t�dd
g|�Wn\tjy�}zB|jdkr�t�d�n d|��}t�t|�t|�|�WYd}~n
d}~00dS)z�
    Basically turn a top level 'landscape' entry with a 'client' dict
    and render it to ConfigObj format under '[client]' section in
    /etc/landscape/client.conf
    rzR'landscape' key existed in config, but not a dictionary type, is a {_type} instead)Z_typeNzlandscape-clientcSs&g|]\}}d|�dd���|g�qS)z--�_�-)�replace)�.0�k�v�r�A/usr/lib/python3.9/site-packages/cloudinit/config/cc_landscape.py�
<listcomp>Is�zhandle.<locals>.<listcomp>r)�landscape-config�--silentz--is-registered�)Zrcsrr rz&Client already registered to LandscapezFailure registering client:
)�get�
isinstance�dict�RuntimeError�formatrZobj_nameZdistroZinstall_packages�LSC_BUILTIN_CFG�LSC_CLIENT_CFG_FILE�listr�sorted�merge_together�itemsrZProcessExecutionErrorZ	exit_code�LOGZwarningrZlogexc)	rrrrZls_cloudcfgZ
merge_dataZ
cmd_params�e�msgrrr�handle,s@
�������


r0cCs@ti�}|D].}|sqt|t�r,|�|�q|�t|��q|S)zu
    merge together ConfigObj objects or things that ConfigObj() will take in
    later entries override earlier
    )rr#�merge)Zobjsr�objrrrr+]s
r+)�__doc__Zlogging�	itertoolsrZ	configobjrZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemar	Zcloudinit.settingsr
r(r'r�__annotations__Z	getLogger�__name__r-�strr)r0r+rrrr�<module>	s0��
�
1

© 2025 Cubjrnet7