Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #780 from JoshVanL/automated-cherry-pick-of-#778-o…
Browse files Browse the repository at this point in the history
…rigin-release-0.6

Automated cherry pick of #775
  • Loading branch information
jetstack-bot committed Mar 15, 2019
2 parents 9886443 + 3d66531 commit 0f45b19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 0 additions & 3 deletions pkg/tarmak/cluster/cluster.go
Expand Up @@ -731,9 +731,6 @@ func (c *Cluster) ConfigPath() string {
}

func (c *Cluster) SSHConfigPath() string {
if c.Type() == clusterv1alpha1.ClusterTypeClusterMulti {
return filepath.Join(c.Environment().Tarmak().ConfigPath(), c.Environment().HubName(), "ssh_config")
}
return filepath.Join(c.ConfigPath(), "ssh_config")
}

Expand Down
11 changes: 5 additions & 6 deletions pkg/tarmak/ssh/ssh.go
Expand Up @@ -70,15 +70,14 @@ func (s *SSH) WriteConfig(c interfaces.Cluster) error {
return err
}

knownHostsPath := s.tarmak.Cluster().SSHHostKeysPath()
knownHostsPath := c.SSHHostKeysPath()

// open file for appending
knownHostsFile, err := os.OpenFile(
knownHostsPath,
os.O_APPEND|os.O_WRONLY|os.O_CREATE,
0600,
)
knownHostsPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY,
0600)
if err != nil {
return err
return fmt.Errorf("failed to open known hosts file: %s", err)
}
defer knownHostsFile.Close()

Expand Down
1 change: 1 addition & 0 deletions pkg/tarmak/tarmak.go
Expand Up @@ -178,6 +178,7 @@ func (t *Tarmak) writeSSHConfigForClusterHosts() error {
if errCluster != nil {
return fmt.Errorf("failed to retrieve current cluster name: %s", errCluster)
}

return fmt.Errorf("failed to write ssh config for current cluster '%s': %v", clusterName, err)
}

Expand Down

0 comments on commit 0f45b19

Please sign in to comment.