Sha256: 47132af7c791291cd6f4e7892b562187f15d2015ed2ff3cacbc33066e5a66f85

Contents?: true

Size: 396 Bytes

Versions: 18

Compression:

Stored size: 396 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?

		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

18 entries across 18 versions & 1 rubygems

Version Path
chef-vpc-toolkit-2.8.1 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.8.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.7.2 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.7.1 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.7.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.6.1 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.6.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.5.2 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.5.1 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.5.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.4.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.3.2 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.3.1 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.3.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.2.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.1.0 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.0.1 lib/chef-vpc-toolkit/ssh_util.rb
chef-vpc-toolkit-2.0.0 lib/chef-vpc-toolkit/ssh_util.rb