#NEWLINE# def _squash( self ) : #NEWLINE# #INDENT# if self . layer_paths_to_squash : #NEWLINE# #INDENT# os . makedirs ( self . squashed_dir ) #NEWLINE# self . _squash_layers ( self . layer_paths_to_squash , self . layer_paths_to_move ) #NEWLINE# #UNINDENT# self . diff_ids = self . _generate_diff_ids ( ) #NEWLINE# self . chain_ids = self . _generate_chain_ids ( self . diff_ids ) #NEWLINE# metadata = self . _generate_image_metadata ( ) #NEWLINE# image_id = self . _write_image_metadata ( metadata ) #NEWLINE# layer_path_id = None #NEWLINE# if self . layer_paths_to_squash : #NEWLINE# #INDENT# layer_path_id = self . _generate_squashed_layer_path_id ( ) #NEWLINE# metadata = self . _generate_last_layer_metadata ( layer_path_id , self . layer_paths_to_squash [ 0 ] ) #NEWLINE# self . _write_squashed_layer_metadata ( metadata ) #NEWLINE# self . _write_version_file ( self . squashed_dir ) #NEWLINE# shutil . move ( self . squashed_dir , os . path . join ( self . new_image_dir , layer_path_id ) ) #NEWLINE# #UNINDENT# manifest = self . _generate_manifest_metadata ( image_id , self . image_name , self . image_tag , self . old_image_manifest , self . layer_paths_to_move , layer_path_id ) #NEWLINE# self . _write_manifest_metadata ( manifest ) #NEWLINE# repository_image_id = manifest [ 0 ] [ 'Layers' ] [ ( - 1 ) ] . split ( '/' ) [ 0 ] #NEWLINE# self . _move_layers ( self . layer_paths_to_move , self . old_image_dir , self . new_image_dir ) #NEWLINE# repositories_file = os . path . join ( self . new_image_dir , 'repositories' ) #NEWLINE# self . _generate_repositories_json ( repositories_file , repository_image_id , self . image_name , self . image_tag ) #NEWLINE# return image_id