Skip to content

Commit

Permalink
Update targetOs to target_os to fix packer errors (#46)
Browse files Browse the repository at this point in the history
The targetOs version of the parameter wasn't usable by packer directly,
and I received an error attempting to use the merged version of the
changes to use the 1.7 packer release. Turns out that when I rebased
onto the windows support, I failed to directly test with the same issue
reported in issue 40
[here](#40 (comment))

I fixed a couple of issues around struct tags when updating the
provisioner to support 1.7; I just happened to miss the new parameter
added with Windows support.
  • Loading branch information
frightenedmonkey authored Mar 11, 2021
1 parent 3924a44 commit e0ae859
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ There is an example packer build with goss tests in the `example/` directory.
"format": "",
"goss_file": "",
"vars_file": "",
"targetOs": "Linux",
"target_os": "Linux",
"vars_env": {
"ARCH": "amd64",
"PROVIDER": "{{user `cloud-provider`}}"
Expand All @@ -70,7 +70,7 @@ Goss spec file and debug spec file (`goss render -d`) are downloaded to `/tmp` f

## Windows support

This now has support for Windows. Set the optional parameter `targetOs` to `Windows`. Currently, the `vars_env` parameter must include `GOSS_USE_ALPHA=1` as specified in [goss's feature parity document](https://github.com/aelsabbahy/goss/blob/master/docs/platform-feature-parity.md#platform-feature-parity). In the future when goss come of of alpha for Windows this parameter will not be required.
This now has support for Windows. Set the optional parameter `target_os` to `Windows`. Currently, the `vars_env` parameter must include `GOSS_USE_ALPHA=1` as specified in [goss's feature parity document](https://github.com/aelsabbahy/goss/blob/master/docs/platform-feature-parity.md#platform-feature-parity). In the future when goss come of of alpha for Windows this parameter will not be required.

## Installation

Expand Down
2 changes: 1 addition & 1 deletion packer-provisioner-goss.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type GossConfig struct {
Password string
SkipInstall bool `mapstructure:"skip_install"`
Inspect bool
TargetOs string
TargetOs string `mapstructure:"target_os"`

// An array of tests to run.
Tests []string
Expand Down
2 changes: 1 addition & 1 deletion packer-provisioner-goss.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packer-provisioner-goss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func TestProvisioner_Prepare(t *testing.T) {
name: "Windows",
input: []interface{}{
map[string]interface{}{
"tests": []string{"example/goss"},
"targetOs": "Windows",
"tests": []string{"example/goss"},
"target_os": "Windows",
"vars_env": map[string]string{
"GOSS_USE_ALPHA": "1",
},
Expand Down Expand Up @@ -112,8 +112,8 @@ func TestProvisioner_Prepare(t *testing.T) {
name: "Windows non alpha",
input: []interface{}{
map[string]interface{}{
"tests": []string{"example/goss"},
"targetOs": "Windows",
"tests": []string{"example/goss"},
"target_os": "Windows",
},
},
wantErr: false,
Expand Down

0 comments on commit e0ae859

Please sign in to comment.