def _on_success_deploy(): if state.get('success') == True and callable(on_success): try: on_success() set_state('on_success', True) except Exception as error: set_state('on_success', error)
def print_deploy_stats(task_name, start_time): if fetch('verbose') == True: print_verbose() error_states = get_error_states() if error_states: echo_task('Deploy errors', error=True) for error_state in error_states: echo_comment(('\n[ERROR]\n%s' % state.get(error_state)), error=True) if state.get('success'): print(yellow('\n-----> Release number: %s' % fetch('release_number'))) print_stats_args = [task_name, start_time] if state.get('success') != True: print_stats_args.append(True) print_task_stats(*print_stats_args)
def _post_deploy(): if state.get('deploy') == True: try: move_build_to_releases() link_release_to_current() set_state('post_deploy', True) except Exception as error: set_state('post_deploy', error) raise error # escalate exception to 'deploy_wrapper' function
def _deploy(*args): if state.get('pre_deploy') == True: try: with cd(fetch('build_to')): wrapped_function(*args) set_state('deploy', True) except Exception as error: set_state('deploy', error) raise error # escalate exception to 'deploy_wrapper' function
def _finalize_deploy(): if not state.get('success') == True: echo_task('Cleaning up failed deploy') try: cleanup_releases() remove_build_path() force_unlock() set_state('finalize', True) except Exception as error: set_state('finalize', error)
def print_verbose(): print(yellow('\n=====> Verbose subtasks stats\n')) subtask_states = [ 'pre_deploy', 'deploy', 'post_deploy', 'finalize', 'on_success' ] for subtask_state_name in subtask_states: state_value = state.get(subtask_state_name) if state_value == None: print_value = white('not invoked') elif state_value == True: print_value = green('success') else: print_value = red('failed') print('%s - %s' % (yellow('* %s' % subtask_state_name), print_value))
def find_error_states(x): if x == 'success': return False return state.get(x) not in [True, None]