Skip to content

Commit 6f883d9

Browse files
authored
Merge pull request #56 from germag/remove-dead-code
Remove dead code
2 parents 70116ee + 34ea90f commit 6f883d9

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed

cmd/run.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"errors"
66
"fmt"
77
"os"
8-
"sync"
98
"time"
109

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

7069
//podman machine connection
71-
machineInfo, err := utils.GetMachineInfo(user)
70+
machineInfo, err := utils.GetMachineInfo()
7271
if err != nil {
7372
return err
7473
}
@@ -159,8 +158,6 @@ func doRun(flags *cobra.Command, args []string) error {
159158

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

176-
vmConsoleWg.Done() //stop printing the VM console when SSH is ready
177-
178173
// the PrintConsole routine is suddenly stopped without waiting for
179174
// the print buffer to be flushed, this can lead to the consoel output
180175
// printing after the ssh prompt begins. Sleeping for a second

pkg/utils/podman.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77
"os/exec"
88
"strings"
99

10-
"github.com/containers/podman-bootc/pkg/user"
11-
1210
"github.com/containers/podman/v5/pkg/machine"
1311
"github.com/containers/podman/v5/pkg/machine/define"
1412
"github.com/containers/podman/v5/pkg/machine/env"
@@ -22,13 +20,13 @@ type MachineInfo struct {
2220
Rootful bool
2321
}
2422

25-
func GetMachineInfo(user user.User) (*MachineInfo, error) {
23+
func GetMachineInfo() (*MachineInfo, error) {
2624
minfo, err := getMachineInfo()
2725
if err != nil {
2826
var errIncompatibleMachineConfig *define.ErrIncompatibleMachineConfig
2927
var errVMDoesNotExist *define.ErrVMDoesNotExist
3028
if errors.As(err, &errIncompatibleMachineConfig) || errors.As(err, &errVMDoesNotExist) {
31-
minfo, err := getPv4MachineInfo(user)
29+
minfo, err := getPv4MachineInfo()
3230
if err != nil {
3331
return nil, err
3432
}
@@ -71,7 +69,7 @@ func getMachineInfo() (*MachineInfo, error) {
7169
}
7270

7371
// Just to support podman v4.9, it will be removed in the future
74-
func getPv4MachineInfo(user user.User) (*MachineInfo, error) {
72+
func getPv4MachineInfo() (*MachineInfo, error) {
7573
//check if a default podman machine exists
7674
listCmd := exec.Command("podman", "machine", "list", "--format", "json")
7775
var listCmdOutput strings.Builder

pkg/vm/vm_linux.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,16 +287,6 @@ func (v *BootcVMLinux) loadExistingDomain() (err error) {
287287
}
288288
}
289289

290-
// if domain exists, load it's config
291-
if v.domain != nil {
292-
cfg, err := v.GetConfig()
293-
if err != nil {
294-
return fmt.Errorf("unable to load VM config: %w", err)
295-
}
296-
v.sshPort = cfg.SshPort
297-
v.sshIdentity = cfg.SshIdentity
298-
}
299-
300290
return nil
301291
}
302292

podman-bootc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func cleanup() {
2424
}
2525

2626
//podman machine connection
27-
machineInfo, err := utils.GetMachineInfo(user)
27+
machineInfo, err := utils.GetMachineInfo()
2828
if err != nil {
2929
logrus.Errorf("unable to get podman machine info: %s", err)
3030
os.Exit(1)

0 commit comments

Comments
 (0)