       body = parseJSON body
       cb error, body
   @getJSON = (arg, slave, cb) ->
-    url = "http://#{model.slaves[slave].ip}:3000/#{arg}"
+    url = "#{@slaveUrl(slave)}/#{arg}"
     request.get
       url: url
       auth:

  return str

Cavalry = ->
  @postJSON = (arg, slave, opts, cb) ->
    url = "http://#{model.slaves[slave].ip}:3000/#{arg}"
    request
      json: opts
      auth:

util = require '../lib/util.coffee'
request = require 'request'
SECRET = process.env.CAVALRYPASS or "testingpass"
CAVALRY_PORT = parseInt process.env.CAVALRYPORT
CAVALRY_PORT = 3000 if isNaN(CAVALRY_PORT)

parseJSON = (str) ->
  try
