Commit Graph

17 Commits

Author SHA1 Message Date
Sander van Harmelen 0e422737ba Fix and refactor the Chef provisioner
The tests did pass, but that was because they only tested part of the changes. By using the `schema.TestResourceDataRaw` function the schema and config are better tested and so they pointed out a problem with the schema of the Chef provisioner.

The `Elem` fields did not have a `*schema.Schema` but a `schema.Schema` and in an `Elem` schema only the `Type` field may (and must) be set. Any other fields like `Optional` are not allowed here.

Next to fixing that problem I also did a little refactoring and cleaning up. Mainly making the `ProvisionerS` private (`provisioner`) and removing the deprecated fields.
2017-05-19 21:05:21 +02:00
Vladislav Rassokhin f5449a62e0 Various built-in provisioners improvements:
1. Migrate `chef` provisioner to `schema.Provisioner`:

 * `chef.Provisioner` structure was renamed to `ProvisionerS`and  now it's decoded from `schema.ResourceData` instead of `terraform.ResourceConfig` using simple copy-paste-based solution;
 * Added simple schema without any validation yet.

 2. Support `ValidateFunc` validate function : implemented in `file` and `chef` provisioners.
2017-05-19 20:43:51 +02:00
Sander van Harmelen 7304fe5c14 Make sure we add new Chef-Vault clients as clients (#13525)
This is possible using the newly released Chef-Vault 3.0 gem. Before we could only add new clients as admins.

Fixes #9137
2017-04-11 10:36:05 +02:00
Mitchell Hashimoto 5fc516f99d
provisioners/chef: check IsComputed for JSON attributes
Fixes #10788

This checks `IsComputed` prior to attempting to use the JSON
configurations. Due to a change in 0.8, the prior check for simply map
existence would always succeed even with a computed value (as designed),
but we forgot to update provisioners to not do that.

There are other provisioners that also do this but to no ill effect
currently. I've only changed Chef since we know that is an issue.

This issue doesn't affect 0.9 due to helper/schema doing this
automatically for provisioners.
2017-01-29 12:30:44 -08:00
Sander van Harmelen c307dc9557 Accept both slices and strings in vault_json (#9114)
Fixes #9105 by allowing the `vault_json` to contain either slices or strings.

And fixes #8932 by changing to way we cleanup the user key.
2016-10-01 00:35:27 +02:00
Sander van Harmelen 968472a63e Support recreating clients and configuring Chef Vaults (#8577)
Fixes #3605 and adds the functionality suggested in PR #7440.

This PR is using a different appraoch that (IMHO) feels cleaner and (even more important) adds support for Windows at the same time.
2016-09-15 14:20:18 +02:00
Sander van Harmelen 79e2642dab Fix issue #4881
This fixes issue #4881 by adding an option to fetch the Chef SSL
certificates.
2016-02-04 15:31:24 +01:00
Sander van Harmelen da927fcd08 Make the Chef `attributes` param also accept a raw JSON string
See the updated docs for more details and examples, but in short this
enables the `attributes` param from the Chef provisioner to accept a
raw JSON string.

Fixes #3074
Fixes #3572
2016-01-29 18:41:14 +01:00
Paul Hinze 73ce6d184a chef: read key contents instead of paths
Builds on the work of #3846, shifting the Chef provisioner's
configuration options from `secret_key_path` and `validation_key_path`
over to `secret_key` and `validation_key`.
2015-11-12 16:11:44 -06:00
Sander van Harmelen 4a8ef78d33 Fixes #2676 by prefixing all Windows commands
By prefixing them with `cmd /c` it will work with both `winner` and
`ssh` connection types.

This PR also reverts some bad stringer changes made in PR #2673
2015-07-10 12:56:27 +02:00
Sander van Harmelen 97fd4f5b7d Tweaking the tests 2015-07-09 21:29:27 +02:00
Joshua Seidel 4070805fcd ran gofmt removed required, added IF 2015-07-09 09:05:12 -04:00
Joshua Seidel 090248fab1 fix errors 2015-07-08 19:41:38 -04:00
Joshua Seidel 6e21ca50a0 add chef secret key 2015-07-08 14:52:23 -04:00
Sander van Harmelen 61517f68b1 Add an `ohai_hints` option to upload hint files
This option takes a list of hints that will be uploaded to the new node
before starting the initial Chef run.
2015-06-25 16:32:36 +02:00
Sander van Harmelen 11314a3d71 Tweaking a few minor things according to the feedback on GH 2015-05-12 10:37:38 +02:00
Sander van Harmelen c19d92fb67 Refactored quite a few things after review...
Also renamed the provisioner to just `chef` as it’s out intention to
end up with one provisioner for all types of `chef` clients.
2015-05-08 23:25:24 +02:00