'KXc@smddlZddlZddlmZddlmZddlmZeZdZdZ dZ dS(iN(thelpers(tutil(t PER_ALWAYSc Cs |jjd|jjdf}d}x|D]}| s1tjj| rWq1nxtj|D]}tjj||}tjj|rgtjj |\}}t j |}||krtjj|||} t j || |d7}qqgqgWq1W|S(Ntsemii(tpathst get_ipatht get_cpathtostpathtexiststlistdirtjointisfiletsplitextRtcanon_sem_nametshutiltmove( tcloudRt am_adjustedtsem_pathtpt full_pathtnametextt canon_nametnew_path((sI/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pyt_migrate_canon_semss$  c Csiddgd6}|jjd|jjdf}xW|D]O}| s>tjj| rdq>ntj|}x|jD] \}}|tj |g}g} x]tj |D]L} tjj | \} } | |krtjj | r| j | qqWx| D]w} tjtjj|| tjj | \} }x:|D]2}|jd| ||j||WdQXqOWqWqWq>WdS(Ns apt-configurespackage-update-upgrade-installsapt-update-upgradeRs*Migrating %s => %s with the same frequency(RRRRRR RtFileSemaphorestitemsRR R R tappendRtdel_fileR tdebugtlock(Rtlogt legacy_adjustRRt sem_helpertmod_namet migrate_tot possiblest old_existsRRt_extt_nametfreqtm((sI/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pyt_migrate_legacy_sems0s. $     cCsetj|dt}tj|s8|jd|dSt|}|jd|t||dS(Ntmigrates,Skipping module named %s, migration disableds8Migrated %s semaphore files to there canonicalized names(Rtget_cfg_option_strtTruettranslate_boolRRR,(RtcfgRR!t_argst do_migratet sems_moved((sI/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pythandleMs  ( RRt cloudinitRRtcloudinit.settingsRt frequencyRR,R5(((sI/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pyts