Ñò i'dWc@smddkZddkZddklZddklZddkiZdei fd„ƒYZ d„Z dS(iÿÿÿÿN(tDataObjectDict(t InstallEnginet TransferFilescBs5eZdZd„Zd„Zd„Zed„ZRS(sè The TransferFiles checkpoint transfers files that are related to an installation that the application wants to preserve Files to be transferred are stored in a DataObjectDict in the volatile section of the Data Object Cache. Each element of the dictionary is a source, destination pair. Where source and destination are either two ordinary files or two directories. The checkpoint performs the following actions when the execute method is called: - For ordinary files, copy the specified source file to the specified destination. - For directories, copy all files contained in the source directory to to the specified destination directory. cCstt|ƒi|ƒdS(s{Initializes the class Parameters: -name - this arg is required by the AbstractCheckpoint N(tsuperRt__init__(tselftname((s../transfer_files.pyR6scCsW|iid||ƒti|tiƒoti||ƒn|iid|ƒdS(s  Class method to physically copy a file from source to dest only if the file exists. Parameters: - source : Source file to be copied - dest : destination directory to copy to Returns: - Nothing sExecuting: Copy file %s to %ss%s not found -- skippingN(tloggertdebugtostaccesstF_OKtshutiltcopy2(Rtsourcetdest((s../transfer_files.pyt copy_file=s cCsT|iid||ƒtii|ƒoti||ƒn|iid|ƒdS(s¬ Class method to copy a source directory to a destination only if the source directory exists. This method uses shutil.copytree() to copy the directory, so the desitnation must not already exist. Paramters: - source : Source directory to be copied - dest : destination directory to copy to Returns: - Nothing sExecuting: Copy dir %s to %ss%s not found -- skippingN(RRR tpathtisdirR tcopytree(RRR((s../transfer_files.pytcopy_dirPscCsäd}|iidƒ|iƒ|iiid|iƒ}|djo|iidƒdSx€|ii ƒD]o\}}t |t ƒoB|iid|i ƒƒt ii|i|didƒƒ}n>|iid|idƒƒt ii|i|idƒƒ}|pÍt ii|ƒo|i||ƒnPt it ii|ƒt iƒpt it ii|ƒƒn|i||ƒt |t ƒoCd |jo6|iid ||d fƒt i||d ƒqÜqmqmWdS( s‚ The AbstractCheckpoint class requires this method in sub-classes. Parameters: - the dry_run keyword paramater. The default value is False. If set to True, the log message describes the checkpoint tasks. Returns: - Nothing On failure, errors raised are managed by the engine. s ICT current task: Transfer FilesRsNo files specified for transferNsdest_dict is a dictionary (%s)tfilet/sdest_dict is a string %stperms changing permissions of %s to %d(tNoneRRt parse_doctdoctvolatiletget_first_childRt data_dicttitemst isinstancetdicttkeysR Rtjoint target_dirtlstripRRR tdirnameR tmakedirsRtchmod(Rtdry_runttf_dictRt dest_dictR((s../transfer_files.pytexecutees6      !" (t__name__t __module__t__doc__RRRtFalseR+(((s../transfer_files.pyR#s    cCs}tiƒ}|i}|iid|ƒ}|djo,tƒ}t||ƒ}|ii|ƒn |i }|i |ƒdS(s· Create dataobjectdict dictionary containing src/dest pairs for files to be transferred via transfer-files checkpoint to newly installed boot environment. RN( Rt get_instancetdata_object_cacheRRRR Rtinsert_childrenRtupdate(t transfer_nametfilestengineRt tf_doc_dictR)((s../transfer_files.pytadd_transfer_files_to_docœs     ( R R t%solaris_install.data_object.data_dictRtsolaris_install.engineRtsolaris_install.ictticttICTt ICTBaseClassRR8(((s../transfer_files.pyts  y