| Server IP : 23.254.227.96 / Your IP : 216.73.216.21 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 : |
3
��b� � @ s| d Z ddlZddlmZ ddlmZ ddlmZmZm Z ddl
mZ eZdZ
dZd gZd
ddd
dd�iZdd� Zdd� ZdS )a*
Landscape
---------
**Summary:** install and configure landscape client
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 ``/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
**Internal name:** ``cc_landscape``
**Module frequency:** per instance
**Supported distros:** ubuntu
**Config keys**::
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"
� N)�BytesIO)� ConfigObj)�subp�
type_utils�util)�PER_INSTANCEz/etc/landscape/client.confz/etc/default/landscape-clientZubuntuZclient�infoz.https://landscape.canonical.com/message-systemz#http://landscape.canonical.com/pingz/var/lib/landscape/client)Z log_levelZurlZping_urlZ data_pathc C s� |j di �}t|t�s,tdjtj|�d���|s4dS |jjd
� t t
|g}t|�}t� }|j
|� tjtjjt
�� tjt
|j� � |jdt
� tjtd� tjddd g� 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
Z landscapezR'landscape' key existed in config, but not a dictionary type, is a {_type} instead)Z_typeN�landscape-clientz!Wrote landscape config file to %szRUN=1
ZserviceZrestart)r )�get�
isinstance�dict�RuntimeError�formatr Zobj_nameZdistroZinstall_packages�LSC_BUILTIN_CFG�LSC_CLIENT_CFG_FILE�merge_togetherr �writer Z
ensure_dir�os�path�dirnameZ
write_file�getvalue�debug�LS_DEFAULT_FILEr ) �_name�cfgZcloud�logZ_argsZls_cloudcfgZ
merge_dataZmerged�contents� r �"/usr/lib/python3.6/cc_landscape.py�handleT s&