ó oBú]c@s¼dZddlZddlmZddlmZddlmZddlmZddl m Z e Z dZ d Z d gZiid d 6d d6dd6dd6d6Zd„Zd„ZdS(s* 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" iÿÿÿÿN(tBytesIO(t ConfigObj(t type_utils(tutil(t PER_INSTANCEs/etc/landscape/client.confs/etc/default/landscape-clienttubuntutinfot log_levels.https://landscape.canonical.com/message-systemturls#http://landscape.canonical.com/pingtping_urls/var/lib/landscape/clientt data_pathtclientc Csù|jdiƒ}t|tƒsEtdjdtj|ƒƒƒ‚n|sOdS|jjd ƒt t |g}t |ƒ}t ƒ}|j |ƒtjtjjt ƒƒtjt |jƒƒ|jdt ƒtjtdƒtjddd gƒdS( s¬ 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 t landscapesR'landscape' key existed in config, but not a dictionary type, is a {_type} insteadt_typeNslandscape-clients!Wrote landscape config file to %ssRUN=1 tservicetrestart(slandscape-client(tgett isinstancetdictt RuntimeErrortformatRtobj_nametdistrotinstall_packagestLSC_BUILTIN_CFGtLSC_CLIENT_CFG_FILEtmerge_togetherRtwriteRt ensure_dirtostpathtdirnamet write_filetgetvaluetdebugtLS_DEFAULT_FILEtsubp( t_nametcfgtcloudtlogt_argst ls_cloudcfgt merge_datatmergedtcontents((sA/usr/lib/python2.7/site-packages/cloudinit/config/cc_landscape.pythandleWs&     cCs_tiƒ}xL|D]D}|s%qnt|tƒrD|j|ƒq|jt|ƒƒqW|S(su merge together ConfigObj objects or things that ConfigObj() will take in later entries override earlier (RRtmerge(tobjsR&tobj((sA/usr/lib/python2.7/site-packages/cloudinit/config/cc_landscape.pyR{s  (t__doc__RtsixRt configobjRt cloudinitRRtcloudinit.settingsRt frequencyRR#tdistrosRR.R(((sA/usr/lib/python2.7/site-packages/cloudinit/config/cc_landscape.pyt8s$   $