add virt
This commit is contained in:
35
lib/virt/herocontainers/image.v
Normal file
35
lib/virt/herocontainers/image.v
Normal file
@@ -0,0 +1,35 @@
|
||||
module herocontainers
|
||||
|
||||
import freeflowuniverse.herolib.osal { exec }
|
||||
import time
|
||||
import freeflowuniverse.herolib.virt.utils
|
||||
import freeflowuniverse.herolib.ui.console
|
||||
// TODO: needs to be implemented for buildah, is still code from docker
|
||||
|
||||
@[heap]
|
||||
pub struct Image {
|
||||
pub mut:
|
||||
repo string
|
||||
id string
|
||||
id_full string
|
||||
tag string
|
||||
digest string
|
||||
size int // size in MB
|
||||
created time.Time
|
||||
engine &CEngine @[skip; str: skip]
|
||||
}
|
||||
|
||||
// delete podman image
|
||||
pub fn (mut image Image) delete(force bool) ! {
|
||||
mut forcestr := ''
|
||||
if force {
|
||||
forcestr = '-f'
|
||||
}
|
||||
exec(cmd: 'podman rmi ${image.id} ${forcestr}', stdout: false)!
|
||||
}
|
||||
|
||||
// export podman image to tar.gz
|
||||
pub fn (mut image Image) export(path string) !string {
|
||||
exec(cmd: 'podman save ${image.id} > ${path}', stdout: false)!
|
||||
return ''
|
||||
}
|
||||
Reference in New Issue
Block a user