Megan Marsh
d3f48622a3
Merge pull request #9726 from acornies/feature/salt-masterless-formulas
...
Feature: salt-masterless formulas
2020-08-10 09:19:49 -07:00
Andrew Cornies
bde75c9a96
Updated implementation to go-getter/v2
...
go.mod update and go mod vendor
Signed-off-by: Andrew Cornies <acornies@gmail.com>
2020-08-10 09:41:44 -04:00
Megan Marsh
d826711e7a
File provisioner docs ( #9735 )
2020-08-10 13:15:27 +02:00
Andrew Cornies
a704e1b6b1
Updated formula regexp to support ?ref= syntax.
...
Added formulas docs for salt-masterless provisioner
Signed-off-by: Andrew Cornies <acornies@gmail.com>
2020-08-07 18:38:41 -04:00
Megan Marsh
03220c0b94
fix linting.
2020-08-07 10:53:07 -07:00
Maxim Lobanov
dd2927f871
fix bug with copying a few files in order
2020-08-07 09:38:30 +03:00
Andrew Cornies
24739270cf
Added Prepare tests around formula URLs
...
Signed-off-by: Andrew Cornies <acornies@gmail.com>
2020-08-06 14:48:25 -04:00
Maxim Lobanov
cf999e07db
fix formatting
2020-08-06 21:14:53 +03:00
Maxim Lobanov
cdd33d3ff2
proceed with next files when copy directory
2020-08-06 21:04:00 +03:00
Andrew Cornies
a2ea308881
URL format error checking
...
Signed-off-by: Andrew Cornies <acornies@gmail.com>
2020-08-06 14:02:45 -04:00
Andrew Cornies
ab52d83fb0
Functional download of formulas using gogetter
...
Signed-off-by: Andrew Cornies <acornies@gmail.com>
2020-08-06 01:22:19 -04:00
Megan Marsh
b52143f528
update docs for command and make sure they get generated properly so they appear in the docs
2020-08-05 10:30:16 -07:00
Vladislav Rassokhin
2ac9f5a276
Fixup for #8883 : interpolate in file provisioner
...
* `UploadDir` should receive interpolated `Destination`
* Render `Destination` only once
2020-08-02 21:09:47 +03:00
Artem Zavatskiy
bec367347d
ansible-provisioner: fix tests related to ssh agent
2020-07-27 14:31:32 +03:00
Artem Zavatskiy
c0048daed5
fix agent auth in ssh communicator for ansible provisioner ( #9488 )
2020-07-23 16:03:01 +03:00
Megan Marsh
8fc4e03139
quote packer build name to handle names with spaces ( #9590 )
2020-07-16 11:20:06 +02:00
Sylvia Moss
3dc7a53125
Correct check if PackerHttpAddr is implemented or not ( #9498 )
2020-06-29 16:17:21 +02:00
Simon Jones
45f81893b9
RunWithUI already calls Wait on the command
...
- Remove redundant Wait
2020-06-18 11:36:15 -04:00
Simon Jones
aaa913a484
RunWithUi sets appropriate default for stderr buffer
...
- The WinRM communicator requires that stderr is not nil
- RunWithUi will set a default stderr buffer if none is specified in the command
2020-06-18 11:36:15 -04:00
Megan Marsh
b5b8f2e308
add template option for templating the inventory file lines ( #9438 )
2020-06-17 11:05:48 +02:00
Megan Marsh
3d7c9cb9c2
make ansible provisioner docs generated from code ( #9439 )
2020-06-17 10:09:03 +02:00
Wilken Rivera
d72173ac1a
Revert "Merge pull request #9040 from hashicorp/powershell-exit-code-fix-4916"
...
This reverts commit 334f399ee3
, reversing
changes made to 45a5d28bad
.
When testing against Windows SSH the Powershell script fails to parse
the newly added if statement.
2020-06-09 11:41:07 -04:00
Megan Marsh
9699af4dee
Merge pull request #9350 from gamethis/fix_ansiblepassword
...
Fix for ansible_password
2020-06-03 15:45:11 -07:00
Lane, Larry
5976929595
Fix for #9283
2020-06-02 17:30:03 -05:00
Søren Hansen
19e4afa728
provisioner/windows-restart: Get full hostname, instead of just the NetBIOS name. ( #9335 )
...
`env:COMPUTERNAME` give you the first 15 characters of the machine name (the NetBIOS name).
But normally its pretty nice to get the full DNS name. We can solve this in this way.
2020-06-02 13:45:02 -04:00
Adrien Delorme
40947c2bf6
HCL2: generate hcl tags with go-cty tags too ( #9306 )
...
This will allow to generate the config files:
```go
package main
import (
"fmt"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/hashicorp/packer/builder/alicloud/ecs"
)
func main() {
name := "name"
app := ecs.FlatConfig{
AlicloudImageName: &name,
ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
DiskName: &name,
},
}
f := hclwrite.NewEmptyFile()
block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
f.Body().AppendBlock(block)
fmt.Printf("%s", f.Bytes())
}
```
Will output:
```
source "something" "something" {
packer_user_variables = null
packer_sensitive_variables = null
image_name = "name"
image_share_account = null
image_unshare_account = null
image_copy_regions = null
image_copy_names = null
tags = null
tag = null
system_disk_mapping = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
image_disk_mappings = null
ssh_remote_tunnels = null
ssh_local_tunnels = null
ssh_public_key = null
ssh_private_key = null
}
```
This is a good first step for #9015 and #9282
fix #9304
2020-05-28 11:19:00 +02:00
Megan Marsh
077d34f12c
Merge pull request #9279 from gamethis/fix_arg_order
...
[WIP] Anisble-Remote fix arg order
2020-05-26 16:03:31 -07:00
Adrien Delorme
a2e9439ee6
provisioner/salt-masterless: ignore the CmdArgs field in hcl2 ( #9290 )
...
fix #9233
2020-05-26 16:46:31 +02:00
Wilken Rivera
1e90165a56
Add source URL to test fixture script ( #9296 )
2020-05-26 10:24:12 -04:00
Megan Marsh
fecb040bf4
fix bug where build vars couldn't be properly interpolated into this execute command ( #9275 )
2020-05-25 11:54:27 +02:00
Lane, Larry
f4254e9cbf
updated test
2020-05-22 08:12:14 -05:00
Lane, Larry
c689eb9694
added test
2020-05-22 08:07:25 -05:00
Lane, Larry
de12432e6b
add test
2020-05-22 07:58:57 -05:00
Lane, Larry
e6670fc4a0
fix arg order
2020-05-21 21:15:13 -05:00
Wilken Rivera
2e326ef334
Switch back to call operator as opposed to dot sourcing
...
* Ensure child scope doesn't conflict with parent scope
* Add elevated user options to tests case.
2020-05-21 09:07:55 -04:00
Wilken Rivera
38f799df3e
Add conditional to check if LastExitCode is defined
...
* Add broken requires statement test case
* Add test case to reproduce invalid LastExitCode
2020-05-21 09:07:43 -04:00
Wilken Rivera
35df3914d2
provisioner/powershell: Update default execute command to handle script errors
...
This change sets the ErrorActionPreference and wraps the script execution in a Try/Catch statement so that the provisioner can capture any errors encountered when running the script. In addition to the try/catch the `&` operator is replaced by the `.` sourcing operator to ensure the script is executed in the same scope as the parent command (so that errors bubble up properly).
Tests after change
```
⇶ ACC_TEST_BUILDERS=amazon-ebs ACC_TEST_PROVISIONERS=powershell go test ./provisioner/powershell/... -timeout=1h
ok github.com/hashicorp/packer/provisioner/powershell 915.865s
```
2020-05-21 09:05:43 -04:00
Wilken Rivera
13e0c1a097
tests/provisioner/powershell: Add acceptance test to reproduce issue 4916
2020-05-21 09:05:43 -04:00
Sylvia Moss
be9dbaacd7
Interpolate generatedData in the Inspec provisioner ( #9262 )
...
* Interpolate generatedData in the Inspec provisioner
* Add inspec license section to inspec docs
* add user arg if user config it not empty
* increase resource size for check-lint pipeline
* update changelog
* Update provisioner/inspec/provisioner.go
* Update provisioner/inspec/provisioner.go
Co-authored-by: Megan Marsh <megan@hashicorp.com>
2020-05-20 15:43:41 -04:00
Sylvia Moss
1c30a71d09
Replace file shared state by statebag ( #9238 )
2020-05-19 11:49:48 +02:00
Wilken Rivera
c330d2f04c
provisioner/powershell: Update cleanup logic
...
This change reduces the retry timeout from 5m to 1m, and sets the
RetryDelay to 10s for a total of 6 retries. In additional to the retry
time reduction the cleanup script will now check to see if the
provisioner script created by Packer exists before trying to delete to
prevent any file not found issues.
Closes #9181
Closes #9189
2020-05-14 10:21:45 -04:00
Lars Lehtonen
7440c2e6ba
provisioner/windows-shell: remove unused testObjects() ( #9116 )
2020-04-27 10:50:31 +02:00
DamianBis
b679f61536
Update to make NoExitOnFailure work correctly. ( #9119 )
...
if NoExitOnFailure is true then ignore the error returned from salt.
2020-04-27 10:48:19 +02:00
Matt Kotsenas
fe55494207
Add `debug_mode` to PowerShell provisioner ( #8996 )
2020-04-17 11:39:39 +02:00
Sylvia Moss
553b1fb9f8
Add RetriedProvisioner to allow retry provisioners ( #9061 )
2020-04-16 11:58:54 +02:00
Adrien Delorme
840e67f775
HCL2: when we see a map generate an attribute spec instead of a block spec ( #9035 )
...
* mapstructure-to-hcl2: when we see a map generate an attribute spec and not a block spec
this will alow to do
tags = {
key = "value"
}
instead of
tags {
key = "value"
}
This will also enable using variables directly for those tags
* generate code
* update tests
2020-04-14 16:05:13 +02:00
Megan Marsh
73c349d09c
Merge pull request #8908 from hashicorp/fix_4795
...
provisioner/powershell: Add cleanup step to remove any temporarily created scripts
2020-04-09 08:56:19 -07:00
Lars Lehtonen
49f28c9439
provisioner/powershell: fix dropped error
...
provisioner/powershell: improve error message
2020-04-08 10:04:08 -07:00
Wilken Rivera
4a46d6ff7b
docs/provisioner/powershell: Add documentation for `skip_clean` option
2020-04-08 10:23:15 -04:00
Wilken Rivera
fe721d8e11
test/provisioner/powershell: Add acceptance test for powershell provisioner cleanup
...
Passing Tests
```
--- PASS: TestAccPowershellProvisioner_basic (282.02s)
--- PASS: TestAccPowershellProvisioner_basic/testing_amazon-ebs_builder_against_powershell_provisioner (282.01s) PASS
ok github.com/hashicorp/packer/provisioner/powershell 282.046s
```
Failing tests on master
```
2020/04/08 09:59:34 Uploading file to 'c:/Windows/Temp/script.bat'
2020/04/08 09:59:36 [INFO] starting remote command: set "PACKER_BUILDER_TYPE=amazon-ebs" && set "PACKER_BUILD_NAME=amazon-ebs"
&& "c:/Windows/Temp/script.bat"
2020/04/08 09:59:36 ui: amazon-ebs:
2020/04/08 09:59:36 ui: amazon-ebs: C:\Users\Administrator>dir C:\Windows\Temp\packer-*.ps1
2020/04/08 09:59:36 ui: amazon-ebs: Volume in drive C has no label.
2020/04/08 09:59:36 [INFO] command 'set "PACKER_BUILDER_TYPE=amazon-ebs"
&& set "PACKER_BUILD_NAME=amazon-ebs" && "c:/Windows/Temp/script.bat"' exited with code: 0
2020/04/08 09:59:36 ui: amazon-ebs: Volume Serial Number is 46CA-4083
2020/04/08 09:59:36 ui: amazon-ebs:
2020/04/08 09:59:36 ui: amazon-ebs: Directory of C:\Windows\Temp
2020/04/08 09:59:36 ui: amazon-ebs:
2020/04/08 09:59:36 ui: amazon-ebs: 04/08/2020 01:59 PM 102 packer-acc-test-script-test.ps1
2020/04/08 09:59:36 ui: amazon-ebs: 04/08/2020 01:59 PM 76 packer-acc-test-vars.ps1
2020/04/08 09:59:36 ui: amazon-ebs: 2 File(s) 178 bytes
2020/04/08 09:59:36 ui: amazon-ebs: 0 Dir(s) 9,735,806,976 bytes free
2020/04/08 09:59:36 ui: ==> amazon-ebs: Provisioning step had errors: Running the cleanup provisioner, if present...
2020/04/08 09:59:36 ui: ==> amazon-ebs: Terminating the source AWS instance...
2020/04/08 10:00:09 ui: ==> amazon-ebs: Cleaning up any extra volumes...
2020/04/08 10:00:09 ui: ==> amazon-ebs: No volumes to clean up, skipping
2020/04/08 10:00:09 ui: ==> amazon-ebs: Deleting temporary security group...
2020/04/08 10:00:10 ui: ==> amazon-ebs: Deleting temporary keypair...
2020/04/08 10:00:11 ui error: Build 'amazon-ebs' errored: Script exited
with non-zero exit status: 0.Allowed exit codes are: [1]
2020/04/08 10:00:11 machine readable: error-count []string{"1"}
2020/04/08 10:00:11 ui error:
==> Some builds didn't complete successfully and had errors:
2020/04/08 10:00:11 machine readable: amazon-ebs,error []string{"Script
exited with non-zero exit status: 0.Allowed exit codes are: [1]"}
2020/04/08 10:00:11 ui error: --> amazon-ebs: Script exited with
non-zero exit status: 0.Allowed exit codes are: [1]
```
test: Fix windows-shell command
2020-04-08 10:05:54 -04:00