def log_result()

in curator/actions/rollover.py [0:0]


    def log_result(self, result):
        """Log the results based on whether the index rolled over or not"""
        dryrun_string = ''
        if result['dry_run']:
            dryrun_string = 'DRY-RUN: '
        self.loggit.debug('%sResult: %s', dryrun_string, result)
        rollover_string = (
            f"{dryrun_string}Old index {result['old_index']} "
            f"rolled over to new index {result['new_index']}"
        )
        # Success is determined by at one condition being True
        success = False
        for k in list(result['conditions'].keys()):
            if result['conditions'][k]:
                success = True
        if result['dry_run'] and success:  # log "successful" dry-run
            self.loggit.info(rollover_string)
        elif result['rolled_over']:
            self.loggit.info(rollover_string)
        else:
            msg = (
                f"{dryrun_string}Rollover conditions not met. "
                f"Index {result['old_index']} not rolled over."
            )
            self.loggit.info(msg)