Grains for backwards compatibility
    Remove this function in Neon

def _legacy_grains(grains):
    '''
    Grains for backwards compatibility
    Remove this function in Neon
    '''
    # parse legacy sdc grains
    if 'mdata' in grains and 'sdc' in grains['mdata']:
        if 'server_uuid' not in grains['mdata']['sdc'] or 'FAILURE' in grains['mdata']['sdc']['server_uuid']:
            grains['hypervisor_uuid'] = 'unknown'
        else:
            grains['hypervisor_uuid'] = grains['mdata']['sdc']['server_uuid']

        if 'datacenter_name' not in grains['mdata']['sdc'] or 'FAILURE' in grains['mdata']['sdc']['datacenter_name']:
            grains['datacenter'] = 'unknown'
        else:
            grains['datacenter'] = grains['mdata']['sdc']['datacenter_name']

    # parse rules grains
    if 'mdata' in grains and 'rules' in grains['mdata']:
        grains['roles'] = grains['mdata']['roles'].split(',')

    return grains