Module: TestLab::Container::SSH
- Included in:
- TestLab::Container
- Defined in:
- lib/testlab/container/ssh.rb
Instance Method Summary collapse
-
#ssh(options = {}) ⇒ ZTK::SSH
ZTK:SSH object.
-
#ssh_config ⇒ String
Returns text suitable for use in an SSH configuration file.
Instance Method Details
#ssh(options = {}) ⇒ ZTK::SSH
ZTK:SSH object
Returns a ZTK:SSH class instance configured for this container.
12 13 14 |
# File 'lib/testlab/container/ssh.rb', line 12 def ssh(={}) self.node.container_ssh(self, ) end |
#ssh_config ⇒ String
Returns text suitable for use in an SSH configuration file
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/testlab/container/ssh.rb', line 19 def ssh_config identities = [self.users.map(&:identity), self.node.identity].flatten.compact.uniq output = <<-EOF #{ZTK::Template.do_not_edit_notice(: => %(TestLab "#{self.id}" SSH Configuration))} Host #{self.id} HostName #{self.ip} Port 22 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no ForwardAgent no IdentitiesOnly yes EOF identities.each do |identity| output += " IdentityFile #{identity}\n" end output end |