Commit Graph

21703 Commits

Author SHA1 Message Date
James Bardin 798df9dafa make sure ResourceData timeouts are always set
Return the global default timeout if the ResourceData timeouts are nil.

Set the timeouts from the Resource when calling Resource.Data, so that
the config values are always available.
2018-03-22 15:10:43 -04:00
James Bardin a24ace68c8 release: clean up after v0.11.5 2018-03-21 21:23:40 +00:00
James Bardin 3b18741004 Merge branch 'master' into stable-website 2018-03-21 21:22:18 +00:00
James Bardin 342c529aa5
v0.11.5 2018-03-21 21:05:10 +00:00
James Bardin 4cdb6dff0b update CHANGELOG.md 2018-03-21 17:02:41 -04:00
James Bardin 47b178aee9
Merge pull request #17645 from hashicorp/jbardin/GH-17462
unlock state in console, import, graph, and push
2018-03-21 12:26:05 -04:00
Sébastien Maccagnoni 31f2e6a463 website: Correct descriptions on provider category pages 2018-03-21 09:17:24 -07:00
James Bardin 90a75422fb unlock state in console, import, graph, and push
The state locking improvements for the regular command had the side
effect of locking the state in the console, import, graph and push
commands. Those commands had been updated to get a state via the
Backend.Context method, which locks the state whenever possible, and now
need to call Unlock directly.

Add Unlock calls to all commands that call Context directly.
2018-03-21 12:13:40 -04:00
Paweł Socha e4b0a989f3 Use build-in method to get user homedir instead of eval on sh 2018-03-21 14:55:56 +01:00
James Bardin 40421c30e3
Merge pull request #17646 from hashicorp/jbardin/GH-17638
use correct context for communicator.Retry
2018-03-21 08:34:17 -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 2954d9849a add some more functionality to MockCommunicator 2018-03-20 14:23:32 -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
James Bardin 38e6309f03
Merge pull request #17642 from hashicorp/jbardin/GH-17462
remove more unneeded partial outputs
2018-03-20 11:11:54 -04:00
Brian Flad 5bc83aa111
Merge pull request #17639 from vlad-ro/master
Minor grammar fix.
2018-03-20 07:37:22 -04:00
Sander van Harmelen 36777e3022
Add a line to describe the new Chef provisioner option (#17640) 2018-03-20 12:16:17 +01:00
Sander van Harmelen 45ed0e1f44
Update CHANGELOG.md 2018-03-20 11:55:49 +01: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 a5c4f7e08e remove unneeded partial outputs
filterPartialOutputs was not taking into account that some dependent
resources might yet be removed from the graph. Check that they are not
in the targeted set before declaring that the output remain.
2018-03-19 21:20:06 -04:00
James Bardin e5f8adfc1a add failing test for invalid output with targets
Outputs that are missing references aren't always removed from the
graph, due to being filtered before their dependents are removed.
2018-03-19 20:32:37 -04:00
James Bardin 6b6b92f6b3
Merge pull request #17636 from hashicorp/jbardin/windows-refresh-lock
Don't open a new file descriptor for a locked state.
2018-03-19 19:17:12 -04:00
James Bardin a84b4a669a use the open state file for refresh when possible
Only open a new file descriptor for RefreshState if we haven't written a
state, and don't have the correct state open already. This prevents
windows from failing to refresh a locked state.
2018-03-19 18:17:43 -04:00
James Bardin 8fb8b2cffc make sure ReadState returns an error
ReadState would hide any errors, assuming that it was an empty state.
This can mask errors on Windows, where the OS enforces read locks on the
state file.
2018-03-19 18:17:25 -04:00
James Bardin e10a7917e6 add failing test for windows state locks
Refreshing a locked state on windows could return nil if the read path
was locked, no state was yet written, and the read path is the same as
the write path.

Add a test that locks then refreshes a newly initialized state struct.
2018-03-19 17:09:53 -04:00
Brian Flad edd68950c9
Merge pull request #17616 from lrakai/master
Typo Correction
2018-03-19 06:30:03 -04:00
Outsider 815d4db368
website: remove an unnecessary parameter for API 2018-03-18 19:02:05 +09:00
Logan Rakai dd935588f7
Typo Correction 2018-03-18 00:01:30 -06:00
ScottWinkler 60bc16305a tools/terraform-bundle: accept custom plugins from a local directory
To make it easier to include third-party plugins in generated bundles, we'll now search a local directory for available plugins and skip attempting to install from releases.hashicorp.com if a dependency can be satisfied locally.
2018-03-16 16:28:58 -07: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 a20dbb4378
Merge pull request #17607 from JoshCooley/patch-1
Spelling correction
2018-03-16 14:21:58 -04:00
Paul Tyng 5fe745b977
Merge pull request #17591 from hashicorp/pt/tfeua
Allow callers to append to user agent
2018-03-16 11:12:24 -04:00
Josh Cooley 426045eb2e
Spelling correction 2018-03-16 09:59:33 -05:00
James Bardin ecec59f0f0 udpate CHANGELOG.md
remove redundant entry.
2018-03-15 17:06:57 -04:00
James Bardin c4e5de7115 release: clean up after v0.11.4 2018-03-15 20:52:58 +00:00
James Bardin 9578557f8f Merge branch 'master' into stable-website 2018-03-15 20:50:52 +00:00
James Bardin 7878d66b38
v0.11.4 2018-03-15 20:35:34 +00:00
Brian Flad c565eb8e7a
Update CHANGELOG for #17484 2018-03-15 16:23:28 -04:00
Brian Flad 077b828902
Merge pull request #17484 from hashicorp/f-validation-ValidateRFC3339TimeString
validation: Add ValidateRFC3339TimeString
2018-03-15 16:22:04 -04:00
James Bardin a17f79167d
Merge pull request #17596 from hashicorp/jbardin/remote-exec-error
fix improper remote-exec timeout and communicator error handling
2018-03-15 16:12:29 -04:00
James Bardin 88e911af45 fix a provisionerFail test which was incorrect
The provisionerFail_createBeforeDestroy test was verifying the incorrect
output. The create_before_destroy instance in the state has an ID of
"bar" with require_new="abc", and a new instance would get an ID of
"foo" with require_new="xyz". The existing test was expecting the
following state:

aws_instance.bar: (1 deposed)
  ID = bar
  provider = provider.aws
  require_new = abc
  Deposed ID 1 = foo (tainted)

Which showed "bar" still the primary instance in the state, with the new
instance "foo" as being the deposed instance, though properly tainted.

The new output is:

aws_instance.bar: (tainted) (1 deposed)
  ID = foo
  provider = provider.aws
  require_new = xyz
  type = aws_instance
  Deposed ID 1 = bar

Showing the new "foo instance as being the primary instance in the
state, with "bar" as the deposed instance.
2018-03-15 16:04:05 -04:00
James Bardin b2d111c2bd return provisioner Apply errors
EvaApplyProvisioners was not returning errors if there was already a
multierror stored in the Error field. Always return the error to the
caller.
2018-03-15 16:04:05 -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 b214834834 update the vendored winrm release
This was updated to see if we can get at any error status from the
remote command and transport, which still is not available, but kept the
latest version since it fixes a couple race conditions.
2018-03-15 16:03:40 -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
James Bardin 2d7dc605a0 get communicator errors from a remote.Cmd
The remote.Cmd struct could not convey any transport related error to
the caller, meaning that interrupted commands would show that they
succeeded.

Change Cmd.SetExited to accept an exit status, as well as an error to
store for the caller.  Make the status and error fields internal,
require serialized access through the getter methods.

Users of remote.Cmd should not check both Cmd.Err() and Cmd.ExitStatus()
until after Wait returns.

Require communicators to call Cmd.Init before executing the command.
This will indicate incorrect usage of the remote.Cmd by causing a panic
in SetExitStatus.
2018-03-15 16:03:20 -04:00
Brian Flad 994a78dbc7 validation: Return "invalid RFC3339 timestamp" in ValidateRFC3339TimeString 2018-03-15 12:31:31 -04:00
Paul Tyng 6284f99708
Allow callers to append to user agent 2018-03-15 10:53:44 -04:00
Paul Tyng fb9531b3d9
Rename http client test 2018-03-15 09:48:37 -04:00
Guillaume J. Charmes bfac8e0eec
Update vendor for DeepCopy issue
Signed-off-by: Guillaume J. Charmes <gcharmes@magicleap.com>
2018-03-14 20:13:36 -04:00