Skip to content

Commit

Permalink
NO-ISSUE: Decouple inventoryClient from ops (#811)
Browse files Browse the repository at this point in the history
Signed-off-by: Eran Cohen <eranco@redhat.com>
  • Loading branch information
eranco74 committed Apr 10, 2024
1 parent 4d2d54b commit 236a7a0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
@@ -1,4 +1,4 @@
package ops
package coreos_logger

import (
"bytes"
Expand Down
@@ -1,4 +1,4 @@
package ops
package coreos_logger

import (
"io"
Expand Down
3 changes: 2 additions & 1 deletion src/installer/installer.go
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"time"

"github.com/openshift/assisted-installer/src/coreos_logger"
"github.com/openshift/assisted-installer/src/ops/execute"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"

Expand Down Expand Up @@ -315,7 +316,7 @@ func (i *installer) writeImageToDisk(ignitionPath string) error {
i.UpdateHostInstallProgress(models.HostStageWritingImageToDisk, "")

interval := time.Second
liveLogger := ops.NewCoreosInstallerLogWriter(i.log, i.inventoryClient, i.Config.InfraEnvID, i.Config.HostID)
liveLogger := coreos_logger.NewCoreosInstallerLogWriter(i.log, i.inventoryClient, i.Config.InfraEnvID, i.Config.HostID)
err := utils.Retry(3, interval, i.log, func() error {
return i.ops.WriteImageToDisk(liveLogger, ignitionPath, i.Device, i.Config.InstallerArgs)
})
Expand Down
2 changes: 1 addition & 1 deletion src/ops/mock_ops.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/ops/ops.go
Expand Up @@ -48,7 +48,7 @@ const (
//go:generate mockgen -source=ops.go -package=ops -destination=mock_ops.go
type Ops interface {
Mkdir(dirName string) error
WriteImageToDisk(liveLogger *CoreosInstallerLogWriter, ignitionPath string, device string, extraArgs []string) error
WriteImageToDisk(liveLogger io.Writer, ignitionPath string, device string, extraArgs []string) error
Reboot(delay string) error
SetBootOrder(device string) error
ExtractFromIgnition(ignitionPath string, fileToExtract string) error
Expand Down Expand Up @@ -133,7 +133,7 @@ func (o *ops) SystemctlAction(action string, args ...string) error {
return errors.Wrapf(err, "Failed executing systemctl %s %s", action, args)
}

func (o *ops) WriteImageToDisk(liveLogger *CoreosInstallerLogWriter, ignitionPath string, device string, extraArgs []string) error {
func (o *ops) WriteImageToDisk(liveLogger io.Writer, ignitionPath string, device string, extraArgs []string) error {
allArgs := installerArgs(ignitionPath, device, extraArgs)
o.log.Infof("Writing image and ignition to disk with arguments: %v", allArgs)

Expand Down

0 comments on commit 236a7a0

Please sign in to comment.