parameters: (ctx, config)
docstring: This is similar to the standard 'exec' task, but does the VIP substitutions.
docstring_summary: This is similar to the standard 'exec' task, but does the VIP substitutions.
docstring_tokens: This is similar to the standard exec task but does the VIP substitutions .
function: def exec(ctx, config):
      """
      This is similar to the standard 'exec' task, but does the VIP substitutions.
      """
      assert isinstance(config, dict), "task exec got invalid config"
  
      testdir = teuthology.get_testdir(ctx)
  
      if 'all-roles' in config and len(config) == 1:
          a = config['all-roles']
          roles = teuthology.all_roles(ctx.cluster)
          config = dict((id_, a) for id_ in roles if not id_.startswith('host.'))
      elif 'all-hosts' in config and len(config) == 1:
          a = config['all-hosts']
          roles = teuthology.all_roles(ctx.cluster)
          config = dict((id_, a) for id_ in roles if id_.startswith('host.'))
  
      for role, ls in config.items():
          (remote,) = ctx.cluster.only(role).remotes.keys()
          log.info('Running commands on role %s host %s', role, remote.name)
          for c in ls:
              c.replace('$TESTDIR', testdir)
              remote.run(
                  args=[
                      'sudo',
                      'TESTDIR={tdir}'.format(tdir=testdir),
                      'bash',
                      '-ex',
                      '-c',
                      subst_vip(ctx, c)],
                  )
function_tokens: def exec ( ctx , config ) : assert isinstance ( config , dict ) , "task exec got invalid config" testdir = teuthology . get_testdir ( ctx ) if 'all-roles' in config and len ( config ) == 1 : a = config [ 'all-roles' ] roles = teuthology . all_roles ( ctx . cluster ) config = dict ( ( id_ , a ) for id_ in roles if not id_ . startswith ( 'host.' ) ) elif 'all-hosts' in config and len ( config ) == 1 : a = config [ 'all-hosts' ] roles = teuthology . all_roles ( ctx . cluster ) config = dict ( ( id_ , a ) for id_ in roles if id_ . startswith ( 'host.' ) ) for role , ls in config . items ( ) : ( remote , ) = ctx . cluster . only ( role ) . remotes . keys ( ) log . info ( 'Running commands on role %s host %s' , role , remote . name ) for c in ls : c . replace ( '$TESTDIR' , testdir ) remote . run ( args = [ 'sudo' , 'TESTDIR={tdir}' . format ( tdir = testdir ) , 'bash' , '-ex' , '-c' , subst_vip ( ctx , c ) ] , )