Skip to content

Commit eb18969

Browse files
committed
use const for ramImageDirPath
1 parent 5a20c4e commit eb18969

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cloud/services/compute/instance/image.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import (
1111
"sigs.k8s.io/controller-runtime/pkg/log"
1212
)
1313

14+
const (
15+
rawImageDirPath = etcCAPPX + "/images"
16+
)
17+
1418
// reconcileBootDevice
1519
func (s *Service) reconcileBootDevice(ctx context.Context, vm *proxmox.VirtualMachine) error {
1620
log := log.FromContext(ctx)
@@ -38,7 +42,6 @@ func (s *Service) setCloudImage(ctx context.Context) error {
3842
image := s.scope.GetImage()
3943
url := image.URL
4044
fileName := path.Base(url)
41-
rawImageDirPath := fmt.Sprintf("%s/images", etcCAPPX)
4245
rawImageFilePath := fmt.Sprintf("%s/%s", rawImageDirPath, fileName)
4346

4447
// workaround
@@ -56,7 +59,7 @@ func (s *Service) setCloudImage(ctx context.Context) error {
5659
if err != nil {
5760
return err
5861
}
59-
cmd := fmt.Sprintf("echo '%s %s' | %s --check -", image.Checksum, rawImageFilePath, cscmd)
62+
cmd := fmt.Sprintf("echo -n '%s %s' | %s --check -", image.Checksum, rawImageFilePath, cscmd)
6063
out, _, err = vnc.Exec(context.TODO(), cmd)
6164
if err != nil {
6265
return errors.Errorf("failed to confirm checksum: %s : %v", out, err)

0 commit comments

Comments
 (0)