summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Zaitsev <kzaitsev@mirantis.com>2016-09-19 01:17:46 +0300
committerValerii Kovalchuk <vakovalchuk@mirantis.com>2016-09-28 14:33:05 +0000
commit2600d963ff909578b796f4faa6d72382b4156261 (patch)
tree30f5b5844aa9241b4a64c06748164346f1c1766c
parent0531b863dadba58fe90d0c5bb353059c226fd70e (diff)
Populate tenant information in client0.11.1
Python-muranoclient uses tenant id when talking to glare to avoid importing the same package twice. However tenant information was not available in the CLI and tenant id defaulted to None. This led to a situation, where it was possible to import the same package multiple times if it was not public. This patch fixes the issue by acquiring package information from keystoneauth or from user-supplied values in case no-auth is enforced. Murano dashboard was not affected by this issue. Change-Id: I72ad006c76945bf5707172ab128a89f1f6a7b112 Closes-Bug: #1624943 (cherry picked from commit 9f8e6c3286c51f0c49b89c37e83de70ce93396b6)
Notes
Notes (review): Code-Review+1: Konstantin Snihyr <ksnihyr@mirantis.com> Verified+1: Murano CI Code-Review+1: Felipe Monteiro <felipe.monteiro@att.com> Code-Review+2: Kirill Zaitsev <kzaitsev@mirantis.com> Code-Review+2: Serg Melikyan <smelikyan@mirantis.com> Workflow+1: Serg Melikyan <smelikyan@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 03 Oct 2016 14:24:11 +0000 Reviewed-on: https://review.openstack.org/378669 Project: openstack/python-muranoclient Branch: refs/heads/stable/newton
-rw-r--r--muranoclient/shell.py20
-rw-r--r--releasenotes/notes/multiple-packages-glare-fix-b82a473ad976028f.yaml5
2 files changed, 22 insertions, 3 deletions
diff --git a/muranoclient/shell.py b/muranoclient/shell.py
index e14d722..d7302e9 100644
--- a/muranoclient/shell.py
+++ b/muranoclient/shell.py
@@ -322,6 +322,17 @@ class MuranoShell(object):
322 " set murano-packages-service to 'glance'" 322 " set murano-packages-service to 'glance'"
323 " you must also specify a glance glare API URL" 323 " you must also specify a glance glare API URL"
324 " via either --glare-url or env[GLARE_API]") 324 " via either --glare-url or env[GLARE_API]")
325 if (not any([args.os_tenant_id, args.os_project_id]) and
326 args.murano_packages_service == 'glare'):
327 # TODO(kzaitsev): see if we can use project's name here
328 # NOTE(kzaitsev): glare v0.1 needs project_id to operate
329 # correctly
330 raise exc.CommandError(
331 "If you specify --os-no-client-auth and"
332 " set murano-packages-service to 'glare'"
333 " you must also specify your project's id"
334 " via either --os-project-id or env[OS_PROJECT_ID] or"
335 " --os-tenant-id or env[OS_TENANT_ID]")
325 336
326 else: 337 else:
327 # Tenant name or ID is needed to make keystoneclient retrieve a 338 # Tenant name or ID is needed to make keystoneclient retrieve a
@@ -353,7 +364,8 @@ class MuranoShell(object):
353 'auth_url': args.os_auth_url, 364 'auth_url': args.os_auth_url,
354 'token': args.os_auth_token, 365 'token': args.os_auth_token,
355 'insecure': args.insecure, 366 'insecure': args.insecure,
356 'timeout': args.api_timeout 367 'timeout': args.api_timeout,
368 'tenant': args.os_project_id or args.os_tenant_id,
357 } 369 }
358 glance_kwargs = kwargs.copy() 370 glance_kwargs = kwargs.copy()
359 371
@@ -395,11 +407,13 @@ class MuranoShell(object):
395 'session': keystone_session, 407 'session': keystone_session,
396 'auth': keystone_auth, 408 'auth': keystone_auth,
397 'service_type': service_type, 409 'service_type': service_type,
398 'endpoint_type': endpoint_type,
399 'region_name': args.os_region_name, 410 'region_name': args.os_region_name,
400 } 411 }
401 glance_kwargs = kwargs.copy() 412 glance_kwargs = kwargs.copy()
402 del glance_kwargs['endpoint_type'] 413
414 # glance doesn't need endpoint_type
415 kwargs['endpoint_type'] = endpoint_type
416 kwargs['tenant'] = keystone_auth.get_project_id(keystone_session)
403 417
404 if args.api_timeout: 418 if args.api_timeout:
405 kwargs['timeout'] = args.api_timeout 419 kwargs['timeout'] = args.api_timeout
diff --git a/releasenotes/notes/multiple-packages-glare-fix-b82a473ad976028f.yaml b/releasenotes/notes/multiple-packages-glare-fix-b82a473ad976028f.yaml
new file mode 100644
index 0000000..bdfced0
--- /dev/null
+++ b/releasenotes/notes/multiple-packages-glare-fix-b82a473ad976028f.yaml
@@ -0,0 +1,5 @@
1---
2fixes:
3 - It was possible to import the same murano package from the CLI into the same
4 project multiple times if glare was used and the package was imported as a
5 private one. The issue is now fixed.