Commit 10f3194e by Chif Gergő

Create connection class

parent dc7e976d
import openstack
from keystoneauth1.identity import v3
from keystoneauth1 import session
class OpenStackConnection(object):
"""Class for handling the connection to the OpenStack Manager.
It creates a connection member variable which holds the connection.
The connection only connects when something called in it."""
def __init__(self, auth):
super(OpenStackConnection, self).__init__()
self.openstack = openstack.connect(auth_url=auth["auth_url"],
username=auth["username"],
password=auth["password"],
project_id=auth["project_id"],
project_name=auth["project_name"],
region_name=auth["region_name"]
)
client_auth = v3.Password(auth_url=auth["auth_url"],
username=auth["username"],
password=auth["password"],
user_domain_id=auth["user_domain_id"],
project_id=auth["project_id"],)
self.client_session = session.Session(auth=client_auth)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment