/usr/lib/python3/dist-packages/provisioningserver/drivers/osystem/rhel.py is in python3-maas-provisioningserver 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # Copyright 2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""RHELOS Operating System."""
__all__ = [
"RHELOS",
]
import re
from provisioningserver.drivers.osystem import (
BOOT_IMAGE_PURPOSE,
OperatingSystem,
)
# Regex matcher that is used to check if the release is supported. The release
# name just has to start with 'rhel' to be supported but the major, minor,
# and title are found if available to help format the title.
DISTRO_MATCHER = re.compile(
'^rhel((?P<major>[0-9])(?P<minor>[0-9])?)?([\-\.]?(?P<title>.+))?$',
re.I)
DISTRO_SERIES_DEFAULT = 'rhel7'
class RHELOS(OperatingSystem):
"""RHELOS operating system."""
name = 'rhel'
title = 'Redhat Enterprise Linux'
def get_boot_image_purposes(self, arch, subarch, release, label):
"""Gets the purpose of each boot image."""
return [
BOOT_IMAGE_PURPOSE.XINSTALL
]
def get_default_release(self):
"""Gets the default release to use when a release is not
explicit."""
return DISTRO_SERIES_DEFAULT
def get_release_title(self, release):
"""Return the title for the given release."""
matched = DISTRO_MATCHER.match(release)
if matched is None:
# This should never happen as is_release_supported will return
# false but just in case it does...
return "%s %s" % (self.title, release)
ret = self.title
major = matched.group('major')
minor = matched.group('minor')
title = matched.group('title')
if None not in (major, minor):
ret = "%s %s.%s" % (ret, major, minor)
elif major is not None:
ret = "%s %s" % (ret, major)
if title is not None:
ret = "%s %s" % (ret, title)
return ret
|