Commit Graph

173 Commits

Author SHA1 Message Date
Alex Pilon c993fc3c1b
better error handling for type assertions 2019-08-06 20:49:55 -04:00
Alex Pilon 4bf43efcfd
move hcl2shim package to configs 2019-08-06 19:58:58 -04:00
Alex Pilon d1448fc319
restore test
switch provisioner validation to cast to []interface{} first
2019-08-05 22:08:04 -04:00
Alex Pilon 83aa07f907
prune NewResourceConfig and update tests 2019-08-05 22:08:03 -04:00
Pam Selle 291cf8c5a4
Revert "Habitat License Acceptance changes. " 2019-08-05 12:43:55 -04:00
Pam Selle 9020636f93
Merge pull request #21345 from mudash/master
Habitat License Acceptance changes.
2019-08-05 12:40:34 -04:00
Alex Pilon 7f8f198719
remove UnknownVariabeValue from config and update references to shim 2019-07-17 22:41:24 -04:00
Radek Simko 5b9f2fafc8 Standardise directory name for test data 2019-06-30 10:16:15 +02:00
Tim Sharpe 615110e13e provisioner: new Puppet provisioner (#18851)
* Basic Puppet provisioner

* (fixup) fix snake_case use in Bolt

* (fixup) Remove unused ValidateFunc

* (fixup) Check bolt result status

* (lint) go fmt

* Requested changes

* Remove PE autodetection

* Apply suggestions from @svanharmelen

Co-Authored-By: rodjek <tim@sharpe.id.au>

* Tag all JSON fields in bolt output

* Defer comm.Disconnect() as suggested

* Make bolt timeout configurable

* Update builtin/provisioners/puppet/resource_provisioner.go

Co-Authored-By: rodjek <tim@sharpe.id.au>

* Make extension_requests and custom_attributes configurable
2019-06-10 15:31:21 -04:00
Mudassar Shafique 258319e6b0 Adding a comment to explain a testcase 2019-06-05 13:52:53 -07:00
Mudassar Shafique e78658de4c Habitat License Acceptance changes. These changes add a new argument that allows users to accept Habitat End User License. 2019-05-16 16:55:07 -07:00
Jurnell Cockhren 1242e08473 fix(salt-masterless): Compare retrieved variable values with defaults 2019-02-14 18:13:16 -08:00
Jurnell Cockhren 996f845d4b fix(salt-masterless): set the default values for state and pillar remote locations 2019-02-14 18:13:16 -08:00
Sander van Harmelen 56e6c60f76
Merge pull request #18533 from alice-sawatzky/master
change chef linux provisioner to use user:group chown syntax
2018-10-11 10:29:01 +02:00
Sean Chittenden d749420a25
Fix drift caused from gofmt when running make dev and go 1.11.
A fresh checkout of `origin/master` does not build atm using the `dev`
target because `master` has not been formatted using `gofmt` from Go
1.11 (tis has been the case for a while if you've been running devel).

None of the drift in question is especially new but now that Go 1.11
has been released and gofmt's formatting guidelines have been updated,
it would be *really* nice if the code in `master` reflected the current
tooling in order to avoid having to fight this drift locally.

* 8mo: https://github.com/hashicorp/terraform/blame/master/backend/remote-state/s3/backend_test.go#L260-L261
* 6mo: https://github.com/hashicorp/terraform/blame/master/builtin/provisioners/chef/linux_provisioner_test.go#L124
* 1yr: 7cfeffe36b/command/init.go (L75-L76)
* 12d: 7cfeffe36b/command/meta_backend_test.go (L1437)
* 2yr: 7cfeffe36b/helper/schema/resource_timeout_test.go (L26)
* 4yr: 7cfeffe36b/helper/schema/schema_test.go (L2059)
* 1yr: 7cfeffe36b/plugin/discovery/get_test.go (L151)
2018-09-09 10:18:08 -07:00
Alice Sawatzky 15c65f981b
change chef linux provisioner to use user:group chown syntax 2018-07-24 19:12:40 -05:00
Skyler Layne d1124a4e3d
Update resource_provisioner.go
fix spacing for service url.
2018-07-05 15:37:42 -04:00
Andre Bindewald de43f01d65 provisioner/local-exec: Support custom environment variables on Windows
Due to an incorrect slice allocation, the environment variable list was created with an empty string
element for each real element added.

It appears that this was silently ignored on Unix, but caused the following environment settings
to be ignored altogether on Windows.
2018-06-15 18:26:43 -07:00
James Bardin f8b691f743
Merge pull request #17781 from hashicorp/jbardin/habitat
`enable` habitat supervisor service before `start`
2018-04-05 08:43:50 -04:00
James Bardin c1edaadc7b
Merge pull request #17403 from rwc/hab-provisioner-updates
[provisioner-habitat] Fix package channel honoring and documentation
2018-04-04 16:55:24 -04:00
Marko Springfeldt a201b04b26 `enable` habitat supervisor service before `start`
Signed-off-by: Arash Zandi <arash.zandi@smartb.eu>
2018-04-04 16:51:26 -04:00
James Bardin e9e4ee4940
Merge pull request #17609 from hashicorp/jbardin/remote-command
clean up remote.Cmd api
2018-03-23 17:34:06 -04:00
James Bardin ad8642e2c2 have remote.ExitError format errors and status
Since all use cases of ExitStatus are just putting it into fmt.Errorf,
usually with the command string, have ExitStatus do that for the caller.
2018-03-23 11:36:57 -04:00
James Bardin 56acda00bc add timeout test to remote-exec
Add a test to remote-exec to make sure the proper timeout is honored
during apply.

TODO: we need some test helpers for provisioners, so they can all be
verified.
2018-03-20 14:24:01 -04:00
James Bardin 9b4b5f2a72 use correct context for communicator.Retry
The timeout for a provisioner is expected to only apply to the initial
connection. Keep the context for the communicator.Retry separate from
the global cancellation context.
2018-03-20 13:06:28 -04:00
Scott Hain 07aeea51da Updates the chef provisioner to allow specifying a channel (#17355)
* Updates the chef provisioner to allow specifying a channel

This also updates the omnitruck url to the current url.

Signed-off-by: Scott Hain <shain@chef.io>

* Update omnitruck URL

Signed-off-by: Scott Hain <shain@chef.io>
2018-03-20 11:51:14 +01:00
James Bardin 3fbdee0777 clean up remote.Cmd api
Combine the ExitStatus and Err values from remote.Cmd into an error
returned by Wait, better matching the behavior of the os/exec package.

Non-zero exit codes are returned from Wait as a remote.ExitError.
Communicator related errors are returned directly.

Clean up all the error handling in the provisioners using a
communicator. Also remove the extra copyOutput synchronization that was
copied from package to package.
2018-03-16 14:29:48 -04:00
James Bardin a1061ed931 update the chef and habitat error handling
Use the new ExitStatus method, and also check the cmd.Err() method for
errors.

Remove leaks from the output goroutines in both provisioners by
deferring their cleanup, and returning early on all error conditions.
2018-03-15 16:04:05 -04:00
James Bardin a715430d24 fix exit status handling in salt-masterless
Convert to the new Cmd.ExitStatus() method in the salt-masterless
provisioner. Add calls to Wait and remove race conditions around setting
the status.
2018-03-15 16:04:00 -04:00
James Bardin af132a186d remove timeout from remote-exec command context
The timeout for the remote command was taken from the wrong config
field, and the connection timeout was being used which is 5 min. Any
remote command taking more than 5 min would be terminated by
disconnecting the communicator. Remove the timeout from the context, and
rely on the global timeout provided by terraform.

There was no way to get the error from the communicator previously, so
the broken connection was silently ignored and the provisioner returned
successfully. Now we can use the new cmd.Err() method to retrieve any
errors encountered during execution.
2018-03-15 16:03:40 -04:00
Kristiyan Nikolov 999f9096c1 provisioner/local-exec: Allow passing environment variables 2018-03-05 15:58:49 -08:00
Paweł Socha be8d39210d Wait for ssh connection 2018-02-26 15:40:26 +01:00
Paweł Socha 627bb24ea6 fix ssh problem with communicator.Retry 2018-02-26 10:27:14 +01:00
Rob Campbell bbd3d7f7a2 Updates the capitalization of the bind documenation for habitat
provisioner. Also fixes an issue where channels and URLs are
not honored in the initial package install.

Signed-off-by: Rob Campbell <rcampbell@chef.io>
2018-02-21 11:47:45 -05:00
chrisjob1021 10bb21e9c4 provisioner/local-exec: Optional "working_dir" argument
This new argument allows overriding of the working directory of the child process, with the default still being the working directory of Terraform itself.
2018-02-16 11:31:11 -08:00
James Bardin 0345d960b2 simplify remote-exec runScripts
There no reason to retry around the execution of remote scripts. We've
already established a connection, so the only that could happen here is
to continually retry uploading or executing a script that can't succeed.

This also simplifies the streaming output from the command, which
doesn't need such explicit synchronization. Closing the output pipes is
sufficient to stop the copyOutput functions, and they don't close around
any values that are accessed again after the command executes.
2018-02-15 16:14:38 -05:00
James Bardin c1b35ad69b have the ssh communicator return fatal errors
This will let the retry loop abort when there are errors which aren't
going to ever be corrected.
2018-02-15 16:14:33 -05:00
James Bardin e331ae9842 remove retryFunc
it's now in the communicator package
2018-02-14 18:32:29 -05:00
James Bardin d02250c2b9 remove retryFunc
it's now in the communicator package
2018-02-14 18:30:20 -05:00
James Bardin 89a0ac6e89 remove retryFunc
It's now in the communicator package
2018-02-14 18:25:05 -05:00
James Bardin f5b8091e2c remove retryFunc
It's now in the communicator package
2018-02-14 18:21:26 -05:00
Nolan Davidson f43e592849 [provisioner-habitat] Detect if hab user exists (#17195)
Currently the provisioner will fail if the `hab` user already exists on
the target system.

This adds a check to see if we need to create the user before trying to
add it.

Fixes #17159

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2018-02-13 14:13:22 -06:00
Nolan Davidson 848375b9a6 [provisioner-habitat] Allow custom service name (#17196)
This change allows the Habitat supervisor service name to be
configurable. Currently it is hard coded to `hab-supervisor`.

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2018-02-13 14:11:59 -06:00
Jeremiah Snapp 7595e27772 Fix chef provisioner validateFn
Correctly validate Chef provisioner's `use_policyfile`
field even if its value is a string type.

Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
2018-01-25 09:24:05 -05:00
Masayuki Morita f440dba137 Standardize on log level "WARN" rather than "WARNING" 2018-01-16 18:05:26 -08:00
James Bardin 4b49a323c3 go fmt
slight change to go fmt coming in 0.10
2017-12-26 13:26:38 -05:00
Rob Campbell 29f70bc112 Adds build_auth_token to Habitat Provisioner
First successful run with private origin and HAB_AUTH_TOKEN set

Update struct, schema, and decodeConfig names to more sensible versions

Cleaned up formatting

Update habitat provisioner docs

Remove unused unitstring
2017-12-12 19:46:42 -05:00
Nolan Davidson a50a383946 Additional work on the habitat provisioner.
Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-12-07 16:29:30 -08:00
Nolan Davidson 653db95df7 Initial implementation of a habitat provisioner
First pass at loading the config data using the TF schema.

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2017-12-07 16:29:30 -08:00
Subba Rao Pasupuleti 44cb98e04f provisioner/salt-masterless: Wait for operations to complete
Previously the provisioner did not wait until the Salt operation had completed before returning, causing some operations not to be applied, and causing the output to get swallowed.

Now we wait until the remote work is complete, and copy output into the Terraform log in a similar way as is done for other provisioners.
2017-12-05 09:26:40 -08:00