Browse Source

Compute HA: Remove version discovery of keystone API

Keystone removed its v2 API a long ago and now it provides v3 API only.
Thus we no longer need any logic depending on Keystone API version.

Change-Id: Ifffe5bea246478954f86e803f8038d73f039eaf8
changes/68/804368/3
Takashi Kajinami 9 months ago
parent
commit
8f6d13b7ed
  1. 16
      scripts/check-run-nova-compute

16
scripts/check-run-nova-compute

@ -72,25 +72,17 @@ def create_nova_connection(options):
from keystoneauth1 import loading
from keystoneauth1 import session
from keystoneclient import discover
# Prefer the oldest and strip the leading 'v'
keystone_versions = discover.available_versions(options["auth_url"][0])
keystone_version = keystone_versions[0]['id'][1:]
kwargs = dict(
auth_url=options["auth_url"][0],
username=options["username"][0],
password=options["password"][0]
password=options["password"][0],
project_name=options["project_name"][0],
user_domain_name=options["user_domain_name"][0],
project_domain_name=options["project_domain_name"][0],
)
if discover.version_match("2", keystone_version):
kwargs["tenant_name"] = options["tenant_name"][0]
elif discover.version_match("3", keystone_version):
kwargs["project_name"] = options["project_name"][0]
kwargs["user_domain_name"] = options["user_domain_name"][0]
kwargs["project_domain_name"] = options["project_domain_name"][0]
loader = loading.get_plugin_loader('password')
keystone_auth = loader.load_from_options(**kwargs)
keystone_session = session.Session(auth=keystone_auth, verify=(not options["insecure"]))

Loading…
Cancel
Save