This file is indexed.

/usr/lib/python3/dist-packages/provisioningserver/drivers/osystem/centos.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright 2014-2017 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""CentOS Operating System."""

__all__ = [
    "CentOS",
    ]

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 'centos' to be supported but the major, minor,
# and title are found if available to help format the title.
DISTRO_MATCHER = re.compile(
    '^centos((?P<major>[0-9])(?P<minor>[0-9])?)?([\-\.]?(?P<title>.+))?$',
    re.I)
DISTRO_SERIES_DEFAULT = 'centos70'


class CentOS(OperatingSystem):
    """CentOS operating system."""

    name = 'centos'
    title = 'CentOS'

    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')
        # MAAS provided images via streams are not bound to a minor
        # release version, which means we always provide the latest
        # available release from CentOS 6 and CentOS 7.  To address
        # LP: #1654063, we need to ensure we don't surface a version
        # unless we have specifically done so in the streams.
        #
        # Since we cannot change the streams without breaking backwards
        # compat on older MAAS', we need to ensure that we don't show
        # the minor version on CentOS 7.0, and CentOS 6.6, as they come
        # from the stream and the minor version doesn't match to what
        # we publish. As such, we ensure that we only return minor
        # if we have any other version other that X.0, 7.0 and 6.6.
        if major is not None and minor is None or minor == '0':
            ret = "%s %s" % (ret, major)
        elif major == '6' and minor == '6':
            ret = "%s %s" % (ret, major)
        elif None not in (major, minor):
            ret = "%s %s.%s" % (ret, major, minor)

        if title is not None:
            ret = "%s %s" % (ret, title)

        return ret