Commit Graph

15 Commits

Author SHA1 Message Date
Alex Pilon 83aa07f907
prune NewResourceConfig and update tests 2019-08-05 22:08:03 -04: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
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 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 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 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
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
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
Martin Atkins 6a4498ba76 provisioner/salt-masterless: add "_file" suffix to "minion_config"
In #15870 we got good feedback that it'd be more useful to have the
various filename-accepting arguments on this provisioner instead accept
strings that represent the contents of such files, so that they can be
generated from elsewhere in the Terraform config.

This change does not achieve that, but it does make room for doing this
later by renaming "minion_config" to "minion_config_file" so that we
can later add a "minion_config" option alongside that takes the file
content, and deprecate "minion_config_file".

Ideally we'd just implement the requested change immediately, but
unfortunately the release schedule doesn't have time for this so this is
a pragmatic change to allow us to make the full requested change at a
later date without backward incompatibilities.

This change is safe because the salt-masterless provisioner has not yet
been included in a release at the time of this commit.
2017-08-30 13:55:28 -07:00
Martin Atkins 4aa67f0bfc provisioner/salt-masterless: fix crash processing connection config
The code here was previously assuming that d.State() was equivalent to
the schema.ProvRawStateKey due to them both being of type InstanceState,
but that is in fact not true since a state object contains some transient
information that is _not_ part of the persisted state, including the
connection information we need here.

Calling ResourceData.State() constructs a _new_ state based on its stored
values, so the constructed object is lacking this transient information.
We need to use the specific state object provided by the caller in order
to get access to the transient connection configuration.

Unfortunately there is no automated test coverage for this because we have
no good story for testing provisioners that use "communicator". While such
tests could potentially be written, we'd like to get this in somewhat
quickly to unblock a release, rather than delaying to design and implement
some sort of mocking system for this.
2017-08-30 13:50:30 -07:00
Sevag Hanssian 3477868804 PR feedback 2017-08-07 12:21:27 -04:00
Sevag Hanssian 867760ed56 Add salt-masterless provisioner 2017-08-07 10:00:29 -04:00