Skip to content

Commit

Permalink
Align code to LXD 5.15
Browse files Browse the repository at this point in the history
The package github.com/lxc/lxd/lxc/utils is no more
available and replaced by github.com/lxc/lxd/shared/cmd.
  • Loading branch information
Daniele Rondina committed Jun 27, 2023
1 parent 40781f4 commit 2f2d983
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pkg/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import (

lxd "github.com/lxc/lxd/client"
lxd_config "github.com/lxc/lxd/lxc/config"
lxd_utils "github.com/lxc/lxd/lxc/utils"
lxd_api "github.com/lxc/lxd/shared/api"
lxd_cli "github.com/lxc/lxd/shared/cmd"
)

type LxdCExecutor struct {
Expand Down Expand Up @@ -308,7 +308,7 @@ func (e *LxdCExecutor) CopyContainerOnInstance(
}

// Watch the background operation
progress := lxd_utils.ProgressRenderer{
progress := lxd_cli.ProgressRenderer{
Format: "Copy container: %s",
Quiet: false,
}
Expand All @@ -320,7 +320,7 @@ func (e *LxdCExecutor) CopyContainerOnInstance(
}

// Wait the copy of the container
err = lxd_utils.CancelableWait(op, &progress)
err = lxd_cli.CancelableWait(op, &progress)
if err != nil {
progress.Done("")
return err
Expand Down
6 changes: 3 additions & 3 deletions pkg/executor/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
log "github.com/MottainaiCI/lxd-compose/pkg/logger"

lxd "github.com/lxc/lxd/client"
lxd_utils "github.com/lxc/lxd/lxc/utils"
lxd_shared "github.com/lxc/lxd/shared"
lxd_cli "github.com/lxc/lxd/shared/cmd"
"github.com/lxc/lxd/shared/ioprogress"
lxd_units "github.com/lxc/lxd/shared/units"
)
Expand Down Expand Up @@ -188,7 +188,7 @@ func (e *LxdCExecutor) RecursivePushFile(nameContainer, source, target string) e
readCloser = f
}

progress := lxd_utils.ProgressRenderer{
progress := lxd_cli.ProgressRenderer{
Format: fmt.Sprintf("Pushing %s to %s: %%s", p, targetPath),
Quiet: false,
}
Expand Down Expand Up @@ -295,7 +295,7 @@ func (l *LxdCExecutor) RecursivePullFile(nameContainer string, destPath string,
return err
}

progress := lxd_utils.ProgressRenderer{
progress := lxd_cli.ProgressRenderer{
Format: fmt.Sprintf("Pulling %s from %s: %%s", destPath, target),
Quiet: false,
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/executor/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
"time"

lxd "github.com/lxc/lxd/client"
lxd_utils "github.com/lxc/lxd/lxc/utils"
lxd_api "github.com/lxc/lxd/shared/api"
lxd_cli "github.com/lxc/lxd/shared/cmd"
)

func (e *LxdCExecutor) LaunchContainer(name, fingerprint string, profiles []string) error {
Expand Down Expand Up @@ -74,7 +74,7 @@ func (e *LxdCExecutor) LaunchContainerType(name, fingerprint string, profiles []
}

// Watch the background operation
progress := lxd_utils.ProgressRenderer{
progress := lxd_cli.ProgressRenderer{
Format: "Retrieving image: %s",
Quiet: false,
}
Expand Down Expand Up @@ -113,7 +113,7 @@ func (e *LxdCExecutor) LaunchContainerType(name, fingerprint string, profiles []
return e.DoAction2Container(name, "start")
}

func (e *LxdCExecutor) WaitOperation(rawOp interface{}, p *lxd_utils.ProgressRenderer) error {
func (e *LxdCExecutor) WaitOperation(rawOp interface{}, p *lxd_cli.ProgressRenderer) error {
var err error = nil

// NOTE: currently on ARM we have a weird behavior where the process that waits
Expand All @@ -130,9 +130,9 @@ func (e *LxdCExecutor) WaitOperation(rawOp interface{}, p *lxd_utils.ProgressRen
// err = op.Wait()

if p != nil {
err = lxd_utils.CancelableWait(rawOp, p)
err = lxd_cli.CancelableWait(rawOp, p)
} else {
err = lxd_utils.CancelableWait(rawOp, nil)
err = lxd_cli.CancelableWait(rawOp, nil)
}

return err
Expand Down Expand Up @@ -192,7 +192,7 @@ func (e *LxdCExecutor) DoAction2Container(name, action string) error {
return err
}

progress := lxd_utils.ProgressRenderer{
progress := lxd_cli.ProgressRenderer{
Quiet: false,
}

Expand Down Expand Up @@ -322,7 +322,7 @@ func (e *LxdCExecutor) CopyImage(imageFingerprint string, remote lxd.ImageServer
}

// Watch the background operation
progress := lxd_utils.ProgressRenderer{
progress := lxd_cli.ProgressRenderer{
Format: "Retrieving image: %s",
Quiet: false,
}
Expand Down

0 comments on commit 2f2d983

Please sign in to comment.