Merge pull request #84 from ddelnano/ddelnano/allow-not-specifying-xs-tools

Allow users to specify if xs tools should be managed by packer or not
This commit is contained in:
Dom Del Nano 2023-07-07 08:08:21 -07:00 committed by GitHub
commit 524ef18847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 25 deletions

View File

@ -76,10 +76,6 @@ func (c *CommonConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig
c.RawBootWait = "5s" c.RawBootWait = "5s"
} }
if c.ToolsIsoName == "" {
c.ToolsIsoName = "xs-tools.iso"
}
if c.HTTPPortMin == 0 { if c.HTTPPortMin == 0 {
c.HTTPPortMin = 8000 c.HTTPPortMin = 8000
} }

View File

@ -4,21 +4,20 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/common" "github.com/hashicorp/packer-plugin-sdk/common"
"github.com/hashicorp/packer-plugin-sdk/packer"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"remote_host": "localhost", "remote_host": "localhost",
"remote_username": "admin", "remote_username": "admin",
"remote_password": "admin", "remote_password": "admin",
"vm_name": "foo", "vm_name": "foo",
"iso_checksum": "md5:A221725EE181A44C67E25BD6A2516742", "iso_checksum": "md5:A221725EE181A44C67E25BD6A2516742",
"iso_url": "http://www.google.com/", "iso_url": "http://www.google.com/",
"shutdown_command": "yes", "shutdown_command": "yes",
"ssh_username": "foo", "ssh_username": "foo",
common.BuildNameConfigKey: "foo", common.BuildNameConfigKey: "foo",
} }
@ -43,7 +42,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
t.Fatalf("should not have error: %s", err) t.Fatalf("should not have error: %s", err)
} }
if b.config.ToolsIsoName != "xs-tools.iso" { if b.config.ToolsIsoName != "" {
t.Errorf("bad tools ISO name: %s", b.config.ToolsIsoName) t.Errorf("bad tools ISO name: %s", b.config.ToolsIsoName)
} }
@ -201,10 +200,8 @@ func TestBuilderPrepare_ISOChecksum(t *testing.T) {
t.Fatal("should have error") t.Fatal("should have error")
} }
} }
func TestBuilderPrepare_ISOUrl(t *testing.T) { func TestBuilderPrepare_ISOUrl(t *testing.T) {
var b Builder var b Builder
config := testConfig() config := testConfig()

View File

@ -3,8 +3,8 @@ package xva
import ( import (
"testing" "testing"
"github.com/hashicorp/packer-plugin-sdk/packer"
"github.com/hashicorp/packer-plugin-sdk/common" "github.com/hashicorp/packer-plugin-sdk/common"
"github.com/hashicorp/packer-plugin-sdk/packer"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
@ -40,7 +40,7 @@ func TestBuilderPrepare_Defaults(t *testing.T) {
t.Fatalf("should not have error: %s", err) t.Fatalf("should not have error: %s", err)
} }
if b.config.ToolsIsoName != "xs-tools.iso" { if b.config.ToolsIsoName != "" {
t.Errorf("bad tools ISO name: %s", b.config.ToolsIsoName) t.Errorf("bad tools ISO name: %s", b.config.ToolsIsoName)
} }

View File

@ -133,6 +133,9 @@ each category, the available options are alphabetized and described.
must point to the same file (same checksum). By default this is empty must point to the same file (same checksum). By default this is empty
and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified. and `iso_url` is used. Only one of `iso_url` or `iso_urls` can be specified.
* `tools_iso_name` (string) - Choose the tools iso you want to use.
Usually "guest-tools.iso", or "xs-tools.iso". Not setting this variable won't plug any tools.
* `keep_vm` (string) - Determine when to keep the VM and when to clean it up. This * `keep_vm` (string) - Determine when to keep the VM and when to clean it up. This
can be "always", "never" or "on_success". By default this is "never", and Packer can be "always", "never" or "on_success". By default this is "never", and Packer
always deletes the VM regardless of whether the process succeeded and an artifact always deletes the VM regardless of whether the process succeeded and an artifact

View File

@ -1,6 +0,0 @@
{
"builders": [{
"type": "xenserver-iso",
"tools_iso_name": "guest-tools.iso"
}]
}