def change_requires_update()

in aws/solutions/StackSetsResource/FunctionCode/lambda_function.py [0:0]


def change_requires_update(attributes, old_values, current_values):
    # Given a list of attributes, compare the old and new values to see if
    # there's been a change.
    for attribute in attributes:
        if (attribute not in old_values) and (attribute in current_values):
            logger.debug("New value for {}: {}".format(attribute, current_values[attribute]))
            return True
        if (attribute in old_values) and (attribute not in current_values):
            logger.debug("Value removed for {}: {}".format(attribute, old_values[attribute]))
            return True
        if (attribute in old_values) and (attribute in current_values):
            logger.debug("Evaluating {}: {} vs. {}".format(attribute, current_values[attribute], old_values[attribute]))
            if current_values[attribute] != old_values[attribute]:
                return True
    return False