builder/vmware,virtualbox: checksum_type can be "none" [GH-471]
This commit is contained in:
parent
e38c0424b9
commit
2b801a7b12
|
@ -64,7 +64,9 @@ IMPROVEMENTS:
|
||||||
* builder/virtualbox: Nice errors if Packer can't write to
|
* builder/virtualbox: Nice errors if Packer can't write to
|
||||||
the output directory.
|
the output directory.
|
||||||
* builder/virtualbox: ISO is ejected prior to export.
|
* builder/virtualbox: ISO is ejected prior to export.
|
||||||
|
* builder/virtualbox: Checksum type can be "none" [GH-471]
|
||||||
* builder/vmware: Can now specify path to the Fusion application. [GH-677]
|
* builder/vmware: Can now specify path to the Fusion application. [GH-677]
|
||||||
|
* builder/vmware: Checksum type can be "none" [GH-471]
|
||||||
* provisioner/puppet-masterless: Can now specify a `manifest_dir` to
|
* provisioner/puppet-masterless: Can now specify a `manifest_dir` to
|
||||||
upload manifests to the remote machine for imports. [GH-655]
|
upload manifests to the remote machine for imports. [GH-655]
|
||||||
|
|
||||||
|
|
|
@ -187,12 +187,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
errs, errors.New("The iso_checksum_type must be specified."))
|
errs, errors.New("The iso_checksum_type must be specified."))
|
||||||
} else {
|
} else {
|
||||||
b.config.ISOChecksumType = strings.ToLower(b.config.ISOChecksumType)
|
b.config.ISOChecksumType = strings.ToLower(b.config.ISOChecksumType)
|
||||||
|
if b.config.ISOChecksumType != "none" {
|
||||||
if h := common.HashForType(b.config.ISOChecksumType); h == nil {
|
if h := common.HashForType(b.config.ISOChecksumType); h == nil {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
errs,
|
errs,
|
||||||
fmt.Errorf("Unsupported checksum type: %s", b.config.ISOChecksumType))
|
fmt.Errorf("Unsupported checksum type: %s", b.config.ISOChecksumType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if b.config.RawSingleISOUrl == "" && len(b.config.ISOUrls) == 0 {
|
if b.config.RawSingleISOUrl == "" && len(b.config.ISOUrls) == 0 {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
|
@ -236,6 +238,12 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warnings
|
// Warnings
|
||||||
|
if b.config.ISOChecksumType == "none" {
|
||||||
|
warnings = append(warnings,
|
||||||
|
"A checksum type of 'none' was specified. Since ISO files are so big,\n"+
|
||||||
|
"a checksum is highly recommended.")
|
||||||
|
}
|
||||||
|
|
||||||
if b.config.ShutdownCommand == "" {
|
if b.config.ShutdownCommand == "" {
|
||||||
warnings = append(warnings,
|
warnings = append(warnings,
|
||||||
"A shutdown_command was not specified. Without a shutdown command, Packer\n"+
|
"A shutdown_command was not specified. Without a shutdown command, Packer\n"+
|
||||||
|
|
|
@ -383,6 +383,21 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("should have error")
|
t.Fatal("should have error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test none
|
||||||
|
config["iso_checksum_type"] = "none"
|
||||||
|
b = Builder{}
|
||||||
|
warns, err = b.Prepare(config)
|
||||||
|
if len(warns) == 0 {
|
||||||
|
t.Fatalf("bad: %#v", warns)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("should not have error: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.config.ISOChecksumType != "none" {
|
||||||
|
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuilderPrepare_ISOUrl(t *testing.T) {
|
func TestBuilderPrepare_ISOUrl(t *testing.T) {
|
||||||
|
|
|
@ -218,12 +218,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
errs, errors.New("The iso_checksum_type must be specified."))
|
errs, errors.New("The iso_checksum_type must be specified."))
|
||||||
} else {
|
} else {
|
||||||
b.config.ISOChecksumType = strings.ToLower(b.config.ISOChecksumType)
|
b.config.ISOChecksumType = strings.ToLower(b.config.ISOChecksumType)
|
||||||
|
if b.config.ISOChecksumType != "none" {
|
||||||
if h := common.HashForType(b.config.ISOChecksumType); h == nil {
|
if h := common.HashForType(b.config.ISOChecksumType); h == nil {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
errs,
|
errs,
|
||||||
fmt.Errorf("Unsupported checksum type: %s", b.config.ISOChecksumType))
|
fmt.Errorf("Unsupported checksum type: %s", b.config.ISOChecksumType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if b.config.RawSingleISOUrl == "" && len(b.config.ISOUrls) == 0 {
|
if b.config.RawSingleISOUrl == "" && len(b.config.ISOUrls) == 0 {
|
||||||
errs = packer.MultiErrorAppend(
|
errs = packer.MultiErrorAppend(
|
||||||
|
@ -270,6 +272,12 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warnings
|
// Warnings
|
||||||
|
if b.config.ISOChecksumType == "none" {
|
||||||
|
warnings = append(warnings,
|
||||||
|
"A checksum type of 'none' was specified. Since ISO files are so big,\n"+
|
||||||
|
"a checksum is highly recommended.")
|
||||||
|
}
|
||||||
|
|
||||||
if b.config.ShutdownCommand == "" {
|
if b.config.ShutdownCommand == "" {
|
||||||
warnings = append(warnings,
|
warnings = append(warnings,
|
||||||
"A shutdown_command was not specified. Without a shutdown command, Packer\n"+
|
"A shutdown_command was not specified. Without a shutdown command, Packer\n"+
|
||||||
|
|
|
@ -98,7 +98,23 @@ func TestBuilderPrepare_ISOChecksumType(t *testing.T) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("should have error")
|
t.Fatal("should have error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test none
|
||||||
|
config["iso_checksum_type"] = "none"
|
||||||
|
b = Builder{}
|
||||||
|
warns, err = b.Prepare(config)
|
||||||
|
if len(warns) == 0 {
|
||||||
|
t.Fatalf("bad: %#v", warns)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("should not have error: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.config.ISOChecksumType != "none" {
|
||||||
|
t.Fatalf("should've lowercased: %s", b.config.ISOChecksumType)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuilderPrepare_Defaults(t *testing.T) {
|
func TestBuilderPrepare_Defaults(t *testing.T) {
|
||||||
var b Builder
|
var b Builder
|
||||||
config := testConfig()
|
config := testConfig()
|
||||||
|
|
|
@ -54,7 +54,10 @@ Required:
|
||||||
checksum is specified with `iso_checksum_type`, documented below.
|
checksum is specified with `iso_checksum_type`, documented below.
|
||||||
|
|
||||||
* `iso_checksum_type` (string) - The type of the checksum specified in
|
* `iso_checksum_type` (string) - The type of the checksum specified in
|
||||||
`iso_checksum`. Valid values are "md5", "sha1", "sha256", or "sha512" currently.
|
`iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or
|
||||||
|
"sha512" currently. While "none" will skip checksumming, this is not
|
||||||
|
recommended since ISO files are generally large and corruption does happen
|
||||||
|
from time to time.
|
||||||
|
|
||||||
* `iso_url` (string) - A URL to the ISO containing the installation image.
|
* `iso_url` (string) - A URL to the ISO containing the installation image.
|
||||||
This URL can be either an HTTP URL or a file URL (or path to a file).
|
This URL can be either an HTTP URL or a file URL (or path to a file).
|
||||||
|
|
|
@ -55,7 +55,10 @@ Required:
|
||||||
checksum is specified with `iso_checksum_type`, documented below.
|
checksum is specified with `iso_checksum_type`, documented below.
|
||||||
|
|
||||||
* `iso_checksum_type` (string) - The type of the checksum specified in
|
* `iso_checksum_type` (string) - The type of the checksum specified in
|
||||||
`iso_checksum`. Valid values are "md5", "sha1", "sha256", or "sha512" currently.
|
`iso_checksum`. Valid values are "none", "md5", "sha1", "sha256", or
|
||||||
|
"sha512" currently. While "none" will skip checksumming, this is not
|
||||||
|
recommended since ISO files are generally large and corruption does happen
|
||||||
|
from time to time.
|
||||||
|
|
||||||
* `iso_url` (string) - A URL to the ISO containing the installation image.
|
* `iso_url` (string) - A URL to the ISO containing the installation image.
|
||||||
This URL can be either an HTTP URL or a file URL (or path to a file).
|
This URL can be either an HTTP URL or a file URL (or path to a file).
|
||||||
|
|
Loading…
Reference in New Issue