
    x[ho              
           U d Z ddlZddlZddlZddlmZ ddlmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ d	Zd
ZdZddgedgdZeed<    ej,                  e      ZeeefdZdedede
deddf
dZy)z5Mcollective: Install, configure and start mcollective    N)	ConfigObj)subputil)Cloud)Config)
MetaSchema)PER_INSTANCEz&/etc/mcollective/ssl/server-public.pemz'/etc/mcollective/ssl/server-private.pemz/etc/mcollective/server.cfgcc_mcollectiveallmcollective)iddistros	frequencyactivate_by_schema_keysmetac                    	 t        j                  |d      }t        t        j                  |            }| j                         D ]  \  }}|dk(  r#t        j                  ||d       ||d<   d|d	<   .|d
k(  r#t        j                  ||d       ||d<   d|d	<   Vt        |t              r|||<   lt        |t              r4||j                  vri ||<   |j                         D ]  \  }	}
|
||   |	<    t        |      ||<    	 t        j                   |d|z         t        j                         }|j#                  |       t        j                  ||j%                         d       y # t
        $ rI}|j                  t        j                  k7  r t        j                  d|       t               }Y d }~d }~ww xY w# t
        $ r)}|j                  t        j                  k(  rn Y d }~d }~ww xY w)NF)quietz4Did not find file %s (starting with an empty config)zpublic-certi  )modezplugin.ssl_server_publicsslsecurityproviderzprivate-certi  zplugin.ssl_server_privatez%s.old)r   load_binary_filer   ioBytesIOIOErrorerrnoENOENTLOGdebugitems
write_file
isinstancestrdictsectionscopywritegetvalue)config
server_cfgpubcert_filepricert_fileold_contentsmcollective_configecfg_namecfgovcontentss               A/usr/lib/python3/dist-packages/cloudinit/config/cc_mcollective.py	configurer5   (   s   -,,ZuE&rzz,'?@   8#}$OOL#E:=I9:5:12'OOL#E:>J:;5:12#s#/2"8,C$( #5#>#>>35&x0IIK 8DAq67&x038 033x"8,-80	 			*h*56 zz|HX&OOJ 1 1 3%@_  -77ell"IIF "+-J  77ell" s/   5E- G -	F?6>F::F?	G4G//G4namer0   cloudargsreturnc                     d|vrt         j                  d|        y |d   }|j                  j                  dg       d|v rt	        |d          t        j
                  g dd       y )Nr   z?Skipping module named %s, no 'mcollective' key in configurationconf)r(   )servicer   restartF)capture)r   r   distroinstall_packagesr5   r   )r6   r0   r7   r8   mcollective_cfgs        r4   handlerB   e   si    C		M	
 	-(O 
LL!!=/2  01 	II3UC    )__doc__r   r   logging	configobjr   	cloudinitr   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.settingsr	   PUBCERT_FILEPRICERT_FILE
SERVER_CFGr   __annotations__	getLogger__name__r   r5   r"   listrB    rC   r4   <module>rT      s    <  	      ! # . +78*
 w -	j  g!
 	:AzD D6 D% Dt D DrC   