Comment 3 for bug 1069141

Revision history for this message
Kyle Gordon (kylegordon) wrote :

So, this problem persists, and it negatively impacts the use of many Puppet modules that rely on the system codename being returned from lsb_release.

To fix it, edit /usr/share/pyshared/lsb_release.py and replace lookup_codename() with this version from Debian Wheezy, and update the v7 entry RELEASE_CODENAME_LOOKUP list.

RELEASE_CODENAME_LOOKUP = {
    '1.1' : 'buzz',
    '1.2' : 'rex',
    '1.3' : 'bo',
    '2.0' : 'hamm',
    '2.1' : 'slink',
    '2.2' : 'potato',
    '3.0' : 'woody',
    '3.1' : 'sarge',
    '4.0' : 'etch',
    '5.0' : 'lenny',
    '6.0' : 'squeeze',
    '7' : 'wheezy',
    }

def lookup_codename(release, unknown=None):
    m = re.match(r'(\d+)\.(\d+)(r(\d+))?', release)
    if not m:
        return unknown

    if int(m.group(1)) < 7:
        shortrelease = '%s.%s' % m.group(1,2)
    else:
        shortrelease = '%s' % m.group(1)
    return RELEASE_CODENAME_LOOKUP.get(shortrelease, unknown)