HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_landscape.cpython-310.pyc
o

�Adp�@sUdZddlZddlmZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlmZdd	lmZdd
lmZmZddlmZdZd
Zdddddd�iZdZdgZdddeeed�ed�gedgd�Zeed<ee�Zdeded ed!ed"ed#dfd$d%�Z d&d'�Z!dS)(z&install and configure landscape client�N)�BytesIO)�Logger)�dedent)�	ConfigObj)�subp�
type_utils�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�PER_INSTANCEz/etc/landscape/client.confz/etc/default/landscape-client�client�infoz.https://landscape.canonical.com/message-systemz#http://landscape.canonical.com/pingz/var/lib/landscape/client)�	log_level�url�ping_url�	data_patha�This module installs and configures ``landscape-client``. The landscape client
will only be installed if the key ``landscape`` is present in config. Landscape
client configuration is given under the ``client`` key under the main
``landscape`` config key. The config parameters are not interpreted by
cloud-init, but rather are converted into a ConfigObj formatted file and
written out to the `[client]` section in ``/etc/landscape/client.conf``.

The following default client config is provided, but can be overridden::

    landscape:
        client:
            log_level: "info"
            url: "https://landscape.canonical.com/message-system"
            ping_url: "http://landscape.canoncial.com/ping"
            data_path: "/var/lib/landscape/client"

.. note::
    see landscape documentation for client config keys

.. note::
    if ``tags`` is defined, its contents should be a string delimited with
    ``,`` rather than a list
�ubuntu�cc_landscape�	Landscapez&Install and configure landscape clienta�            # To discover additional supported client keys, run
            # man landscape-config.
            landscape:
                client:
                    url: "https://landscape.canonical.com/message-system"
                    ping_url: "http://landscape.canonical.com/ping"
                    data_path: "/var/lib/landscape/client"
                    http_proxy: "http://my.proxy.com/foobar"
                    https_proxy: "https://my.proxy.com/foobar"
                    tags: "server,cloud"
                    computer_title: "footitle"
                    registration_key: "fookey"
                    account_name: "fooaccount"
            z�            # Any keys below `client` are optional and the default values will
            # be used.
            landscape:
                client: {}
            �	landscape)�id�name�title�description�distros�examples�	frequency�activate_by_schema_keys�metar�cfg�cloud�log�args�returnc	Cs�|�di�}t|t�stdjt�|�d���|sdS|j�d�t	t
|g}t|�}t�}|�
|�t�tj�t
��t�t
|���|�dt
�t�td�t�gd��dS)	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)�_typeN)�landscape-clientz!Wrote landscape config file to %szRUN=1
)�servicer'�restart)�get�
isinstance�dict�RuntimeError�formatr�obj_name�distro�install_packages�LSC_BUILTIN_CFG�LSC_CLIENT_CFG_FILE�merge_togetherr�writer�
ensure_dir�os�path�dirname�
write_file�getvalue�debug�LS_DEFAULT_FILEr)	rr!r"r#r$�ls_cloudcfg�
merge_data�merged�contents�rB�?/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py�handlegs.	
���
rDcCs@ti�}|D]}|sqt|t�r|�|�q|�t|��q|S)zu
    merge together ConfigObj objects or things that ConfigObj() will take in
    later entries override earlier
    )rr+�merge)�objsr!�objrBrBrCr4�s
r4)"�__doc__r7�ior�loggingr�textwrapr�	configobjr�	cloudinitrrr�cloudinit.cloudr	�cloudinit.configr
�cloudinit.config.schemarr�cloudinit.settingsr
r3r=r2�MODULE_DESCRIPTIONrr �__annotations__�str�listrDr4rBrBrBrC�<module>sh��	����%�����
�)