/usr/lib/python3/dist-packages/provisioningserver/drivers/osystem/custom.py is in python3-maas-provisioningserver 2.0.0~beta3+bzr4941-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 | # Copyright 2014-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Operating System class used for custom images."""
__all__ = [
"CustomOS",
]
import os
from provisioningserver.config import ClusterConfiguration
from provisioningserver.drivers.osystem import (
BOOT_IMAGE_PURPOSE,
OperatingSystem,
)
class CustomOS(OperatingSystem):
"""Custom operating system."""
name = "custom"
title = "Custom"
def get_boot_image_purposes(self, arch, subarch, release, label):
"""Gets the purpose of each boot image."""
# Custom images can only be used with XINSTALL.
return [BOOT_IMAGE_PURPOSE.XINSTALL]
def is_release_supported(self, release):
"""Return True when the release is supported, False otherwise."""
# All release are supported, since the user uploaded it.
return True
def get_default_release(self):
"""Gets the default release to use when a release is not
explicit."""
# No default for this OS.
return ""
def get_release_title(self, release):
"""Return the title for the given release."""
# Return the same name, since the cluster does not know about the
# title of the image. The region will fix the title for the UI.
return release
def get_xinstall_parameters(self, arch, subarch, release, label):
"""Returns the xinstall image name and type for given image."""
with ClusterConfiguration.open() as config:
dd_path = os.path.join(
config.tftp_root, 'custom', arch,
subarch, release, label, 'root-dd')
if os.path.exists(dd_path):
return "root-dd", "dd-tgz"
else:
return "root-tgz", "tgz"
|