-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbase.py
More file actions
27 lines (17 loc) · 722 Bytes
/
base.py
File metadata and controls
27 lines (17 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import openstack
from openstack import connection
from openstack_mcp_server import config
class OpenStackConnectionManager:
"""OpenStack Connection Manager"""
_connection: connection.Connection | None = None
@classmethod
def get_connection(cls) -> connection.Connection:
"""OpenStack Connection"""
if cls._connection is None:
openstack.enable_logging(debug=config.MCP_DEBUG_MODE)
cls._connection = openstack.connect(cloud=config.MCP_CLOUD_NAME)
return cls._connection
_openstack_connection_manager = OpenStackConnectionManager()
def get_openstack_conn():
"""Get OpenStack Connection"""
return _openstack_connection_manager.get_connection()