File: //lib/python3.6/site-packages/cloudinit/distros/centos.py
# This file is part of cloud-init. See LICENSE file for license information.
from cloudinit.distros import rhel
from cloudinit import log as logging
LOG = logging.getLogger(__name__)
class Distro(rhel.Distro):
def __init__(self, name, cfg, path):
rhel.Distro.__init__(self, name, cfg, path)
self.cname = 'CentOS'
self.rpmgpgkey_path = None
def get_fn_release(self):
reg = re.compile('%s (Linux )?release (\d+.\d+).*' % self.cname)
check_files = ('/etc/issue',
'/etc/issue.net',
'/etc/centos-release',
'/etc/redhat-release',
'/etc/system-release')
for fn in check_files:
if os.path.exists(fn):
out = reg.findall(util.load_file(fn).strip())
if out: return out[0][-1]
return ''
# vi: ts=4 expandtab