oB]c@ssddlZddlZddlZddlZddlZdZejeZede dZ edZ dS(iNitwbcCs|rBy%tj|}tj|j}WqBtk r>qBXnd}ytjdtjj |dt d|}t j d||j ||t||j||jtj|j |tj|j |Wn8tk r}|dk r tj|j n|nXdS(NtdirtdeletetmodesOAtomically writing to file %s (via temporary file %s) - %s: [%o] %d bytes/chars(toststattS_IMODEtst_modetOSErrortNonettempfiletNamedTemporaryFiletpathtdirnametFalsetLOGtdebugtnametlentwritetclosetchmodtrenamet Exceptiontunlink(tfilenametcontentRtomodet copy_modet file_statttfte((s;/usr/lib/python2.7/site-packages/cloudinit/atomic_helper.pyt write_file s*    cCs2t|tj|dddtdddd|S(Ntindentit sort_keyss RtwR(R tjsontdumpstTrue(RtdataR((s;/usr/lib/python2.7/site-packages/cloudinit/atomic_helper.pyt write_json*s"( R$tloggingRRR t _DEF_PERMSt getLoggert__name__RRR R((((s;/usr/lib/python2.7/site-packages/cloudinit/atomic_helper.pyts