f9 DUdZddlZddlmZddlmZddlmZddlm Z m Z m Z ddl m Z ddlmZdd lmZmZdd lmZd Zd Zd dddddiZdZdgZdddeeedededgedgdZeed<eeZej8eZdeded e d!e d"df d#Z!d$Z"y)%z&install and configure landscape clientN)chain)dedent) ConfigObj)subp type_utilsutil)Cloud)Config) MetaSchema get_meta_doc) PER_INSTANCEz/etc/landscape/client.confz/etc/default/landscape-clientclientinfoz.https://landscape.canonical.com/message-systemz#http://landscape.canonical.com/pingz/var/lib/landscape/client) log_levelurlping_url data_pathaThis 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 # Minimum viable config requires account_name and computer_title landscape: client: computer_title: kiosk 1 account_name: Joe's Biz aW # To install landscape-client from a PPA, specify apt.sources apt: sources: trunk-testing-ppa: source: ppa:landscape/self-hosted-beta landscape: client: account_name: myaccount computer_title: himom landscape)idnametitle descriptiondistrosexamples frequencyactivate_by_schema_keysmetarcfgcloudargsreturnc (|jdi}t|ts.tdj t j ||sy|jjdgtt|g}tttt|djDcgc]\}}d|j!dd |gc}}}t#j"d d g|zt%j&t(d ycc}}w) 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)_typeNzlandscape-clientrz--_-zlandscape-configz--silentzRUN=1 )get isinstancedict RuntimeErrorformatrobj_namedistroinstall_packagesLSC_BUILTIN_CFGLSC_CLIENT_CFG_FILElistrsortedmerge_togetheritemsreplacerr write_fileLS_DEFAULT_FILE) rr!r"r# ls_cloudcfg merge_datakv cmd_paramss ?/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.pyhandler@us ''+r*K kD * $$*F ))+6%+%   LL!!#5"67 J  #":.x8>>@AqaiiS)*+Q/  J II!:.;<OOOY/s/!Dcti}|D]A}|st|tr|j|(|jt|C|S)zu merge together ConfigObj objects or things that ConfigObj() will take in later entries override earlier )rr*merge)objsr!objs r?r5r5sN B-C&  c9 % IIcN IIin % & J)#__doc__logging itertoolsrtextwrapr configobjr cloudinitrrrcloudinit.cloudr cloudinit.configr cloudinit.config.schemar r cloudinit.settingsr r2r9r1MODULE_DESCRIPTIONrr __annotations__ getLogger__name__LOGstrr3r@r5rEr?rWs -,,!#<+21 ?90 0 *   5%  "      7(R +}a1j1f t g!&0&06&0%&0t&0&0R rE