Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions pkg/daemon/rpm-ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,38 +229,6 @@ func (r *RpmOstreeClient) RebaseLayeredFromContainerStorage(podmanImageInfo *Pod
return runRpmOstree("rebase", "--experimental", "ostree-unverified-image:containers-storage:"+podmanImageInfo.RepoDigest)
}

// DeploymentVersion wraps rpm-ostree deployment information to provide
// version checking methods similar to the osrelease package.
type DeploymentVersion struct {
// osName is the osname field from the deployment
osName string
// version is the version field from the deployment
version string
}

// NewTargetOSVersionFromDeployment creates a DeploymentVersion from the given deployment
func NewTargetOSVersionFromDeployment(deployment *rpmostreeclient.Deployment) *DeploymentVersion {
return &DeploymentVersion{
osName: deployment.OSName,
version: deployment.Version,
}
}

// BaseVersionMajor returns the first number in a `.` separated version.
func (t *DeploymentVersion) BaseVersionMajor() string {
return strings.Split(t.version, ".")[0]
}

// IsEL is true if the OS is an Enterprise Linux variant of CoreOS
func (t *DeploymentVersion) IsEL() bool {
return t.osName == "rhcos" || t.osName == "scos"
}

// IsEL10 is true if the target OS is RHCOS 10 or SCOS 10
func (t *DeploymentVersion) IsEL10() bool {
return t.IsEL() && (strings.HasPrefix(t.version, "10.") || t.version == "10")
}

// patchPoliciesForContainerStorage temporarily overrides the container image policy visible
// to rpm-ostreed to ensure pulls from the "containers-storage" transport are allowed for the
// given image.
Expand Down