本文整理汇总了Golang中github.com/juju/juju/utils/ssh.Options.SetKnownHostsFile方法的典型用法代码示例。如果您正苦于以下问题:Golang Options.SetKnownHostsFile方法的具体用法?Golang Options.SetKnownHostsFile怎么用?Golang Options.SetKnownHostsFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/utils/ssh.Options
的用法示例。
在下文中一共展示了Options.SetKnownHostsFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestCommandSetKnownHostsFile
func (s *SSHCommandSuite) TestCommandSetKnownHostsFile(c *gc.C) {
var opts ssh.Options
opts.SetKnownHostsFile("/tmp/known hosts")
s.assertCommandArgs(c, s.commandOptions([]string{echoCommand, "123"}, &opts),
fmt.Sprintf("%s -o StrictHostKeyChecking no -o PasswordAuthentication no -o ServerAliveInterval 30 -o UserKnownHostsFile \"/tmp/known hosts\" localhost %s 123",
s.fakessh, echoCommand),
)
}
示例2: getSSHOptions
// getSSHOptions configures and returns SSH options and proxy settings.
func (c *SSHCommon) getSSHOptions(enablePty bool) (*ssh.Options, error) {
var options ssh.Options
// TODO(waigani) do not save fingerprint only until this bug is addressed:
// lp:892552. Also see lp:1334481.
options.SetKnownHostsFile("/dev/null")
if enablePty {
options.EnablePTY()
}
var err error
if c.proxy, err = c.proxySSH(); err != nil {
return nil, err
} else if c.proxy {
if err := c.setProxyCommand(&options); err != nil {
return nil, err
}
}
return &options, nil
}