docs: def get_vault_connection():
      '''
      Get the connection details for calling Vault, from local configuration if
      it exists, or from the master otherwise
      '''
      def _use_local_config():
          log.debug('Using Vault connection details from local config')
          try:
              if __opts__['vault']['auth']['method'] == 'approle':
                  verify = __opts__['vault'].get('verify', None)
                  if _selftoken_expired():
                      log.debug('Vault token expired. Recreating one')
                      # Requesting a short ttl token
                      url = '{0}/v1/auth/approle/login'.format(__opts__['vault']['url'])
                      payload = {'role_id': __opts__['vault']['auth']['role_id']}
                      if 'secret_id' in __opts__['vault']['auth']:
                          payload['secret_id'] = __opts__['vault']['auth']['secret_id']
                      response = requests.post(url, json=payload, verify=verify)
                      if response.status_code != 200:
                          errmsg = 'An error occured while getting a token from approle'
                          raise salt.exceptions.CommandExecutionError(errmsg)
                      __opts__['vault']['auth']['token'] = response.json()['auth']['client_token']
              if __opts__['vault']['auth']['method'] == 'wrapped_token':
                  verify = __opts__['vault'].get('verify', None)
                  if _wrapped_token_valid():
                      url = '{0}/v1/sys/wrapping/unwrap'.format(__opts__['vault']['url'])
                      headers = {'X-Vault-Token': __opts__['vault']['auth']['token']}
                      response = requests.post(url, headers=headers, verify=verify)
                      if response.status_code != 200:
                          errmsg = 'An error occured while unwrapping vault token'
                          raise salt.exceptions.CommandExecutionError(errmsg)
                      __opts__['vault']['auth']['token'] = response.json()['auth']['client_token']
              return {
                  'url': __opts__['vault']['url'],
                  'token': __opts__['vault']['auth']['token'],
                  'verify': __opts__['vault'].get('verify', None)
              }
          except KeyError as err:
              errmsg = 'Minion has "vault" config section, but could not find key "{0}" within'.format(err.message)
              raise salt.exceptions.CommandExecutionError(errmsg)
  
      if 'vault' in __opts__ and __opts__.get('__role', 'minion') == 'master':
          if 'id' in __grains__:
              log.debug('Contacting master for Vault connection details')
              return _get_token_and_url_from_master()
          else:
              return _use_local_config()
      elif any((__opts__['local'], __opts__['file_client'] == 'local', __opts__['master_type'] == 'disable')):
          return _use_local_config()
      else:
          log.debug('Contacting master for Vault connection details')
          return _get_token_and_url_from_master()