Sha256: a9b8947e89d678b9b7cef79cbbcaef9c44c28c532809d3fdb75cd006947e6201

Contents?: true

Size: 470 Bytes

Versions: 25

Compression:

Stored size: 470 Bytes

Contents

module Kytoon

module SshUtil

  def self.remove_known_hosts_ip(ip, known_hosts_file=File.join(ENV['HOME'], ".ssh", "known_hosts"))

    return if ip.nil? or ip.empty?
    return if not FileTest.exist?(known_hosts_file)

    existing=IO.read(known_hosts_file)
    File.open(known_hosts_file, 'w') do |file|
      existing.each_line do |line|
        if not line =~ Regexp.new("^#{ip}.*$") then
            file.write(line)
        end
      end
    end

  end

end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
kytoon-1.4.3 lib/kytoon/ssh_util.rb
kytoon-1.4.2 lib/kytoon/ssh_util.rb
kytoon-1.4.1 lib/kytoon/ssh_util.rb
kytoon-1.4.0 lib/kytoon/ssh_util.rb
kytoon-1.3.9 lib/kytoon/ssh_util.rb
kytoon-1.3.8 lib/kytoon/ssh_util.rb
kytoon-1.3.7 lib/kytoon/ssh_util.rb
kytoon-1.3.6 lib/kytoon/ssh_util.rb
kytoon-1.3.5 lib/kytoon/ssh_util.rb
kytoon-1.3.4 lib/kytoon/ssh_util.rb
kytoon-1.3.3 lib/kytoon/ssh_util.rb
kytoon-1.3.2 lib/kytoon/ssh_util.rb
kytoon-1.3.1 lib/kytoon/ssh_util.rb
kytoon-1.3.0 lib/kytoon/ssh_util.rb
kytoon-1.2.5 lib/kytoon/ssh_util.rb
kytoon-1.2.4 lib/kytoon/ssh_util.rb
kytoon-1.2.3 lib/kytoon/ssh_util.rb
kytoon-1.2.2 lib/kytoon/ssh_util.rb
kytoon-1.2.1 lib/kytoon/ssh_util.rb
kytoon-1.2.0 lib/kytoon/ssh_util.rb