Sha256: 7bcb263bd9e24e4c54a66306fa37ef6fcba6e2307c426721af839211bb230330

Contents?: true

Size: 1022 Bytes

Versions: 17

Compression:

Stored size: 1022 Bytes

Contents

class TestLab
  class Container

    module SSH

      # ZTK:SSH object
      #
      # Returns a *ZTK:SSH* class instance configured for this container.
      #
      # @return [ZTK::SSH] An instance of ZTK::SSH configured for this
      #   container.
      def ssh(options={})
        self.node.container_ssh(self, options)
      end

      # Returns text suitable for use in an SSH configuration file
      #
      # @return [String] SSH configuration text blob.
      def ssh_config
        identities = [self.users.map(&:identity), self.node.identity].flatten.compact.uniq

        output = <<-EOF
#{ZTK::Template.do_not_edit_notice(:message => %(TestLab "#{self.fqdn}" 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

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
testlab-0.7.6 lib/testlab/container/ssh.rb
testlab-0.7.5 lib/testlab/container/ssh.rb
testlab-0.7.4 lib/testlab/container/ssh.rb
testlab-0.7.3 lib/testlab/container/ssh.rb
testlab-0.7.2 lib/testlab/container/ssh.rb
testlab-0.7.1 lib/testlab/container/ssh.rb
testlab-0.7.0 lib/testlab/container/ssh.rb
testlab-0.6.17 lib/testlab/container/ssh.rb
testlab-0.6.16 lib/testlab/container/ssh.rb
testlab-0.6.15 lib/testlab/container/ssh.rb
testlab-0.6.14 lib/testlab/container/ssh.rb
testlab-0.6.12 lib/testlab/container/ssh.rb
testlab-0.6.11 lib/testlab/container/ssh.rb
testlab-0.6.10 lib/testlab/container/ssh.rb
testlab-0.6.9 lib/testlab/container/ssh.rb
testlab-0.6.8 lib/testlab/container/ssh.rb
testlab-0.6.7 lib/testlab/container/ssh.rb