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

asked 2019-10-09 09:17:52 -0600

nastya gravatar image

updated 2019-10-11 08:16:18 -0600

Hi, I'm to 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)

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.

edit retag flag offensive close merge delete

Comments

What error does it throw? If you can provide some logs that would be helpful.

Syed Awais Ali gravatar imageSyed Awais Ali ( 2019-10-13 07:26:09 -0600 )edit