Skip to content

Commit

Permalink
Merge pull request #56 from germag/remove-dead-code
Browse files Browse the repository at this point in the history
Remove dead code
  • Loading branch information
rhatdan authored Jul 8, 2024
2 parents 70116ee + 34ea90f commit 6f883d9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
7 changes: 1 addition & 6 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"os"
"sync"
"time"

"github.com/containers/podman-bootc/pkg/bootc"
Expand Down Expand Up @@ -68,7 +67,7 @@ func doRun(flags *cobra.Command, args []string) error {
}

//podman machine connection
machineInfo, err := utils.GetMachineInfo(user)
machineInfo, err := utils.GetMachineInfo()
if err != nil {
return err
}
Expand Down Expand Up @@ -159,8 +158,6 @@ func doRun(flags *cobra.Command, args []string) error {

if !vmConfig.Background {
if !vmConfig.Quiet {
var vmConsoleWg sync.WaitGroup
vmConsoleWg.Add(1)
go func() {
err := bootcVM.PrintConsole()
if err != nil {
Expand All @@ -173,8 +170,6 @@ func doRun(flags *cobra.Command, args []string) error {
return fmt.Errorf("WaitSshReady: %w", err)
}

vmConsoleWg.Done() //stop printing the VM console when SSH is ready

// the PrintConsole routine is suddenly stopped without waiting for
// the print buffer to be flushed, this can lead to the consoel output
// printing after the ssh prompt begins. Sleeping for a second
Expand Down
8 changes: 3 additions & 5 deletions pkg/utils/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"os/exec"
"strings"

"github.com/containers/podman-bootc/pkg/user"

"github.com/containers/podman/v5/pkg/machine"
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/env"
Expand All @@ -22,13 +20,13 @@ type MachineInfo struct {
Rootful bool
}

func GetMachineInfo(user user.User) (*MachineInfo, error) {
func GetMachineInfo() (*MachineInfo, error) {
minfo, err := getMachineInfo()
if err != nil {
var errIncompatibleMachineConfig *define.ErrIncompatibleMachineConfig
var errVMDoesNotExist *define.ErrVMDoesNotExist
if errors.As(err, &errIncompatibleMachineConfig) || errors.As(err, &errVMDoesNotExist) {
minfo, err := getPv4MachineInfo(user)
minfo, err := getPv4MachineInfo()
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -71,7 +69,7 @@ func getMachineInfo() (*MachineInfo, error) {
}

// Just to support podman v4.9, it will be removed in the future
func getPv4MachineInfo(user user.User) (*MachineInfo, error) {
func getPv4MachineInfo() (*MachineInfo, error) {
//check if a default podman machine exists
listCmd := exec.Command("podman", "machine", "list", "--format", "json")
var listCmdOutput strings.Builder
Expand Down
10 changes: 0 additions & 10 deletions pkg/vm/vm_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,6 @@ func (v *BootcVMLinux) loadExistingDomain() (err error) {
}
}

// if domain exists, load it's config
if v.domain != nil {
cfg, err := v.GetConfig()
if err != nil {
return fmt.Errorf("unable to load VM config: %w", err)
}
v.sshPort = cfg.SshPort
v.sshIdentity = cfg.SshIdentity
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion podman-bootc.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func cleanup() {
}

//podman machine connection
machineInfo, err := utils.GetMachineInfo(user)
machineInfo, err := utils.GetMachineInfo()
if err != nil {
logrus.Errorf("unable to get podman machine info: %s", err)
os.Exit(1)
Expand Down

0 comments on commit 6f883d9

Please sign in to comment.