base

package
v0.0.0-...-5175f08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UbuntuOS is the special value to be places in OS field of a base to
	// indicate an operating system is an Ubuntu distro
	UbuntuOS = "ubuntu"
)

Variables

View Source
var Risks = []Risk{
	Stable,
	Candidate,
	Beta,
	Edge,
}

Risks is a list of the available channel risks.

Functions

func GetSeriesFromBase

func GetSeriesFromBase(v Base) (string, error)

GetSeriesFromBase returns the series name for a given Base. This is needed to support legacy series.

Types

type Base

type Base struct {
	OS string
	// Channel is track[/risk/branch].
	// eg "22.04" or "22.04/stable" etc.
	Channel Channel
}

Base represents an OS/Channel. Bases can also be converted to and from a series string.

func ControllerBases

func ControllerBases() []Base

ControllerBases returns the supported workload bases available to it at the execution time.

func MakeDefaultBase

func MakeDefaultBase(os string, channel string) Base

MakeDefaultBase creates a base from an os and simple version string, eg "22.04".

func MustParseBaseFromString

func MustParseBaseFromString(b string) Base

MustParseBaseFromString is like ParseBaseFromString but panics if the string is invalid.

func ParseBase

func ParseBase(os string, channel string) (Base, error)

ParseBase constructs a Base from the os and channel string.

func ParseBaseFromString

func ParseBaseFromString(b string) (Base, error)

ParseBaseFromString takes a string containing os and channel separated by @ and returns a base.

func ParseManifestBases

func ParseManifestBases(manifestBases []charm.Base) ([]Base, error)

ParseManifestBases transforms charm.Bases to Bases. This format comes out of a charm.Manifest and contains architectures which Base does not. Only unique non architecture Bases will be returned.

func ValidateBase

func ValidateBase(supportedBases []Base, base, fallbackPreferredBase Base) (Base, error)

ValidateBase attempts to validate a base if one is found, otherwise it uses the fallback base and validates that one. Returns the base it validated against or an error if one is found. Note: the selected base will be returned if there is an error to help use that for a fallback during error scenarios.

func WorkloadBases

func WorkloadBases() []Base

WorkloadBases returns the supported workload bases available to it at the execution time.

func (Base) DisplayString

func (b Base) DisplayString() string

DisplayString returns the base string ignoring risk.

func (Base) Empty

func (b Base) Empty() bool

Empty returns true if the base is empty.

func (Base) IsCompatible

func (b Base) IsCompatible(other Base) bool

IsCompatible returns true if base other is the same underlying OS version, ignoring risk.

func (Base) IsUbuntuLTS

func (b Base) IsUbuntuLTS() bool

IsUbuntuLTS returns true if this base is a recognised Ubuntu LTS.

func (Base) String

func (b Base) String() string

type Channel

type Channel struct {
	Track string `json:"track,omitempty"`
	Risk  Risk   `json:"risk,omitempty"`
}

Channel identifies and describes completely an os channel.

A channel consists of, and is subdivided by, tracks and risk-levels:

  • Tracks represents the version of the os, eg "22.04".
  • Risk-levels represent a progressive potential trade-off between stability and new features.

The complete channel name can be structured as three distinct parts separated by slashes:

<track>/<risk>

func MakeDefaultChannel

func MakeDefaultChannel(track string) Channel

MakeDefaultChannel creates a normalized channel for the specified track with a default risk of "stable".

func ParseChannel

func ParseChannel(s string) (Channel, error)

ParseChannel parses a string representing a channel.

func ParseChannelNormalize

func ParseChannelNormalize(s string) (Channel, error)

ParseChannelNormalize parses a string representing a store channel. The returned channel's track, risk and name are normalized.

func (Channel) DisplayString

func (ch Channel) DisplayString() string

func (Channel) Empty

func (ch Channel) Empty() bool

Empty returns true if all it's components are empty.

func (Channel) Normalize

func (ch Channel) Normalize() Channel

Normalize the channel with normalized track, risk and names.

func (Channel) String

func (ch Channel) String() string

type Risk

type Risk string

Risk describes the type of risk in a current channel.

const (
	Stable    Risk = "stable"
	Candidate Risk = "candidate"
	Beta      Risk = "beta"
	Edge      Risk = "edge"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL