Skip to content

Commit

Permalink
Merge pull request #2408 from hashicorp/f-ssh-agent-default-true
Browse files Browse the repository at this point in the history
communicator/ssh: switch agent default to true
  • Loading branch information
phinze committed Jun 22, 2015
2 parents 7850bb3 + 44de099 commit a224c13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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

0 comments on commit a224c13

Please sign in to comment.