Viewing File: /usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyo

ó
oBú]c@sÁddlZddlZddlZddlmZmZmZddlmZddlm	Z
ddlmZddlmZe
j
eƒZdZdZd	Zd
ZeegZdgZdZd
Zi
dd6dd6dd6dd6dd6dd6dd6dd6dd6dd 6Zeeejƒƒd!d"„ƒZejejƒd#efd$„ƒYƒZ d%„Z!d&„Z"d'„Z#d(„Z$d)„Z%d*„Z&d+„Z'd,„Z(ed-„Z)dd.„Z+dS(/iÿÿÿÿN(t
PER_ALWAYStPER_INSTANCEtFREQUENCIES(timporter(tlog(t
type_utils(tutilstext/x-not-multipartsapplication/octet-streamt__end__t	__begin__stext/part-handlerspart-handler-%03ds	part-%03dstext/x-include-urls#includestext/x-include-once-urls
#include-oncestext/x-shellscripts#!stext/cloud-configs
#cloud-configstext/upstart-jobs#upstart-jobs
#part-handlerstext/cloud-boothooks#cloud-boothookstext/cloud-config-archives#cloud-config-archivestext/cloud-config-jsonps#cloud-config-jsonpstext/jinja2s## template: jinjatkeycCsdt|ƒS(Ni(tlen(te((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyt<lambda><stHandlercBs8eZdd„Zd„Zd„Zejd„ƒZRS(icCs||_||_dS(N(thandler_versiont	frequency(tselfRtversion((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyt__init__Bs	cCsdtj|ƒ|jƒfS(Ns%s: [%s](Rtobj_namet
list_types(R((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyt__repr__FscCsFt|dƒstdƒ‚n$gt|dƒD]}t|^q.SdS(Ntprefixess#Missing prefixes subclass attribute(thasattrtNotImplementedErrortgetattrtINCLUSION_TYPES_MAP(Rtprefix((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyRIscOs
tƒ‚dS(N(R(Rtargstkwargs((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pythandle_partQs(t__name__t
__module__RRRtabctabstractmethodR(((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyR
?s		c	
CsV|j}|tkp*|tko*|tks1dSy|j}t|ƒ}Wn tttfk
rld}nX|d}y¨tj	d|||||ƒ|dkrÁ|j
||||||ƒn]|dkré|j
|||||ƒn5|dkr|j
||||ƒntd|ƒ‚Wn0tk
rQtj
td|||||ƒnXdS(NisContent-Types1Calling handler %s (%s, %s, %s) with frequency %siisUnknown module version %ss8Failed calling handler %s (%s, %s, %s) with frequency %s(RRRRtintt	TypeErrort
ValueErrortAttributeErrortLOGtdebugRt	ExceptionRtlogexc(	tmodtdatatfilenametpayloadRtheaderstmod_freqtmod_vertcontent_type((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pytrun_partVs4		

	

cCs*itd6}t||dd||ƒdS(NsContent-Type(t
CONTENT_STARTR3tNone(R+R,RR/((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyt
call_beginxs
cCs*itd6}t||dd||ƒdS(NsContent-Type(tCONTENT_ENDR3R5(R+R,RR/((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pytcall_end€s
c
Csð|d}t|}|d}tjj|dd|ƒ}|jdƒsWd|}ntj||dƒ|d}yNttj	|ƒƒ}	t
|	|d	|ƒ|j|	d
tƒ|d|d<Wn't
k
rëtjtd||ƒnXdS(
NthandlercountRt
handlerdirs%ss.pys%s.pyi€thandlersR,tinitializedis7Failed at registering python file: %s (part handler %s)(tPART_HANDLER_FN_TMPLtostpathtjointendswithRt
write_filet
fixup_handlerRt
import_moduleR6tregistertTrueR)R*R'(
tpdatat_ctypet	_filenameR.tcurcounttmodnameRtmodfnameR;R+((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pytwalker_handle_handlerˆs 





cCsyxt|tjƒr.|jddƒd}n*|d| jddƒjddƒd}t|ƒ|krw|| }nWntk
r˜|d|!}nX|S(Ns
iiiterrorstignore(t
isinstancetsixtstring_typestsplittdecodeR
tUnicodeDecodeError(tblobtsizetstart((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyt_extract_first_or_bytesžs*
cCsdy|jdƒSWnLttfk
rOy|jdƒSWq`tk
rKq`Xntk
r_nX|S(Nt
string_escapetunicode_escape(tencodetLookupErrorR$R&(ttext((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyt_escape_string°s

cCs|d}||jdƒkr3tjd|ƒdS|tkrVt||||ƒdS|d}||kr”t|||d|||d|ƒnm|rñt|dƒ}dt|ƒ}|tkrÛtj	d	||ƒqtj	d
||ƒntjd|ƒdS(NsContent-Typetexcludedscontent_type "%s" is excludedR;R,Ris'%s...'s)Unhandled non-multipart (%s) userdata: %ss0Unhandled unknown content-type (%s) userdata: %ssEmpty payload of type %s(
tgetR'R(tPART_CONTENT_TYPESRMR3RYR_tNOT_MULTIPART_TYPEtwarning(R,R-R.R/R2R;RXtdetails((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pytwalker_callbackÂs(

	
	
c	CsÈd}x»|jƒD]­}|jƒdkr1qn|jƒ}|dkrRt}n|jƒ}|sqt|}nt|ƒ}tj	|ƒ||d<t
j|ƒ}|||||ƒ|d}qWdS(Nit	multipartsContent-Typei(twalktget_content_maintypetget_content_typeR5t
OCTET_TYPEtget_filenametPART_FN_TPLtdictR'R(Rtfully_decoded_payload(	tmsgtcallbackR,tpartnumtparttctypeR-R/R.((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyRhßs 	


cCsyt|dƒs"t|ddƒnt|dƒsDt|d|ƒn1|j}|ru|tkrutjd||ƒn|S(NRiRs&Handler %s has an unknown frequency %s(RtsetattrRRR'Rd(R+tdef_freqtfreq((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyRCös	cCsfytj|ƒjƒ}Wntk
r-|SX|jƒ}x%tD]}|j|ƒrAt|SqAW|S(N(Rt
decode_binarytlowerRUtlstriptINCLUSION_SRCHt
startswithR(R.tdefaultt
payload_lcR^((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyttype_from_starts_withs

(,R!R>RQtcloudinit.settingsRRRt	cloudinitRRtloggingRRt	getLoggerRR'RcRkR7R4tCONTENT_SIGNALSRbR=RmRtsortedtlisttkeysR{t
add_metaclasstABCMetatobjectR
R3R6R8RMRYR_RfRhRCR5R(((s?/usr/lib/python2.7/site-packages/cloudinit/handlers/__init__.pyt<module>sR	
	"							
Back to Directory File Manager