OS : Linux
PHP Version : 7.4.33
Software : Apache/2.4.6 (CentOS) PHP/7.4.33
Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Disable Function : ó
oBú]c @ ss d Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z e Z d „ Z d „ Z
d „ Z d S( s%
Migrator
--------
**Summary:** migrate old versions of cloud-init data to new
This module handles moving old versions of cloud-init data to newer ones.
Currently, it only handles renaming cloud-init's per-frequency semaphore files
to canonicalized name and renaming legacy semaphore names to newer ones. This
module is enabled by default, but can be disabled by specifying ``migrate:
false`` in config.
**Internal name:** ``cc_migrator``
**Module frequency:** per always
**Supported distros:** all
**Config keys**::
migrate:
iÿÿÿÿN( t helpers( t util( t
PER_ALWAYSc
C s | j j d ƒ | j j d ƒ f } d } xÛ | D]Ó } | s1 t j j | ƒ rW q1 n xª t j | ƒ D]™ } t j j | | ƒ } t j j | ƒ rg t j j | ƒ \ } } t
j | ƒ } | | k r t j j | | | ƒ } t j
| | ƒ | d 7} q qg qg Wq1 W| S( Nt semi i ( t pathst get_ipatht get_cpatht ost patht existst listdirt joint isfilet splitextR t canon_sem_namet shutilt move(
t cloudR t am_adjustedt sem_patht pt full_patht namet extt
canon_namet new_path( ( s@ /usr/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pyt _migrate_canon_sems( s $
c
C s• i d d g d 6} | j j d ƒ | j j d ƒ f } xW| D]O} | s> t j j | ƒ rd q> n t j | ƒ } x| j ƒ D] \ } } | t j | ƒ g } g } x] t j
| ƒ D]L }
t j j |
ƒ \ } } | | k r· t j j |
ƒ r· | j
|
ƒ q· q· Wx | D]w }
t j t j j | |
ƒ ƒ t j j |
ƒ \ }
} x: | D]2 } | j d |
| ƒ | j | | ƒ Wd QXqOWqWq€ Wq> Wd S( Ns
apt-configures package-update-upgrade-installs apt-update-upgradeR s* Migrating %s => %s with the same frequency( R R R R R R R t FileSemaphorest itemsR R
R
R t appendR t del_fileR t debugt lock( R t logt
legacy_adjustR R t
sem_helpert mod_namet
migrate_tot possiblest
old_existsR R t _extt _namet freqt m( ( s@ /usr/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pyt _migrate_legacy_sems: s.
$
c C se t j | d t ƒ } t j | ƒ s8 | j d | ƒ d St | ƒ } | j d | ƒ t | | ƒ d S( Nt migrates, Skipping module named %s, migration disableds8 Migrated %s semaphore files to there canonicalized names( R t get_cfg_option_strt Truet translate_boolR R R, ( R t cfgR R! t _argst
do_migratet
sems_moved( ( s@ /usr/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pyt handleW s ( t __doc__R R t cloudinitR R t cloudinit.settingsR t frequencyR R, R5 ( ( ( s@ /usr/lib/python2.7/site-packages/cloudinit/config/cc_migrator.pyt s