Skip to content

Commit

Permalink
fixed (works with 1.9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Huber committed May 2, 2013
1 parent 6aee82a commit 7dfd530
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/openvpn_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ def status
routes = {}

c = issue_command "status"
c.each do |l|
c.split("\n").each do |l|
puts l.inspect

# End Information Markers
if l == "ROUTING TABLE\n"
if l == "ROUTING TABLE"
client_list_flag = 0
end

if l == "GLOBAL STATS\n"
if l == "GLOBAL STATS"
routing_list_flag = 0
end

Expand All @@ -85,16 +86,17 @@ def status
# Update Routing Info List
# Virtual Address,Common Name,Real Address,Last Ref
if routing_list_flag == 1
route = l.split(',')
routes[route[0]] = { :common_name => route[1], :real_address=> route[2], :last_ref => route[3].chop }
route = []
route << l.split(',')
routes[route[0]] = { :common_name => route[1], :real_address=> route[2], :last_ref => route[3] }
end

# Start Information Markers
if l == "Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since\n"
if l == "Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since"
client_list_flag = 1
end

if l == "Virtual Address,Common Name,Real Address,Last Ref\n"
if l == "Virtual Address,Common Name,Real Address,Last Ref"
routing_list_flag = 1
end
end
Expand Down

0 comments on commit 7dfd530

Please sign in to comment.