Allow to initialize keystone v3 client

Currently, ironic client is only able to use keystone v2 client,
this change fixes it.

Change-Id: I9e5cdc3ce98842eb335e1ff72975fc5f3e2abd4f
Co-Authored-By: John L. Villalovos <john.l.villalovos@intel.com>
Closes-bug: #1539604
This commit is contained in:
Vladyslav Drok 2016-01-29 15:52:10 +02:00 committed by John L. Villalovos
parent c3811ed632
commit fe422e57ab
1 changed files with 13 additions and 7 deletions

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from keystoneclient.v2_0 import client as ksclient
import keystoneclient
from ironicclient.common.i18n import _
from ironicclient.common import utils
@ -27,12 +27,18 @@ def _get_ksclient(**kwargs):
* insecure: allow insecure SSL (no cert verification)
* tenant_{name|id}: name or ID of tenant
"""
return ksclient.Client(username=kwargs.get('username'),
password=kwargs.get('password'),
tenant_id=kwargs.get('tenant_id'),
tenant_name=kwargs.get('tenant_name'),
auth_url=kwargs.get('auth_url'),
insecure=kwargs.get('insecure'))
client = keystoneclient.client.Client(
username=kwargs.get('username'),
password=kwargs.get('password'),
tenant_id=kwargs.get('tenant_id'),
tenant_name=kwargs.get('tenant_name'),
auth_url=kwargs.get('auth_url'),
insecure=kwargs.get('insecure'))
# FIXME(jlvillal): Work around for Bug 1539839 as client.authenticate is
# not called.
client.authenticate()
return client
def _get_endpoint(client, **kwargs):