Skip to content

Instantly share code, notes, and snippets.

@jasperla
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasperla/5d9374d1f7c3bf20a40b to your computer and use it in GitHub Desktop.
Save jasperla/5d9374d1f7c3bf20a40b to your computer and use it in GitHub Desktop.
lib/specinfra/command/openbsd/base/routing_table.rb
# Match with:
# /^(\S+)\s+(\S+).*?(\S+[0-9]+)$/
# $1: destination
# $2: gateway
# $3: interface
# or:
# /^(?<destination>\S+)\s+(?<gateway>\S+).*?(?<interface>\S+[0-9]+)$/
class Specinfra::Command::Openbsd::Base::RoutingTable < Specinfra::Command::Base::RoutingTable
class << self
def get_routing_table_entry(destination)
"route -n show -gateway | egrep '(^default|#{destination})' | head -1"
end
alias :get_entry :get_routing_table_entry
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment