Skip to content

Commit cdd6cf6

Browse files
committed
fix
Signed-off-by: Daniil Antoshin <[email protected]>
1 parent 0b6d952 commit cdd6cf6

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

images/dvcr-artifact/pkg/datasource/filesystem-datasource.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,25 @@ func NewFilesystemDataSource() (*FilesystemDataSource, error) {
4949
}
5050
var imageInfo ImageInfo
5151

52+
53+
for {
54+
cmd := exec.CommandContext(ctx, "qemu-img", "info", "--output=json", filesystemImagePath)
55+
rawOut, err := cmd.Output()
56+
if err != nil {
57+
rawOut, err = cmd.CombinedOutput()
58+
if err != nil {
59+
fmt.Printf("inner error running qemu-img info: %w\n", err)
60+
}
61+
fmt.Printf("qemu-img command output: %s\n", string(rawOut))
62+
63+
fmt.Printf("error running qemu-img info: %w\n", err)
64+
}
65+
66+
fmt.Printf("qemu-img command output: %s\n", string(rawOut))
67+
68+
time.Sleep(time.Second)
69+
}
70+
5271
cmd := exec.CommandContext(ctx, "qemu-img", "info", "--output=json", filesystemImagePath)
5372
rawOut, err := cmd.Output()
5473
if err != nil {
@@ -68,24 +87,6 @@ func NewFilesystemDataSource() (*FilesystemDataSource, error) {
6887
uuid, _ := uuid.NewUUID()
6988
sourceImageFilename := uuid.String() + ".img"
7089

71-
for {
72-
cmd := exec.CommandContext(ctx, "qemu-img", "info", "--output=json", filesystemImagePath)
73-
rawOut, err := cmd.Output()
74-
if err != nil {
75-
rawOut, err = cmd.CombinedOutput()
76-
if err != nil {
77-
return nil, fmt.Errorf("error running qemu-img info: %w", err)
78-
}
79-
fmt.Printf("qemu-img command output: %s\n", string(rawOut))
80-
81-
return nil, fmt.Errorf("error running qemu-img info: %w", err)
82-
}
83-
84-
fmt.Printf("qemu-img command output: %s\n", string(rawOut))
85-
86-
time.Sleep(time.Second)
87-
}
88-
8990
return &FilesystemDataSource{
9091
readCloser: file,
9192
sourceImageSize: int64(imageInfo.VirtualSize),

0 commit comments

Comments
 (0)