Trying to get logic honor if-statements to control output

You can try it like this

def check_linux_dnf(section):
    update_found=False  # init  update_found marker 
    for line in section:  # loop over the lines
        if line[0].isdigit:  # check if number (update found)
            update_found=True  # set marker
            # check for the update type and output the result
            if line[1] == 'Bugfix':  
                yield Result(state=State.WARN, summary=line[0] + " Bugfix Updates")
            elif line[1] == "Enhancement":
                yield Result(state=State.WARN, summary=line[0] + " Enhancement Updates")
            elif line[1] == "Security":
                yield Result(state=State.CRIT, summary=line[0] + " Security Updates")
    # if no update found, outpout a summary
    if not update_found:  
        yield Result(state=State.OK, summary="No DNF Updates found.")