<s> import logging <EOL> import os <EOL> import time <EOL> from heatclient . common import template_utils <EOL> from tripleo_common import _stack_update <EOL> from tripleo_common import constants <EOL> LOG = logging . getLogger ( __name__ ) <EOL> def add_breakpoints_cleanup_into_env ( env ) : <EOL> template_utils . deep_update ( env , { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT:*>' : { '<STR_LIT:*>' : { <EOL> constants . UPDATE_RESOURCE_NAME : { '<STR_LIT>' : [ ] } } } } <EOL> } <EOL> } ) <EOL> class PackageUpdateManager ( _stack_update . StackUpdateManager ) : <EOL> def __init__ ( self , heatclient , novaclient , stack_id , <EOL> tht_dir = None , environment_files = None ) : <EOL> stack = heatclient . stacks . get ( stack_id ) <EOL> self . tht_dir = tht_dir <EOL> self . environment_files = environment_files <EOL> super ( PackageUpdateManager , self ) . __init__ ( <EOL> heatclient = heatclient , novaclient = novaclient , stack = stack , <EOL> hook_type = '<STR_LIT>' , nested_depth = <NUM_LIT:5> , <EOL> hook_resource = constants . UPDATE_RESOURCE_NAME ) <EOL> def update ( self , timeout_mins = constants . STACK_TIMEOUT_DEFAULT ) : <EOL> timestamp = int ( time . time ( ) ) <EOL> stack_params = { '<STR_LIT>' : timestamp , '<STR_LIT>' : '<STR_LIT>' } <EOL> tpl_files , template = template_utils . get_template_contents ( <EOL> template_file = os . path . join ( self . tht_dir , constants . TEMPLATE_NAME ) ) <EOL> env_paths = [ ] <EOL> if self . environment_files : <EOL> env_paths . extend ( self . environment_files ) <EOL> env_files , env = ( <EOL> template_utils . process_multiple_environments_and_files ( <EOL> env_paths = env_paths ) ) <EOL> template_utils . deep_update ( env , { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:*>' : { <EOL> '<STR_LIT:*>' : { <EOL> constants . UPDATE_RESOURCE_NAME : { <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> } <EOL> } <EOL> } <EOL> } <EOL> } ) <EOL> fields = { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : self . stack . id , <EOL> '<STR_LIT>' : template , <EOL> '<STR_LIT>' : dict ( list ( tpl_files . items ( ) ) + <EOL> list ( env_files . items ( ) ) ) , <EOL> '<STR_LIT>' : env , <EOL> '<STR_LIT>' : stack_params , <EOL> '<STR_LIT>' : timeout_mins , <EOL> } <EOL> LOG . info ( '<STR_LIT>' , self . stack . stack_name ) <EOL> LOG . debug ( '<STR_LIT>' , fields ) <EOL> self . heatclient . stacks . update ( ** fields ) </s>
