def define_task(name, tick_script, task_type='stream', database=None, retention_policy='default'):
 if (version() < '0.13'):
  cmd = 'kapacitor define -name {0}'.format(name)
 else:
  cmd = 'kapacitor define {0}'.format(name)
 if tick_script.startswith('salt://'):
  tick_script = __salt__['cp.cache_file'](tick_script, __env__)
 cmd += ' -tick {0}'.format(tick_script)
 if task_type:
  cmd += ' -type {0}'.format(task_type)
 if (database and retention_policy):
  cmd += ' -dbrp {0}.{1}'.format(database, retention_policy)
 return _run_cmd(cmd)

def define_task ( name , tick_script , task_type = 'stream' , database = None , retention_policy = 'default' ) : if ( version ( ) < '0.13' ) : cmd = 'kapacitor define -name {0}' . format ( name ) else : cmd = 'kapacitor define {0}' . format ( name ) if tick_script . startswith ( 'salt://' ) : tick_script = __salt__ [ 'cp.cache_file' ] ( tick_script , __env__ ) cmd += ' -tick {0}' . format ( tick_script ) if task_type : cmd += ' -type {0}' . format ( task_type ) if ( database and retention_policy ) : cmd += ' -dbrp {0}.{1}' . format ( database , retention_policy ) return _run_cmd ( cmd )
define a task .