ó oBú]c@s‡dZddlmZddlmZddlZdgZejeƒZ dZ d„Z d„Z d „Z d „Zd d d „ZdS(sæ LXD --- **Summary:** configure lxd with ``lxd init`` and optionally lxd-bridge This module configures lxd with user specified options using ``lxd init``. If lxd is not present on the system but lxd configuration is provided, then lxd will be installed. If the selected storage backend is zfs, then zfs will be installed if missing. If network bridge configuration is provided, then lxd-bridge will be configured accordingly. **Internal name:** ``cc_lxd`` **Module frequency:** per instance **Supported distros:** ubuntu **Config keys**:: lxd: init: network_address: network_port: storage_backend: storage_create_device: storage_create_loop: storage_pool: trust_password: bridge: mode: name: ipv4_address: ipv4_netmask: ipv4_dhcp_first: ipv4_dhcp_last: ipv4_dhcp_leases: ipv4_nat: ipv6_address: ipv6_netmask: ipv6_nat: domain: iÿÿÿÿ(tlog(tutilNtubuntutlxdbr0c CsÔ|jdƒ}|s)|jd|ƒdSt|tƒsR|jdt|ƒƒdS|jdƒ}t|tƒs|jdt|ƒƒi}n|jdiƒ}t|tƒsÏ|jdt|ƒƒi}ng}tjdƒsô|jdƒn|jdƒd kr)tjd ƒ r)|jd ƒnt |ƒryy|j j |ƒWqytj k ru} |jd || ƒdSXn|r d*} tj dddgƒdddg} xP| D]H} |j| ƒr±| jd| jddƒt|| ƒfgƒq±q±Wtj | ƒnd} |r·|jdtƒ}tjjdƒrtj| ƒrt|ƒ}yd|jd| ƒdjg|jƒD]\} }d| |f^qƒd}tj dg|ƒWn%tk rãtj|d| ƒnXtjdƒ|jdƒtj d dd!gƒqÐt|ƒ\}}td"|d#t|ƒd$t|ƒd%t|ƒƒ|r‡|jd&d'j|ƒƒt|ƒn|rÐ|jd(d'j|ƒƒt|ƒqÐn|rÐtd)| ƒ‚ndS(+Ntlxds8Skipping module named %s, not present or disabled by cfgs-lxd config must be a dictionary. found a '%s'tinits2lxd/init config must be a dictionary. found a '%s'tbridges4lxd/bridge config must be a dictionary. found a '%s'tstorage_backendtzfsszfsutils-linuxs!failed to install packages %s: %stnetwork_addresst network_porttstorage_create_devicetstorage_create_loopt storage_poolttrust_passwordt waitreadys --timeout=300s--autos--%s=%st_t-sdebconf-communicatetnames/etc/default/lxd-bridgesSetting lxd debconf via s s set %s %ssFailed to run '%s' for lxd withs Running dpkg-reconfigure for lxdsdpkg-reconfigures--frontend=noninteractivetnet_nametdid_inittcreatetattachsCreating lxd bridge: %st s!Setting up default lxd bridge: %ss*Unable to configure lxd bridge without %s.(R R RR R R R( tgettdebugt isinstancetdicttwarningttypeRtwhichtappendtlentdistrotinstall_packagestProcessExecutionErrortsubptextendtreplacetstrt_DEFAULT_NETWORK_NAMEtostpathtexiststbridge_to_debconftjointitemst Exceptiontlogexctdel_filet bridge_to_cmdtmaybe_cleanup_defaulttboolt_lxct RuntimeError(RtcfgtcloudRtargstlxd_cfgtinit_cfgt bridge_cfgtpackagestexct init_keystcmdtkt dconf_commRtdebconftvtdatat cmd_createt cmd_attach((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_lxd.pythandle=s”         %   .  3          cCsãi}|jdƒdkr2d|d0s   f 2 2