Sha256: 0193873b658cf4ded5663598df18b9d7fcaae8335bd1a39b04fd68280041f59d

Contents?: true

Size: 446 Bytes

Versions: 1

Compression:

Stored size: 446 Bytes

Contents

module ChefVPCToolkit

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

1 entries across 1 versions & 1 rubygems

Version Path
chef-vpc-toolkit-2.8.2 lib/chef-vpc-toolkit/ssh_util.rb