OS build model
2 minute read
An OS build is an instance of externalcontent.models.OSBuild. It lets a user pick Windows Server 2022 without knowing that it means one AMI in AWS and a different template in vCenter.
(opens full-size image in a new tab)
Mapping a build to provider images
Each pairing of an OS build with a technology that can provide it is an OSBuildAttribute, whose template_name field holds the provider’s identifier for the image or template. They have the global ID prefix IMG.
OSBuildAttribute is sub-typed, meaning the returned object is a technology-specific subclass with extra fields: AmazonMachineImage for AWS, AzureARMImage for Azure Resource Manager, VsphereOSBuildAttribute for vCenter. Call cast() to reach those fields.
Where a build is offered
OSBuild.environments decides which environments offer the build; from an environment, read environment.os_builds. Applications declare the builds they can be installed on as Application.os_builds; from a build, read os_build.application_set.
Two fields shape how a server is built:
use_handler_template, labeled Use Template Provisioning, provisions from the handler’s template rather than building the server from scratch, and stops a provisioning engine from being asked to install the operating system. Builds created in the Add OS Build dialog are template-based.os_familyis whatis_windows()andis_linux()test, by walking up to the root of the family tree. Use them instead of parsing the build’s name.
Related
- OS Builds: Create OS builds and map them to images and templates.
- Resource handler model: The handler mapping, including the capability flag for imports.
- Environment model: Where a build is offered and what else an environment governs.