Bug 1791666

Summary: PKI parameter -P with null value i.e '' should generate use friendly exception like nullpointer exception instead Traceback error
Product: Red Hat Enterprise Linux 8 Reporter: Pritam Singh <prisingh>
Component: pki-coreAssignee: RHCS Maintainers <rhcs-maint>
Status: CLOSED UPSTREAM QA Contact: PKI QE <bugzilla-pkiqe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: ascheel, edewata
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-03 18:25:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pritam Singh 2020-01-16 10:46:15 UTC
Description of problem:
pki parameter -P with null value i.e '' should generate user-friendly exception like null pointer exception instead Traceback error

Failure Param:
pki parameter -P with null value i.e -P ''

Command 1:
[root@pki1 ~]# pki -d /root/nssdb/ -c SECret.123 -P 'http' -p 20080 -n "PKI CA Administrator for Example.Org" ca
Commands:
 ca-authority                      CA management commands
 ca-audit                          Audit management commands
 ca-cert                           Certificate management commands
 ca-feature                        Feature management commands
 ca-group                          Group management commands
 ca-kraconnector                   KRA Connector management commands
 ca-profile                        Profile management commands
 ca-selftest                       Selftest management commands
 ca-user                           User management commands

Command 2:
[root@pki1 ~]# pki -d /root/nssdb/ -c SECret.123 -P '' -p 20080 -n "PKI CA Administrator for Example.Org" ca
Traceback (most recent call last):
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.6/site-packages/pki/cli/main.py", line 255, in <module>
    cli.execute(sys.argv)
  File "/usr/lib/python3.6/site-packages/pki/cli/main.py", line 161, in execute
    if args[i][0] != '-':
IndexError: string index out of range

Version-Release number of selected component (if applicable):

[root@pki1 ~]# rpm -qi pki-ca
Name        : pki-ca
Version     : 10.8.0
Release     : 0.4.module+el8.2.0+5228+a2bc7b32
Architecture: noarch
Install Date: Fri 10 Jan 2020 10:53:42 PM IST
Group       : Unspecified
Size        : 2466776
License     : GPLv2 and LGPLv2
Signature   : RSA/SHA256, Sat 14 Dec 2019 02:59:02 AM IST, Key ID 199e2f91fd431d51
Source RPM  : pki-core-10.8.0-0.4.module+el8.2.0+5228+a2bc7b32.src.rpm
Build Date  : Sat 14 Dec 2019 12:26:29 AM IST
Build Host  : arm64-036.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://www.dogtagpki.org/
Summary     : PKI CA Package


How reproducible:
Very

Steps to Reproduce:
1. See Description Section

Actual results:
It is generating Traceback error

Expected results:
if -P is null i.e -P '' It should throw a null exception

Additional info:

Comment 1 Endi Sukma Dewata 2020-03-03 18:25:17 UTC
This issue will be addressed upstream:
https://pagure.io/dogtagpki/issue/3128