#244 Non-user-friendly message when deleting non-existent subsystem with pkidestroy
Closed: Fixed Opened by edewata.

Removing a subsystem that doesn't exist would generate the following message:

% pkidestroy -s CA
ERROR:  File '/etc/sysconfig/pki/tomcat/tomcat/ca/pkideployment.cfg' is either missing or is NOT a regular file!
usage: pkidestroy -s <subsystem> [--dry_run] [-h] [-v] [-d <admin_domain>]
                  [-i <instance>] [--http_port <port>] [--https_port <port>]
                  [--ajp_port <port>] [-p <prefix>]
PKI Instance Removal
mandatory arguments:
  -s <subsystem>       where <subsystem> is CA, KRA, OCSP, RA, TKS, or TPS
optional arguments:
  --dry_run            do not actually perform any actions
  -h, --help           show this help message and exit
  -v                   display verbose information (details below)
custom arguments (OVERRIDES configuration file values):
  -d <admin_domain>    PKI admin domain name (instance name prefix)
  -i <instance>        PKI instance name (MUST specify REQUIRED ports)
  --http_port <port>   HTTP port (CA, KRA, OCSP, RA, TKS, TPS)
  --https_port <port>  HTTPS port (CA, KRA, OCSP, RA, TKS, TPS)
  --ajp_port <port>    AJP port (CA, KRA, OCSP, TKS)
test arguments:
  -p <prefix>          directory prefix to specify local directory [TEST ONLY]
VERBOSITY FLAGS    CONSOLE MESSAGE LEVEL       LOG MESSAGE LEVEL
=======================================================================
  NONE             error|warning               error|warning|info
  -v               error|warning|info          error|warning|info
  -vv              error|warning|info          error|warning|info|debug
  -vvv             error|warning|info|debug    error|warning|info|debug

Ideally it should simply say:

% pkidestroy -s CA
ERROR: No such subsystem.

It shouldn't display the command usage because this is not about invalid/missing parameters.


Changes have been made to the "pki/base/deploy/src/scriptlets/pkiparser.py" file to address these issues:

```
SPAWN:
# pkispawn -s CA -f /tmp/pki/pkideployment.cfg
(works)

# pkispawn -s CA -f /tmp/pki/pkideployment.cfg
ERROR:  PKI subsystem 'CA' for instance 'pki-tomcat' already exists!

RESPAWN:
# pkispawn -s CA -f /tmp/pki/pkideployment.cfg -u
(works)

# pkispawn -s KRA -f /tmp/pki/pkideployment.cfg -u
ERROR:  PKI subsystem 'KRA' for instance 'pki-tomcat' does NOT exist!

DESTROY:
# pkidestroy -s CA
(works)

# pkidestroy -s KRA
ERROR:  PKI subsystem 'KRA' for instance 'pki-tomcat' does NOT exist!

RESOLVED:

commit 14243746edd14be2564b625c4a940c4723c168f1
Author: Matthew Harmsen <mharmsen@redhat.com>
Date:   Tue Jul 24 11:28:29 2012 -0700
PKI Deployment Scriptlets
- PKI TRAC Ticket #244 - Non-user-friendly message when deleting non-existen
  subsystem with pkidestroy
- PKI TRAC Ticket #246 - Incorrect parameter names in pkispawn configuration
- PKI TRAC Ticket #248 - pki_ds_database should not be a DN
- PKI TRAC Ticket #249 - pki_ds_base_dn causing pkispawn failure
- PKI TRAC Ticket #250 - Creating/removing custom instances should not requi
  http/ajp ports
- PKI TRAC Ticket #251 - Instance name may conflict with other files
- PKI TRAC Ticket #253 - Fix pki-destroy removal of
  '/var/log/pki/{pki_instance_id}' directory . . .
- PKI TRAC Ticket #254 - Dogtag 10: Fix spec file to build successfully via 
  on Fedora 17 . . .
- PKI TRAC Ticket #255 - Missing resteasy-atom-provider.jar
- PKI TRAC Ticket #260 - Dogtag 10: Change the layout of 'pki_instance_id' . . .

Metadata Update from @edewata:
- Issue assigned to mharmsen
- Issue set to the milestone: Dogtag 10.0 Alpha

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/815

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Metadata