def autosign_remove host
raise "No such file #{autosign_file}" unless File.exists?(autosign_file)
found = false
entries = open(autosign_file, File::RDONLY).readlines.collect do |l|
if l.chomp != host
l
else
found = true
nil
end
end.uniq.compact
if found
autosign = open(autosign_file, File::TRUNC|File::RDWR)
autosign.write entries.join("\n")
autosign.write "\n"
autosign.close
result = {:message => "Removed #{host} from autosign"}
logger.info result[:message]
result
else
logger.info "Attempt to remove nonexistant client autosign for #{host}"
raise Proxy::Salt::NotFound, "Attempt to remove nonexistant client autosign for #{host}"
end
end