Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openstack authentication with domain_name #472

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions wrapanapi/systems/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ def deploy(self, vm_name, **kwargs):
class OpenstackSystem(System, VmMixin, TemplateMixin):
"""Openstack management system

Uses novaclient.
Uses novaclient. If using openstack auth_url version 3 (URL ending in v3)
then domain_id or domain_name is required (you can use both).

Args:
tenant: The tenant to log in with.
Expand All @@ -592,6 +593,7 @@ class OpenstackSystem(System, VmMixin, TemplateMixin):

Keywords:
domain_id: required only if using openstack auth_url version 3 (URL ending in v3)
domain_name: required only if using openstack auth_url version 3 (URL ending in v3)

Returns: A :py:class:`OpenstackSystem` object.
"""
Expand Down Expand Up @@ -620,7 +622,8 @@ def __init__(self, tenant, username, password, auth_url, **kwargs):
self.username = username
self.password = password
self.auth_url = auth_url
self.domain_id = kwargs["domain_id"] if self.keystone_version == 3 else None
self.domain_id = kwargs.get("domain_id") if self.keystone_version == 3 else None
self.domain_name = kwargs.get("domain_name") if self.keystone_version == 3 else None
self._session = None
self._api = None
self._gapi = None
Expand Down Expand Up @@ -654,7 +657,12 @@ def session(self):
)
if self.keystone_version == 3:
auth_kwargs.update(
dict(user_domain_id=self.domain_id, project_domain_id=self.domain_id)
dict(
user_domain_id=self.domain_id,
user_domain_name=self.domain_name,
project_domain_id=self.domain_id,
project_domain_name=self.domain_name,
)
)
pass_auth = Password(**auth_kwargs)
self._session = Session(auth=pass_auth, verify=False)
Expand Down