Commit d388156

mo khan <mo@mokhan.ca>
2015-02-05 05:29:39
include hostname and ip address in event.
1 parent f00a33d
Changed files (1)
lib/fake_agent.rb
@@ -1,3 +1,5 @@
+require 'socket'
+
 class FakeAgent
   attr_reader :id, :endpoint
 
@@ -49,6 +51,8 @@ class FakeAgent
           data: {
             fingerprint: fingerprint,
             full_path: file,
+            hostname: Socket.gethostname,
+            ip_addresses: ip_addresses,
           }
         }
       }
@@ -65,4 +69,8 @@ class FakeAgent
     sha, * = result.split(' ')
     sha
   end
+
+  def ip_addresses
+    Socket.ip_address_list.find_all { |x| x.ipv4? }.map { |x| x.ip_address }
+  end
 end