mirror of
https://github.com/outbackdingo/debos.git
synced 2026-01-27 18:18:45 +00:00
actions/image-partition: Consistently use artifactdir
The "image-partition" action uses artifactdir in the PostMachineCleanup() step but not during the PreMachine() and PreNoMachine() steps. Also, other debos actions such as pack, unpack are relative to the specified "artifactdir" when invoking debos. Fix this inconsistency by bringing image-partition action to the fold. Also update the documentation to clarify this. Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
This commit is contained in:
committed by
Sjoerd Simons
parent
0dec131ed3
commit
a7afc01562
@@ -20,7 +20,7 @@ Yaml syntax:
|
||||
|
||||
Mandatory properties:
|
||||
|
||||
- imagename -- the name of the image file.
|
||||
- imagename -- the name of the image file, relative to the artifact directory.
|
||||
|
||||
- imagesize -- generated image size in human-readable form, examples: 100MB, 1GB, etc.
|
||||
|
||||
@@ -287,7 +287,8 @@ func (i *ImagePartitionAction) triggerDeviceNodes(context *debos.DebosContext) e
|
||||
|
||||
func (i ImagePartitionAction) PreMachine(context *debos.DebosContext, m *fakemachine.Machine,
|
||||
args *[]string) error {
|
||||
image, err := m.CreateImage(i.ImageName, i.size)
|
||||
ImagePath := path.Join(context.Artifactdir, i.ImageName)
|
||||
image, err := m.CreateImage(ImagePath, i.size)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -367,7 +368,8 @@ func (i ImagePartitionAction) formatPartition(p *Partition, context debos.DebosC
|
||||
|
||||
func (i *ImagePartitionAction) PreNoMachine(context *debos.DebosContext) error {
|
||||
|
||||
img, err := os.OpenFile(i.ImageName, os.O_WRONLY|os.O_CREATE, 0666)
|
||||
ImagePath = path.Join(context.Artifactdir, i.ImageName)
|
||||
img, err := os.OpenFile(ImagePath, os.O_WRONLY|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Couldn't open image file: %v", err)
|
||||
}
|
||||
@@ -379,7 +381,7 @@ func (i *ImagePartitionAction) PreNoMachine(context *debos.DebosContext) error {
|
||||
|
||||
img.Close()
|
||||
|
||||
i.loopDev, err = losetup.Attach(i.ImageName, 0, false)
|
||||
i.loopDev, err = losetup.Attach(ImagePath, 0, false)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to setup loop device")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user