Skip to content

Commit

Permalink
Distro: add Nick() to the distro.Distro interface
Browse files Browse the repository at this point in the history
Some distributions use nicknames for releases. Add it to the
distro.Distro interface.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza committed Apr 11, 2024
1 parent fedfdf5 commit 1c79936
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/distro/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type Distro interface {
// Returns the name of the distro.
Name() string

// Returns the nick of the distro.
Nick() string

// Returns the release version of the distro. This is used in repo
// files on the host system and required for the subscription support.
Releasever() string
Expand Down
4 changes: 4 additions & 0 deletions pkg/distro/fedora/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ func (d *distribution) Name() string {
return d.name
}

func (d *distribution) Nick() string {
return "" // Fedora does not use distro nick
}

func (d *distribution) Releasever() string {
return d.releaseVersion
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/distro/rhel/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type DefaultDistroImageConfigFunc func(d *Distribution) *distro.ImageConfig

type Distribution struct {
name string
DistNick string
product string
osVersion string
releaseVersion string
Expand All @@ -34,6 +35,10 @@ func (d *Distribution) Name() string {
return d.name
}

func (d *Distribution) Nick() string {
return d.DistNick
}

func (d *Distribution) Releasever() string {
return d.releaseVersion
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/distro/rhel7/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func (d *distribution) Name() string {
return d.name
}

func (d *distribution) Nick() string {
return d.nick
}

func (d *distribution) Releasever() string {
return d.releaseVersion
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/distro/test_distro/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func (d *TestDistro) Name() string {
return d.name
}

func (d *TestDistro) Nick() string {
return "" // not supported
}

func (d *TestDistro) Releasever() string {
return d.releasever
}
Expand Down

0 comments on commit 1c79936

Please sign in to comment.