Skip to content

Commit

Permalink
Show information about the linux distribution
Browse files Browse the repository at this point in the history
Taking from /etc/os-release, via libmachine provision
  • Loading branch information
afbjorklund committed Jul 17, 2019
1 parent 09628c6 commit 793b8a4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/blang/semver"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/host"
"github.com/docker/machine/libmachine/provision"
"github.com/golang/glog"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/name"
Expand Down Expand Up @@ -628,6 +629,7 @@ func prepareNone(vmDriver string) {
return
}
console.OutStyle(console.StartingNone, "Configuring local host environment ...")
showOsRelease()
if viper.GetBool(cfg.WantNoneDriverWarning) {
console.OutLn("")
console.Warning("The 'none' driver provides limited isolation and may reduce system security and reliability.")
Expand Down Expand Up @@ -655,6 +657,23 @@ func prepareNone(vmDriver string) {
}
}

// showOsRelease shows systemd information about the current linux distribution
func showOsRelease() {
osReleaseOut, err := ioutil.ReadFile("/etc/os-release")
if err != nil {
glog.Errorf("ReadFile: %v", err)
return
}

osReleaseInfo, err := provision.NewOsRelease(osReleaseOut)
if err != nil {
glog.Errorf("NewOsRelease: %v", err)
return
}

console.OutStyle(console.Provisioner, "Running on %s", osReleaseInfo.PrettyName)
}

// startHost starts a new minikube host using a VM or None
func startHost(api libmachine.API, mc cfg.MachineConfig) (*host.Host, bool) {
exists, err := api.Exists(cfg.GetMachineName())
Expand Down
10 changes: 10 additions & 0 deletions pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,16 @@ func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error
return nil, errors.Wrap(err, "create")
}

provisioner, err := provision.DetectProvisioner(h.Driver)
if err != nil {
return nil, errors.Wrap(err, "DetectProvisioner")
}
osReleaseInfo, err := provisioner.GetOsReleaseInfo()
if err != nil {
return nil, errors.Wrap(err, "GetOsReleaseInfo")
}
console.OutStyle(console.Provisioner, "Provisioned with %s", osReleaseInfo.PrettyName)

if err := api.Save(h); err != nil {
return nil, errors.Wrap(err, "save")
}
Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/console/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ var styles = map[StyleEnum]style{
Caching: {Prefix: "🤹 "},
StartingVM: {Prefix: "🔥 "},
StartingNone: {Prefix: "🤹 "},
Provisioner: {Prefix: "ℹ️ "},
Resetting: {Prefix: "🔄 "},
DeletingHost: {Prefix: "🔥 "},
Copying: {Prefix: "✨ "},
Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/console/style_enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const (
Caching
StartingVM
StartingNone
Provisioner
Resetting
DeletingHost
Copying
Expand Down

0 comments on commit 793b8a4

Please sign in to comment.