Skip to content

Instantly share code, notes, and snippets.

@skamithi
Created January 30, 2015 17:37
Show Gist options
  • Save skamithi/45aad4a252fb575e2583 to your computer and use it in GitHub Desktop.
Save skamithi/45aad4a252fb575e2583 to your computer and use it in GitHub Desktop.
specinfra interface speed patch
commit 83cd84ddad6d4ebf683cfaa5850dc2dc0b823f2d
Author: Stanley Karunditu <[email protected]>
Date: Wed Jan 28 00:51:24 2015 -0500
get speed from /sys/class/net instead of ethtool. simpler way of doing it.
diff --git a/lib/specinfra/command/linux/base/interface.rb b/lib/specinfra/command/linux/base/interface.rb
index 2bb5bec..0ba7efc 100644
--- a/lib/specinfra/command/linux/base/interface.rb
+++ b/lib/specinfra/command/linux/base/interface.rb
@@ -5,7 +5,7 @@ class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Int
end
def get_speed_of(name)
- "ethtool #{name} | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\\/s/,\"\\\\1\",\"\")}'"
+ "cat /sys/class/net/#{name}/speed"
end
def check_has_ipv4_address(interface, ip_address)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment