novaclient.shell fails with OS_AUTH_TYPE=v3kerberos

Bug #1748314 reported by Ji-Young Park
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
New
Undecided
Unassigned

Bug Description

When OS_AUTH_TYPE is set to v3kerberos or --os-auth-type=v3kerberos is passed, nova shell fails with an error

ERROR (AttributeError): 'Namespace' object has no attribute 'os_user_id'

This is because keystoneauth1 module does not add options unnecessary with kerberos to argparse

The patch below allowed me to use v3kerberos with python-novaclient 10.1.0

--- python-novaclient-10.1.0.org/novaclient/shell.py 2018-01-25 23:37:12.000000000 +0000
+++ python-novaclient-10.1.0.patched/novaclient/shell.py 2018-02-08 18:36:04.671381497 +0000
@@ -513,24 +513,27 @@
             api_version = api_versions.get_api_version(
                 args.os_compute_api_version)

- os_username = args.os_username
- os_user_id = args.os_user_id
+ os_username = getattr(args, 'os_username', None)
+ os_user_id = getattr(args, 'os_user_id', None)
         os_password = None # Fetched and set later as needed
         os_project_name = getattr(
             args, 'os_project_name', getattr(args, 'os_tenant_name', None))
         os_project_id = getattr(
             args, 'os_project_id', getattr(args, 'os_tenant_id', None))
         os_auth_url = args.os_auth_url
+ os_auth_type = getattr(args, 'os_auth_type', 'password')
         os_region_name = args.os_region_name

         if "v2.0" not in os_auth_url:
             # NOTE(andreykurilin): assume that keystone V3 is used and try to
             # be more user-friendly, i.e provide default values for domains
- if (not args.os_project_domain_id and
- not args.os_project_domain_name):
- setattr(args, "os_project_domain_id", "default")
- if not args.os_user_domain_id and not args.os_user_domain_name:
- setattr(args, "os_user_domain_id", "default")
+ if hasattr(args, 'os_project_domain_id'):
+ if (not args.os_project_domain_id and
+ not args.os_project_domain_name):
+ setattr(args, "os_project_domain_id", "default")
+ if hasattr(args, 'os_user_domain_id'):
+ if not args.os_user_domain_id and not args.os_user_domain_name:
+ setattr(args, "os_user_domain_id", "default")

         os_project_domain_id = args.os_project_domain_id
         os_project_domain_name = args.os_project_domain_name
@@ -579,7 +582,7 @@
         # for os_username or os_password but for compatibility it is not.
         if must_auth and not skip_auth:

- if not os_username and not os_user_id:
+ if os_auth_type != 'v3kerberos' and not os_username and not os_user_id:
                 raise exc.CommandError(
                     _("You must provide a username "
                       "or user ID via --os-username, --os-user-id, "

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.