Created
June 29, 2011 21:01
-
-
Save rcreasey/1054954 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provides "gamespy" | |
require_plugin "kernel" | |
require_plugin "network" | |
def get_ip_address(name, eth) | |
network[:interfaces][eth][:addresses].each do |key, info| | |
gamespy[name] = key if info['family'] == 'inet' | |
end | |
end | |
def has_dsr_interfaces? | |
return network[:interfaces].has_key?('eth0') && | |
network[:interfaces].has_key?('eth1') && | |
network[:interfaces].has_key?('lo:0') | |
end | |
def looks_like_matchmaking? | |
has_dsr_interfaces? | |
end | |
if looks_like_matchmaking? | |
gamespy Mash.new | |
get_ip_address(:private_ipv4, :eth0) | |
get_ip_address(:public_ipv4, :eth1) | |
get_ip_address(:loopback, "lo:0".to_sym) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template "#{node[:ohai][:plugin_path]}/gamespy.rb" do | |
source "gamespy.ohai.erb" | |
owner "root" | |
group "root" | |
mode 0755 | |
notifies :restart, 'ohai[gamespy]' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment