parameters: (ctx, config)
docstring: Mount Transit or KV version 2 secrets engine
docstring_summary: Mount Transit or KV version 2 secrets engine
docstring_tokens: Mount Transit or KV version 2 secrets engine
function: def setup_vault(ctx, config):
      """
      Mount Transit or KV version 2 secrets engine
      """
      (cclient, cconfig) = next(iter(config.items()))
      engine = cconfig.get('engine')
  
      if engine == 'kv':
          log.info('Mounting kv version 2 secrets engine')
          mount_path = '/v1/sys/mounts/kv'
          data = {
              "type": "kv",
              "options": {
                  "version": "2"
              }
          }
      elif engine == 'transit':
          log.info('Mounting transit secrets engine')
          mount_path = '/v1/sys/mounts/transit'
          data = {
              "type": "transit"
          }
      else:
          raise Exception("Unknown or missing secrets engine")
  
      send_req(ctx, cconfig, cclient, mount_path, json.dumps(data))
      yield
function_tokens: def setup_vault ( ctx , config ) : ( cclient , cconfig ) = next ( iter ( config . items ( ) ) ) engine = cconfig . get ( 'engine' ) if engine == 'kv' : log . info ( 'Mounting kv version 2 secrets engine' ) mount_path = '/v1/sys/mounts/kv' data = { "type" : "kv" , "options" : { "version" : "2" } } elif engine == 'transit' : log . info ( 'Mounting transit secrets engine' ) mount_path = '/v1/sys/mounts/transit' data = { "type" : "transit" } else : raise Exception ( "Unknown or missing secrets engine" ) send_req ( ctx , cconfig , cclient , mount_path , json . dumps ( data ) ) yield