Ask Your Question

Revision history [back]

Problem with keystoneauth1. Session instance is from keystoneauth1.session but must be from openstack.session

Hi, I'm trying to authorize with keystone and create a Connection from existing authenticated Session but I got errors and I can't find out what's the problem. Here is my code:

#!/usr/bin/env python2

from keystoneauth1 import session
from keystoneclient.auth.identity import v3                                             
from keystoneclient.v3 import client as keystone_v3
import os
import os_client_config
import json
from openstack import connection

os.environ['OS_CLIENT_CONFIG_FILE'] = "/etc/openstack/clouds.yaml"
cloud_config = os_client_config.OpenStackConfig().get_one_cloud('test')
auth = v3.Password(auth_url=cloud_config.config["auth"].get('auth_url'),
            project_name=cloud_config.config["auth"].get('project_name'),
            project_id=cloud_config.config["auth"].get('project_id'),
            user_domain_name=cloud_config.config["auth"].get('user_domain_name'),
            username=cloud_config.config["auth"].get('username'),
            password=cloud_config.config["auth"].get('password'))

sess = session.Session(auth=auth, verify=cloud_config.config["cacert"])
keystone = keystone_v3.Client(session=sess, interface='public')

# Trying to get regions list, but get **keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication.**
print keystone.regions.list()

# **openstack.exceptions.SDKException: Session instance is from keystoneauth1.session but must be from openstack.session**
conn = connection.Connection(session=sess,
                                region_name=region,
                                compute_api_version='2',
                                identity_interface='public')

It works FINE in openstack client version 3.19.0. BUT for some reason I'm restricted to use version 3.12.2 and with version it just don't work ... I was trying to find something in documentation or here but nothing. PLEASE CAN YOU HELP ME?

Thank you.

Problem with keystoneauth1. Session instance is from keystoneauth1.session but must be from openstack.session

Hi, I'm trying to authorize with keystone and create a Connection from existing authenticated Session but I got errors and I can't find out what's the problem. Here is my code:

#!/usr/bin/env python2

from keystoneauth1 import session
from keystoneclient.auth.identity import v3                                             
from keystoneclient.v3 import client as keystone_v3
import os
import os_client_config
import json
from openstack import connection

os.environ['OS_CLIENT_CONFIG_FILE'] = "/etc/openstack/clouds.yaml"
cloud_config = os_client_config.OpenStackConfig().get_one_cloud('test')
auth = v3.Password(auth_url=cloud_config.config["auth"].get('auth_url'),
            project_name=cloud_config.config["auth"].get('project_name'),
            project_id=cloud_config.config["auth"].get('project_id'),
            user_domain_name=cloud_config.config["auth"].get('user_domain_name'),
            username=cloud_config.config["auth"].get('username'),
            password=cloud_config.config["auth"].get('password'))

sess = session.Session(auth=auth, verify=cloud_config.config["cacert"])
keystone = keystone_v3.Client(session=sess, interface='public')

# Trying to get regions list, but get **keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication.**
keystone_v3.Client(session=sess)

print keystone.regions.list()

# **openstack.exceptions.SDKException: Session instance is from keystoneauth1.session but must be from openstack.session**
conn = connection.Connection(session=sess,
                                region_name=region,
                                compute_api_version='2',
                                identity_interface='public')

It works FINE in openstack client version 3.19.0. BUT for some reason I'm restricted to use version 3.12.2 and with version it just don't work ... I was trying to find something in documentation or here but nothing. PLEASE CAN YOU HELP ME?

Thank you.