def _get_bearer_token(self, bearer_token_auth, bearer_token_path):
    if (bearer_token_auth is False):
        return None
    path = None
    if (bearer_token_path is not None):
        if isfile(bearer_token_path):
            path = bearer_token_path
        else:
            self.log.error('File not found: %s', bearer_token_path)
    elif isfile(self.KUBERNETES_TOKEN_PATH):
        path = self.KUBERNETES_TOKEN_PATH
    if (path is None):
        self.log.error('Cannot get bearer token from bearer_token_path or auto discovery')
        raise IOError('Cannot get bearer token from bearer_token_path or auto discovery')
    try:
        with open(path, 'r') as f:
            return f.read().rstrip()
    except Exception as err:
        self.log.error('Cannot get bearer token from path: %s - error: %s', path, err)
        raise
def _get_bearer_token(self, bearer_token_auth, bearer_token_path):
    if (bearer_token_auth is False):
        return None
    path = None
    if (bearer_token_path is not None):
        if isfile(bearer_token_path):
            path = bearer_token_path
        else:
            self.log.error('File not found: %s', bearer_token_path)
    elif isfile(self.KUBERNETES_TOKEN_PATH):
        path = self.KUBERNETES_TOKEN_PATH
    if (path is None):
        self.log.error('Cannot get bearer token from bearer_token_path or auto discovery')
        raise IOError('Cannot get bearer token from bearer_token_path or auto discovery')
    try:
        with open(path, 'r') as f:
            return f.read().rstrip()
    except Exception as err:
        self.log.error('Cannot get bearer token from path: %s - error: %s', path, err)
        raise