Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

communicator/ssh: switch agent default to true #2408

Merged
merged 1 commit into from
Jun 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions communicator/ssh/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ func parseConnectionInfo(s *terraform.InstanceState) (*connectionInfo, error) {
return nil, err
}

// To default Agent to true, we need to check the raw string, since the
// decoded boolean can't represent "absence of config".
//
// And if SSH_AUTH_SOCK is not set, there's no agent to connect to, so we
// shouldn't try.
if s.Ephemeral.ConnInfo["agent"] == "" && os.Getenv("SSH_AUTH_SOCK") != "" {
connInfo.Agent = true
}

if connInfo.User == "" {
connInfo.User = DefaultUser
}
Expand Down
2 changes: 1 addition & 1 deletion website/source/docs/provisioners/connection.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ provisioner "file" {
* `key_file` - The SSH key to use for the connection. This takes preference over the
password if provided.

* `agent` - Set to true to enable using ssh-agent to authenticate.
* `agent` - Set to false to disable using ssh-agent to authenticate.

**Additional arguments only supported by the "winrm" connection type:**

Expand Down