a12c5d57ec
Squashed commit of the following: commit 372db94a5c4bc81bd4149de5ea9c21946362f3f9 Author: Yandex.Cloud Bot <ycloud-bot@yandex.ru> Date: Thu Apr 4 13:16:03 2019 +0000 sync upstream
23 lines
569 B
Go
23 lines
569 B
Go
package yandex
|
|
|
|
import (
|
|
"github.com/c2h5oh/datasize"
|
|
"github.com/hashicorp/packer/helper/multistep"
|
|
"github.com/hashicorp/packer/packer"
|
|
)
|
|
|
|
func stepHaltWithError(state multistep.StateBag, err error) multistep.StepAction {
|
|
ui := state.Get("ui").(packer.Ui)
|
|
state.Put("error", err)
|
|
ui.Error(err.Error())
|
|
return multistep.ActionHalt
|
|
}
|
|
|
|
func toGigabytes(bytesCount int64) int {
|
|
return int((datasize.ByteSize(bytesCount) * datasize.B).GBytes())
|
|
}
|
|
|
|
func toBytes(gigabytesCount int) int64 {
|
|
return int64((datasize.ByteSize(gigabytesCount) * datasize.GB).Bytes())
|
|
}
|