Class DeviceInstallBuilder
- All Implemented Interfaces:
KabSource
DeviceManifest. Different implementations of DeviceManifest can
exist and the installer need not understand the entire format to perform an
installation.
Fundamentally, a manifest defines all the kabs required to get kOS into the state
defined by the manifest, which in turn, defines the list of kabs that need to be
installed. A DeviceManifest can define the state of multiple nodes in a
multi-node device, and all kabs across all nodes must be installed on the primary
node of the device. This means that all installations occur on the primary node
of the device and kOS will handle installation of all other nodes in the device,
even if they are added after the installation has occurred.
This builder is provided the manifest to install and a list of kabs (via
KabSource) that correspond to the kabs listed in the manifest. It is ok
for the kab sources to include more kabs than are required by the manifest as
only those kabs listed in the manifest will be considered. The install process
will also factor in kabs that are already installed on the device and only install
kabs that are missing.
Since an installation is defined by the DeviceManifest, the builder must
have a manifest to initiate the install. There are two options to satisfy this
requirement:
- Specify the actual manifest kab. Since the actual
KabFileis specified, The kab does not need to be visible in any of the provided sources. - Specify the identifier of the manifest kab. This requires that the manifest kab be visible through the specified sources.
- Version:
- 2023-10-12
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionAdd a kab source to the builder.voidbuild()Build aResolvedDeviceManifestfrom the builder.Return the list of kab id's that are currently available and valid.Return the list of kab id's referenced by the manifest but are not valid due to potential file corruption.Get the first kabId from the missing list.Return the list of kab id's referenced by the manifest but are not valid due to some validation error.getKabByIdentifier(String identifier) Return the kab file with the specified identifier.Return theBaseManfiestArtifactfor the specified id.Return the list of kab id's referenced by the manifest but are not available from any of the sources.Return the list of required kab id's based on the current manifest chain.booleanReturn true if the manifest chain is complete.booleanReturn true if the manifest chain is complete and all dependencies referenced in the chain are available and valid.setManifestId(String manifestId) Set the identifier of the manifest.setManifestKab(KabFile manifestKab) Set the manifest kab.
-
Field Details
-
VALIDATE_errInvalidDates
- See Also:
-
VALIDATE_errInvalidMiniHash
- See Also:
-
VALIDATE_errInvalidSignature
- See Also:
-
VALIDATE_errNoManifestJson
- See Also:
-
VALIDATE_errNotInstallManifest
- See Also:
-
VALIDATE_errNotManifestType
- See Also:
-
VALIDATE_errManifestUntrustedMode
- See Also:
-
VALIDATE_errNotDeviceManifest
- See Also:
-
VALIDATE_errIncompatibleDeviceType
- See Also:
-
VALIDATE_errBlockedManifest
- See Also:
-
-
Method Details
-
setManifestId
Set the identifier of the manifest. The kab will be fetched from the specified sources.- Parameters:
manifestId- identifier of the manifest kab
-
setManifestKab
Set the manifest kab. If set,setManifestId()will be ignored.- Parameters:
manifestKab- the manifest kab to use
-
addSource
Add a kab source to the builder. Sources will be examined in the order in which they are added allowing for composite sources to be used.- Parameters:
source- the kab source to add
-
build
public void build()Build aResolvedDeviceManifestfrom the builder. -
isChainComplete
public boolean isChainComplete()Return true if the manifest chain is complete. At this point all required kabs are known and the required list can be used to garbage collect external kab sources. -
getRequiredKabs
Return the list of required kab id's based on the current manifest chain. This can be used to garbage collect kab sources. This list should only be used onceisChainComplete()returns true as it's only possible to know all required kabs once the full manifest chain has been evaluated. -
isComplete
public boolean isComplete()Return true if the manifest chain is complete and all dependencies referenced in the chain are available and valid. If not complete, use the following methods to process the results:getMissingKabs(): Returns a list of kab id's that are referenced but missing. This may be a manifest in the chain or artifacts that make up the release.getCorruptKabs(): Returns a list of kab id's that are considered corrupt due to mini-hash or signature check failures. It is possible that these can be replaced with another copy that is not corrupt. These are also included in the invalid list.getInvalidKabs(): Returns a list of kab that are not installable. This includes corrupt kabs as well as kabs that fail for other reasons such as expired certs and so on.
-
getMissingKabs
Return the list of kab id's referenced by the manifest but are not available from any of the sources. Can only be called after callingbuild(). -
getFirstMissingKab
Get the first kabId from the missing list. -
getCorruptKabs
Return the list of kab id's referenced by the manifest but are not valid due to potential file corruption. Can only be called after callingbuild(). -
getInvalidKabs
Return the list of kab id's referenced by the manifest but are not valid due to some validation error. This list includes corrupted kabs as well as kabs that contain other validation failures such as out of date certs. The map key is the kab id and the value is the validation failure. Can only be called after callingbuild(). -
getAvailableKabs
Return the list of kab id's that are currently available and valid. This is the list of required kabs minus missing and invalid. -
getManifestArtifact
Return theBaseManfiestArtifactfor the specified id. If the id identifies a manifest or a kab not included in the manifest chain then this will return null.- Parameters:
id- id of the kab- Returns:
BaseManifestArtifactor null
-
getKabByIdentifier
Description copied from interface:KabSourceReturn the kab file with the specified identifier.- Specified by:
getKabByIdentifierin interfaceKabSource
-
getInitialManifestId
-
getManifestKab
-
getMissingManifestId
-
getManifestChain
-