def get_task(name):
 host = __salt__['config.option']('kapacitor.host', 'localhost')
 port = __salt__['config.option']('kapacitor.port', 9092)
 if (version() < '0.13'):
  url = 'http://{0}:{1}/task?name={2}'.format(host, port, name)
 else:
  url = 'http://{0}:{1}/kapacitor/v1/tasks/{2}?skip-format=true'.format(host, port, name)
 response = salt.utils.http.query(url, status=True)
 if (response['status'] == 404):
  return None
 data = json.loads(response['body'])
 if (version() < '0.13'):
  return {'script': data['TICKscript'], 'type': data['Type'], 'dbrps': data['DBRPs'], 'enabled': data['Enabled']}
 return {'script': data['script'], 'type': data['type'], 'dbrps': data['dbrps'], 'enabled': (data['status'] == 'enabled')}

def get_task ( name ) : host = __salt__ [ 'config.option' ] ( 'kapacitor.host' , 'localhost' ) port = __salt__ [ 'config.option' ] ( 'kapacitor.port' , 9092 ) if ( version ( ) < '0.13' ) : url = 'http://{0}:{1}/task?name={2}' . format ( host , port , name ) else : url = 'http://{0}:{1}/kapacitor/v1/tasks/{2}?skip-format=true' . format ( host , port , name ) response = salt . utils . http . query ( url , status = True ) if ( response [ 'status' ] == 404 ) : return None data = json . loads ( response [ 'body' ] ) if ( version ( ) < '0.13' ) : return { 'script' : data [ 'TICKscript' ] , 'type' : data [ 'Type' ] , 'dbrps' : data [ 'DBRPs' ] , 'enabled' : data [ 'Enabled' ] } return { 'script' : data [ 'script' ] , 'type' : data [ 'type' ] , 'dbrps' : data [ 'dbrps' ] , 'enabled' : ( data [ 'status' ] == 'enabled' ) }
get a dict of data on a task .